Alexander El'bert | 5 Sep 15:11

Linsolve: is it correct?

Hi,
It is very strange for me:
(%i1) linsolve(0.9*t-x*t,x);
(%o2) [x=9/10]
(%i2) keepfloat:true;
(%i3) linsolve(0.9*t-x*t,x);
(%o3) [x=0]

 Alexander                          mailto:aee <at> imm.uran.ru
ahmet alper parker | 5 Sep 15:18

Re: Linsolve: is it correct?

I am not sure but in the second equation it may be using the value of x=0.9 thus it may be trying to solve linsolve(0,x)...
But I am not sure...

On Fri, Sep 5, 2008 at 4:15 PM, Alexander El'bert <aee <at> imm.uran.ru> wrote:
Hi,
It is very strange for me:
(%i1) linsolve(0.9*t-x*t,x);
(%o2) [x=9/10]
(%i2) keepfloat:true;
(%i3) linsolve(0.9*t-x*t,x);
(%o3) [x=0]

 Alexander                          mailto:aee <at> imm.uran.ru


_______________________________________________
Maxima mailing list
Maxima <at> math.utexas.edu
http://www.math.utexas.edu/mailman/listinfo/maxima

_______________________________________________
Maxima mailing list
Maxima <at> math.utexas.edu
http://www.math.utexas.edu/mailman/listinfo/maxima
ahmet alper parker | 5 Sep 16:31

Re: Linsolve: is it correct?

Sorry, it seems this is not the right answer...

On Fri, Sep 5, 2008 at 4:18 PM, ahmet alper parker <aaparker <at> gmail.com> wrote:
I am not sure but in the second equation it may be using the value of x=0.9 thus it may be trying to solve linsolve(0,x)...
But I am not sure...


On Fri, Sep 5, 2008 at 4:15 PM, Alexander El'bert <aee <at> imm.uran.ru> wrote:
Hi,
It is very strange for me:
(%i1) linsolve(0.9*t-x*t,x);
(%o2) [x=9/10]
(%i2) keepfloat:true;
(%i3) linsolve(0.9*t-x*t,x);
(%o3) [x=0]

 Alexander                          mailto:aee <at> imm.uran.ru


_______________________________________________
Maxima mailing list
Maxima <at> math.utexas.edu
http://www.math.utexas.edu/mailman/listinfo/maxima


_______________________________________________
Maxima mailing list
Maxima <at> math.utexas.edu
http://www.math.utexas.edu/mailman/listinfo/maxima
Edwin Woollett | 5 Sep 19:36

Re: Linsolve: is it correct?

On 5 Sep 2008, Alexander El'bert wrote:

> Hi,
> It is very strange for me:
> (%i1) linsolve(0.9*t-x*t,x);
> (%o2) [x=9/10]
> (%i2) keepfloat:true;
> (%i3) linsolve(0.9*t-x*t,x);
> (%o3) [x=0]
>
> Alexander     

It appears that keepfloat:true screws up linsolve
and is ignored by solve:
A. screws up linsolve:

(%i1)  display2d:false$
(%i2) [globalsolve,programmode];
(%o2) [false,true]
(%i3) block([ratprint:false],
          linsolve([0.9*x + 0.3*y = 2.1,0.3*x -0.5*y = 5.4],[x,y] ) );
(%o3) [x = 89/18,y = -47/6]
(%i4) block([ratprint:false,keepfloat:true],
          linsolve([0.9*x + 0.3*y = 2.1,0.3*x -0.5*y = 5.4],[x,y] ) );
Inconsistent equations:  [2]
 -- an error.  To debug this try debugmode(true);

B. ignored by solve:

(%i5) block([keepfloat:true ],
        solve([0.9*x + 0.3*y = 2.1,0.3*x -0.5*y = 5.4],[x,y] ) );
`rat' replaced -2.1 by -21/10 = -2.1

`rat' replaced 0.9 by 9/10 = 0.9

`rat' replaced 0.3 by 3/10 = 0.3

`rat' replaced -5.4 by -27/5 = -5.4

`rat' replaced 0.3 by 3/10 = 0.3

`rat' replaced -0.5 by -1/2 = -0.5
(%o5) [[x = 89/18,y = -47/6]]

If you are doing float problems, use solve
wrapped in float and turn off ratprint.

As in
(%i7) fsolve(eqns,vars) := (ratprint:false, float(solve(eqns,vars)) );
(%o7) fsolve(eqns,vars):=(ratprint:false,float(solve(eqns,vars)))
(%i8) fsolve(0.9*a - a*x,x);
(%o8) [x = 0.9]
(%i9) fsolve(0.8*x^2 + 2.3*x - 4.3, x);
(%o9) [x = -4.1653941053494,x = 1.2903941053494]

For deeper answers, you need experts in the linsolve code.

Ted Woollett

Gmane