fit nonlinear model to data - better way to code it?




> 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]);




________________________________
 From: Raymond Toy <toy.raymond at gmail.com>
To: Ether Jones <maxima at etherjones.us> 
Cc: maxima <maxima at math.utexas.edu> 
Sent: Thursday, May 17, 2012 7:36 PM
Subject: Re: [Maxima] fit nonlinear model to data - better way to code it?
 




On Thu, May 17, 2012 at 12:25 PM, Ether Jones <maxima at etherjones.us> wrote:


>
>
>
>p:[p1,p2,p3]$
>f(x):=p[1]+p[2]/(x-p[3])$

I guess this actually works, but p is supposed to be a list of the parameters and f(x) should be an expression containing the parameters:

f(x) := p1 + p2/(x-p3)

minpack(f(x)-y,[p1,p2,p3],guess);

Ray