Menu

#224 3 solver bugs

None
open
nobody
5
2021-09-21
2003-02-06
No
GCL (GNU Common Lisp)  Version(2.5.0) Sun Nov 17 15:58:09 CET 2002 
Licensed under GNU Library General Public License 
Contains Enhancements by W. Schelter 
Maxima 5.9.0rc3 http://maxima.sourceforge.net 
Distributed under the GNU Public License. See the file COPYING. 
Dedicated to the memory of William Schelter. 
This is a development version of Maxima. The function bug_report() 
provides bug reporting information. 
(C1) EquationP(e):=if part(e,0)="=" then true else false$ 

(C2) load("/usr/labri/rubey/maxima/src/binary-gcl/comm.o")$ 

(C3) load("/usr/labri/rubey/maxima/src/binary-gcl/mutils.o")$ 

(C4) load("/usr/labri/rubey/maxima/src/binary-gcl/set.o")$ 

(C5) load("algebra/solver/misc")$ 

(C6) load("algebra/solver/solver")$ 

(C7) display2d:false$ 

(C8) trace(solve)$ 

(C9) solver([u-t*(u^(l+1)+u+1) = 0,1-t*((l+1)*u^l+1) = 0],[u,t],[l]); 

1 Enter SOLVE [(-l-1)*t*u^l-t+1,u] 
Is  l  an integer? 

y; 
1 Exit  SOLVE [u = (1/(l*t+t)-t/(l*t+t))^(1/l)] 
1 Enter SOLVE 
[-((l*((-(t-1)/((l+1)*t))^(1/l)+1)+1)*t-l*(-(t-1)/((l+1)*t))^(1/l))/(l+1),t] 
1 Exit  SOLVE [t = 
l*(-(t-1)/((l+1)*t))^(1/l)/(l*(-(t-1)/((l+1)*t))^(1/l)+l+1)] 
(D9) [[u = (-(t-1)/((l+1)*t))^(1/l), 
[-((l*((-(t-1)/((l+1)*t))^(1/l)+1)+1)*t-l*(-(t-1)/((l+1)*t))^(1/l)) 
/(l+1)]]] 

(should be something like

t = l^(l/(l+1))/(l^(l/(l+1))+l+1), u = l^(-1/(l+1))) 

The second item of the solution does not make t explicit, although solve
did...

  1. second bug (I think this is known, but I'm not sure)

the second time solver is invoked, it is silently assumed that l is an
integer. I think this assumption should be removed...

  1. third bug

don't use i or k as one of your variables:

(C1) EquationP(e):=if part(e,0)="=" then true else false$ 
(C1)  
(C2) load("/usr/labri/rubey/maxima/src/binary-gcl/comm.o")$ 

(C3) load("/usr/labri/rubey/maxima/src/binary-gcl/mutils.o")$ 

(C4) load("/usr/labri/rubey/maxima/src/binary-gcl/set.o")$ 

(C5) load("algebra/solver/misc")$ 

(C6) load("algebra/solver/solver")$ 

(C7) display2d:false$ 

(C8) trace(solve)$ 

(C9) solver([u-t*(u^(k+1)+1)=0,1-(k+1)*t*u^k=0],[u,t]); 

1 Enter SOLVE [(-k-1)*t*u^k+1,t] 
1 Exit  SOLVE [t = 1/((k+1)*u^k)] 
Warning: GET(OP(EXPR),'Valuation) was declared mode FIXNUM, has 
value: FALSE 
1 Enter SOLVE [(2*u^3-1)/(3*u^2),u] 

* obviously, this is wrong here ** who set k=2 ??? This might
have to do with dynamic scope - in valuationsolver k is used, and if I
leave away the parameter k, i get the following message:

Warning: GET(OP(EXPR),'Valuation) was declared mode FIXNUM, has 
value: 
FALSE 
*********************************************** 


1 Exit  SOLVE [u = (SQRT(3)*%I-1)/(2*2^(1/3)),u = 
-(SQRT(3)*%I+1)/(2*2^(1/3)),u = 1/2^(1/3)] 
(D9) [[u = (SQRT(3)*%I-1)/(2*2^(1/3)), 
t = 2^(4*k/3)/((SQRT(3)*%I-1)^k*k+(SQRT(3)*%I-1)^k)], 
[u = -(SQRT(3)*%I+1)/(2*2^(1/3)), 
t = 2^(4*k/3)/((-SQRT(3)*%I-1)^k*k+(-SQRT(3)*%I-1)^k)], 
[u = 1/2^(1/3),t = 2^(k/3)/(k+1)]] 

similar trouble for i


(C10) solver([u-t*(u^(i+1)+1)=0,1-(i+1)*t*u^i=0],[u,t],[i]); 

1 Enter SOLVE [(-i-1)*t*u^i+1,t] 
1 Exit  SOLVE [t = 1/((i+1)*u^i)] 
1 Enter SOLVE [(i*u^(i+1)-1)/((i+1)*u^i),u] 
Is  i  an integer? 

y; 
1 Exit  SOLVE [u = 1/i^(1/(i+1))] 
(D10) [[u = 1,t = 1/2]] 

(with l in place of i or k the result is correct:

solver([u-t*(u^(l+1)+1)=0,1-(l+1)*t*u^l=0],[u,t],[l]); 

(D15) [[u = 1/l^(1/(l+1)),t = l^(l/(l+1))/(l+1)]] 

Martin

Discussion


Log in to post a comment.