fit nonlinear model to data - better way to code it?
Subject: fit nonlinear model to data - better way to code it?
From: Rupert Swarbrick
Date: Fri, 18 May 2012 09:24:28 +0100
Ether Jones <maxima at etherjones.us> writes:
>> f(x) := p1 + p2/(x-p3)
>>
>
>> minpack(f(x)-y,[p1,p2,p3],guess);
>
>
> If I do it that way, it breaks the following line of code:? trendline:
> ev(f(x),p=ans[1]);
Hmm, I was going to suggest that
ev(f(x), [p1,p2,p3] = ans[1])
should work, but surprisingly it doesn't. For example:
(%i14) p1, [p1,p2,p3]=[3,4,5];
(%o14) p1
Does anyone know if there is a reason for this? It seems at odds with
(%i15) [p1,p2,p3]: ans[1];
(%o15) [- .2694298415835076, - .4248176441471781, 1.331747718996615]
(%i16) p1;
(%o16) - .2694298415835076
Rupert
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 315 bytes
Desc: not available
URL: <http://www.math.utexas.edu/pipermail/maxima/attachments/20120518/40be645e/attachment.pgp>