0
$\begingroup$

I used NonlinearModelFit to fit some data and although Mathematica thinks it has got the result, the answer is enclosed in these double angular brackets. What does it mean?

More importantly, I cannot plot the resulted fit model.

data = {{-0.0372`, -0.60395`}, {-0.036177`, -0.60683`}, {-0.03534`, \
-0.62248`}, {-0.034317`, -0.65084`}, {-0.033387`, -0.65727`}, \
{-0.03255`, -0.56435`}, {-0.031527`, -0.58371`}, {-0.030597`, \
-0.55025`}, {-0.029667`, -0.61262`}, {-0.028737`, -0.49738`}, \
{-0.027807`, -0.51389`}, {-0.025947`, -0.57947`}, {-0.024924`, \
-0.56943`}, {-0.024087`, -0.56735`}, {-0.023157`, -0.61868`}, \
{-0.02232`, -0.47666`}, {-0.021297`, -0.57355`}, {-0.020367`, \
-0.53975`}, {-0.019437`, -0.49041`}, {-0.0186`, -0.5462`}, \
{-0.017577`, -0.54958`}, {-0.016647`, -0.47732`}, {-0.01581`, \
-0.43461`}, {-0.01395`, -0.36316`}, {-0.012927`, -0.42594`}, \
{-0.011997`, -0.37189`}, {-0.010137`, -0.43096`}, {-0.009207`, \
-0.41751`}, {-0.007347`, -0.33758`}, {-0.00651`, -0.27427`}, \
{-0.005487`, -0.33954`}, {-0.004557`, -0.30146`}, {-0.00372`, \
-0.10965`}, {-0.002697`, -0.06288`}, {-0.00186`, -0.08908`}, \
{-0.000837`, 0.`}, {0.000837`, 
   0.`}, {0.00186`, -0.08908`}, {0.002697`, -0.06288`}, {0.00372`, \
-0.10965`}, {0.004557`, -0.30146`}, {0.005487`, -0.33954`}, \
{0.00651`, -0.27427`}, {0.007347`, -0.33758`}, {0.009207`, \
-0.41751`}, {0.010137`, -0.43096`}, {0.011997`, -0.37189`}, \
{0.012927`, -0.42594`}, {0.01395`, -0.36316`}, {0.01581`, -0.43461`}, \
{0.016647`, -0.47732`}, {0.017577`, -0.54958`}, {0.0186`, -0.5462`}, \
{0.019437`, -0.49041`}, {0.020367`, -0.53975`}, {0.021297`, \
-0.57355`}, {0.02232`, -0.47666`}, {0.023157`, -0.61868`}, \
{0.024087`, -0.56735`}, {0.024924`, -0.56943`}, {0.025947`, \
-0.57947`}, {0.027807`, -0.51389`}, {0.028737`, -0.49738`}, \
{0.029667`, -0.61262`}, {0.030597`, -0.55025`}, {0.031527`, \
-0.58371`}, {0.03255`, -0.56435`}, {0.033387`, -0.65727`}, \
{0.034317`, -0.65084`}, {0.03534`, -0.62248`}, {0.036177`, \
-0.60683`}, {0.0372`, -0.60395`}}

f[x_] := Sum[
  2*(Sqrt[n + x + 1] - Sqrt[n + x]) - 1/Sqrt[n + x + 1/2], {n, 0, 
   Infinity}]

NonlinearModelFit[data, 
 1/2/Pi^2/(a*Sqrt[Abs[1/x]])*f[b/Abs[x]], {a, b}, x]

This yields a result with some numbers in << >>. If I copy the result and try to use Plot over some range of x, I also get an error.

$\endgroup$
1
  • $\begingroup$ If you look at the docs for NonlinearModelFit[], you might encounter a function called Normal[]... $\endgroup$ Oct 18, 2015 at 20:15

1 Answer 1

7
$\begingroup$

NonlinearModelFit returns a FittedModel object. Please see the respective documentation pages on how to use these objects. Most importantly: these objects contain a lot of information that is not meant to be read by you, the user. What you see on the screen is just a shorthand representation of the object. In most cases, you cannot copy this visual representation and re-use it that way. Instead, you need to assign it to a variable, then work with that variable.

fm = NonlinearModelFit[...]

The documentation has plenty of examples on how to work with them. You must read through these first.

You can use them as a function fm[x], you can convert them to a formula, Normal[fm], and you can query many properties fm["Properties"].

$\endgroup$

Not the answer you're looking for? Browse other questions tagged or ask your own question.