rtoy / maxima

A Clone of Maxima's repo
Other
0 stars 0 forks source link

integrate((1/2)*u^2-1/u^5,u,1,sqrt(2)); is not correct... #3056

Closed rtoy closed 3 months ago

rtoy commented 3 months ago

Imported from SourceForge on 2024-07-07 12:40:11 Created by gabryuri on 2004-04-19 23:02:12 Original: https://sourceforge.net/p/maxima/bugs/560


Sorry, but in the integral (1/2)*u^2-1/u^5 with u=1 to sqrt(2) them Maxima program return

SQRT(2) 1 ------- - - 3 6

Maxima comand: integrate((1/2)*u^2-1/u^5,u,1,sqrt (2));

But the answer correct is:

sqrt(2) 17 ------- - ----- 3 48

See in MuPad, Maple or Mathematica.

sorry by english. Luis Cláudio - Brasilia - Brazil. luis_claudio2000@yahoo.com.br

rtoy commented 3 months ago

Imported from SourceForge on 2024-07-07 12:40:12 Created by willisbl on 2004-04-21 14:48:01 Original: https://sourceforge.net/p/maxima/bugs/560/#9b90


Logged In: YES user_id=895922

Thank you for reporting this bug; I suspect that the following bug is related to the one you found.

(C2) integrate(1/x^5,x,1,sqrt(2)); (D2) 0 (C3) build_info();

Maxima version: 5.9.0.1cvs Maxima build date: 8:30 4/21/2004 host type: i686-pc-mingw32 lisp-implementation-type: Kyoto Common Lisp lisp-implementation-version: GCL 2.7.0

If you find more Maxima bugs, please report them.

Regards,

Barton

rtoy commented 3 months ago

Imported from SourceForge on 2024-07-07 12:40:16 Created by willisbl on 2004-04-22 16:03:09 Original: https://sourceforge.net/p/maxima/bugs/560/#d15a


Logged In: YES user_id=895922

To integrate 1/x^5 from 1 to sqrt(s), Maxima makes a change of variable and then it uses residues. But
when 'solvecase' fails to find the poles, it returns failure and polelist returns nil. After that 'res' believes that there are no poles so the sum of the residues vanishes.

I can put a trap in initial-analysis that catches more easy cases and prevents Maxima from using the residue method---I don't have a fix for the real problem.

(C4) integrate(1/x^5,x,1,sqrt(2)); 1> (POLELIST ((MPLUS SIMP IRREDUCIBLE FACTORED) 1 ((MTIMES SIMP RATSIMP) 5 ((MEXPT SIMP) 2 ((RAT SIMP) 1 2)) |$x|) ((MTIMES SIMP) 20 ((MEXPT SIMP RATSIMP) |$x| 2)) ((MTIMES SIMP) 20 ((MEXPT SIMP) 2 ((RAT SIMP) 1 2)) ((MEXPT SIMP RATSIMP) |$x| 3)) ((MTIMES SIMP) 20 ((MEXPT SIMP RATSIMP) |$x| 4)) ((MTIMES SIMP) 4 ((MEXPT SIMP) 2 ((RAT SIMP) 1 2)) ((MEXPT SIMP RATSIMP) |$x| 5))) #<compiled-closure 108d7e8c> #<compiled-closure 108d7ea8>) 2> (SOLVECASE ((MPLUS SIMP IRREDUCIBLE FACTORED) 1 ((MTIMES SIMP RATSIMP) 5 ((MEXPT SIMP) 2 ((RAT SIMP) 1 2)) |$x|) ((MTIMES SIMP) 20 ((MEXPT SIMP RATSIMP) |$x| 2)) ((MTIMES SIMP) 20 ((MEXPT SIMP) 2 ((RAT SIMP) 1 2)) ((MEXPT SIMP RATSIMP) |$x| 3)) ((MTIMES SIMP) 20 ((MEXPT SIMP RATSIMP) |$x| 4)) ((MTIMES SIMP) 4 ((MEXPT SIMP) 2 ((RAT SIMP) 1 2)) ((MEXPT SIMP RATSIMP) |$x| 5)))) <2 (SOLVECASE FAILURE) <1 (POLELIST NIL) (D4) 0 (C5)

Compare this to

(C5) integrate(1/x^5,x,1,2); 1> (POLELIST ((MEXPT SIMP FACTORED) ((MPLUS SIMP IRREDUCIBLE) 1 ((MTIMES SIMP RATSIMP) 2 |$x|)) 5) #<compiled-closure 108d7e8c> #<compiled-closure 108d7ea8>) 2> (SOLVECASE ((MEXPT SIMP FACTORED) ((MPLUS SIMP IRREDUCIBLE) 1 ((MTIMES SIMP RATSIMP) 2 |$x|)) 5)) <2 (SOLVECASE (((MEQUAL SIMP) |$x| ((RAT SIMP) -1 2)) 5)) <1 (POLELIST ((((RAT SIMP) -1 2) ((MEXPT SIMP) ((MPLUS SIMP) ((RAT SIMP) 1 2) |$x|) 5)) ((((RAT SIMP) -1 2) 5)) NIL NIL))

(c6) 15 / 64

(DEFUN POLELIST (D REGION REGION1) (PROG (ROOTS $BREAKUP R RR SS R1 S POLE WFLAG CF) (SETQ WFLAG T) (SETQ LEADCOEF (POLYINX D VAR 'LEADCOEF)) (SETQ ROOTS (SOLVECASE D)) (if (eq roots 'failure) (return ())) ;; <-- this is a trouble maker for res LOOP1 (COND ((NULL ROOTS) (COND ((AND SEMIRAT

Barton

rtoy commented 3 months ago

Imported from SourceForge on 2024-07-07 12:40:19 Created by willisbl on 2004-04-22 16:41:34 Original: https://sourceforge.net/p/maxima/bugs/560/#aaea


Logged In: YES user_id=895922

I thought of a fix that isn't terrible. I inserted a call to gfactor in solvecases. I also put an merror into polelist---this way a user will get an error instead of a wrong value should solvecases ever fail. The gfactor fix seems to fix this problem.

Barton

rtoy commented 3 months ago

Imported from SourceForge on 2024-07-07 12:40:22 Created by willisbl on 2004-04-22 16:41:34 Original: https://sourceforge.net/p/maxima/bugs/560/#3fd4


fix for residu.lisp

Attachments:

rtoy commented 3 months ago

Imported from SourceForge on 2024-07-07 12:40:26 Created by rtoy on 2006-03-13 15:34:25 Original: https://sourceforge.net/p/maxima/bugs/560/#2f9b


rtoy commented 3 months ago

Imported from SourceForge on 2024-07-07 12:40:29 Created by rtoy on 2006-03-13 15:34:25 Original: https://sourceforge.net/p/maxima/bugs/560/#9faf


Logged In: YES user_id=28849

Maxima returns the correct answer now.