Hi,
How do I tell Maxima that d(x(i))/dx = 1
I'm new to Maxima and I'm working a really basic problem: solving the least squares method. In this method you have to define the sum of an assemblage of numbers. I've already figured out a trick of defining a variable as a function of indices.
For example, let's say I have a collection of data points x_i, y_i ==> {(x1,y1), (x2,y2), ...}. Let's also say I want to fit a straight line through this data. The line has the form
y = a*x +b
I can define the error as
error = (fitted value of y) - (measured value of y)
= (a*x_i+b) - y_i
And the sum of the squares as
SSE = SUM[(a*x + b - y)^2]
Now when I try to do this in Maxima I use the following definition:
SSE:sum( (a*x(i) +b - y(i) )^2, i, 0, N)
This seems to work OK. However, when I try to differentiate this expression with respect to a, I get a residual d(x(i))/dx in my answer. Now, I know that d(x(i))/dx =1, but how to I tell Maxima this?