problem with fitting data using lsquares





On Mon, 14 Jun 2010, Jaime Villate wrote:

> On Mon, 2010-06-14 at 14:31 +0200, Hugo Coolens wrote:
>> Here is my input-file:
>> m:matrix([100,16000],[200,8000],[500,3636],[1000,1818],[2000,870],[5000,323],[10000,160],[20000,83],[50000,33],[100000,20]);
>> lsquares_estimates (m, [x, y], y = sqrt(a^2 + (10e7/(2*%pi*x*b))^2),[a, b], initial=[10, 10]);
>> /* => [[a = 19.2898942613692, b = 9.89381119455951]]*/
>> /* b = 10 is the exact value for b.*/
>> /* I'll construct the mean square error as a function of a alone*/
>> /* and then plot it. */
>> mse : lsquares_mse (m, [x, y], y = sqrt(a^2 + (10e7/(2*%pi*x*b))^2));
>> mse1 (a) := ''(subst (b=10, mse));
>> plot2d(mse1(a), [a,0,100]);
> Hi Hugo,
> The maxout.gnuplot file that you sent me in a private message shows that
> Maxima could not evaluate mse1 numerically. It is important for us to
> see how mse1(a) is being defined in your system; namely, after the above
> input commands, please type:
>  grind(mse1(0));
> and show us the result.
I did add grind(mse1(0)); and here is the result:
(%i5)
plot [0.:100.] '-' notitle with lines 3
                                 ^
"/home/coolens/maxout.gnuplot", line 5: warning: Skipping data file with 
no valid points

plot [0.:100.] '-' notitle with lines 3
                                       ^
"/home/coolens/maxout.gnuplot", line 5: all points y value undefined!

(%o5)
(%i6)
lsquares_mse(matrix([100,16000],[200,8000],[500,3636],[1000,1818],[2000,870],

[5000,323],[10000,160],[20000,83],[50000,33],[100000,20]),
              [x,y],y = 5000000.0/(%pi*abs(x)))$
(%o6)                                done





> Another thing that we need to know is the output of the command:
>  build_info();
(%i1)  build_info();

Maxima version: 5.13.0
Maxima build date: 22:7 9/5/2008
host type: i686-pc-linux-gnu
lisp-implementation-type: GNU Common Lisp (GCL)
lisp-implementation-version: GCL 2.6.7

regards,
Hugo