[Maxima] Partial differentiation of a sum??
balteo at gmail.com
Sun Oct 17 14:03:15 CDT 2010
It works using expand(foo) as suggested by Robert.
I am also going to have a look at the lsquare package.
2010/10/17 Robert Dodier <robert.dodier at gmail.com>
> On 10/17/10, Julien Martin <balteo at gmail.com> wrote:
> > I am working with the least squares method, I would like to differentiate
> > sum as follows and I am having problems.
> > What I want to achieve:
> > -define a sum
> > -differentiate it with respect to "a" and "b" respectively.
> > -solve the resulting system.
> > *exp:sum((y_i-a*x_i-b)^2,i,1,n);
> > one:diff(exp,a,1)=0;
> > two:diff(exp,b,1)=0;
> > linsolve([one, two], [a,b]);
> Subscripted variables are denoted by square brackets in Maxima.
> x_i is just an arbitrary symbol, x[i] is a subscripted variable.
> By default, Maxima doesn't assume sum is linear.
> Try declare(sum, linear).
> Also try expand(foo) where foo is your derivative expression.
> Naming a user variable exp is probably going to eventually
> lead to obscure problems since exp is the exponential function.
> If you want to solve least squares problems in general,
> take a look at the lsquares package.
> ?? lsquares finds some info about that.
> Robert Dodier
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Maxima