## maxima-bugs

 [Maxima-bugs] [ maxima-Bugs-2994196 ] bug in mring.lisp (mnewton) From: SourceForge.net - 2010-04-29 14:33:46 ```Bugs item #2994196, was opened at 2010-04-29 15:33 Message generated for change (Tracker Item Submitted) made by l_butler You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=104933&aid=2994196&group_id=4933 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: Share Libraries Group: Includes proposed fix Status: Open Resolution: None Priority: 5 Private: No Submitted By: Leo Butler (l_butler) Assigned to: Nobody/Anonymous (nobody) Summary: bug in mring.lisp (mnewton) Initial Comment: I believe that there is a bug in the present mring.lisp which prevents this probblem, and similar ones, from being solved by mnewton. The basic problem is that in trying to create CL complex numbers from a Maxima expression, float is being called too late. (%i1) load(mnewton)\$ (%i2) f:diff(acos(x^2+8.363+267)/(sqrt(x^2-4.29*x+1042)*(x^2+12.8102*x+1177)),x)\$ (%i3) mnewton(f,x,-5.0); Unable to convert %i*(2.9524823745650125e-8*sin(1.5*%pi)+1.7009864675953376e-7*sin(0.5*%pi)-4.375144669837393e-7)-2.9524823745650125e-8*cos(1.5*%pi) %to a complex long fl\ oat #0: solve_by_lu(eqs=[(-4.375144669837393e-7*%i-1.7009864675953376e-7/(-1)^0.5-2.9524823745650125e-8/(-1)^1.5)*h[1]+6.978...,vars=[h[1]],field=complexfield) #1: mnewton(funclist=-(2*x-4.29)*acos(x^2+275.363)/(2*(x^2-4.29*x+1042)^(3/2)*(x^2+12.8102*x+1177))-(2*x+12.8102)*acos(x^...,varlist=x,guesslist=-5.0)(mnewton.mac line 1\ 13) -- an error. To debug this try: debugmode(true); ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=104933&aid=2994196&group_id=4933 ```
 [Maxima-bugs] [ maxima-Bugs-2994196 ] bug in mring.lisp (mnewton) From: SourceForge.net - 2010-04-29 14:47:50 ```Bugs item #2994196, was opened at 2010-04-29 15:33 Message generated for change (Settings changed) made by l_butler You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=104933&aid=2994196&group_id=4933 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: Share Libraries Group: Includes proposed fix >Status: Closed >Resolution: Fixed Priority: 5 Private: No Submitted By: Leo Butler (l_butler) Assigned to: Nobody/Anonymous (nobody) Summary: bug in mring.lisp (mnewton) Initial Comment: I believe that there is a bug in the present mring.lisp which prevents this probblem, and similar ones, from being solved by mnewton. The basic problem is that in trying to create CL complex numbers from a Maxima expression, float is being called too late. (%i1) load(mnewton)\$ (%i2) f:diff(acos(x^2+8.363+267)/(sqrt(x^2-4.29*x+1042)*(x^2+12.8102*x+1177)),x)\$ (%i3) mnewton(f,x,-5.0); Unable to convert %i*(2.9524823745650125e-8*sin(1.5*%pi)+1.7009864675953376e-7*sin(0.5*%pi)-4.375144669837393e-7)-2.9524823745650125e-8*cos(1.5*%pi) %to a complex long fl\ oat #0: solve_by_lu(eqs=[(-4.375144669837393e-7*%i-1.7009864675953376e-7/(-1)^0.5-2.9524823745650125e-8/(-1)^1.5)*h[1]+6.978...,vars=[h[1]],field=complexfield) #1: mnewton(funclist=-(2*x-4.29)*acos(x^2+275.363)/(2*(x^2-4.29*x+1042)^(3/2)*(x^2+12.8102*x+1177))-(2*x+12.8102)*acos(x^...,varlist=x,guesslist=-5.0)(mnewton.mac line 1\ 13) -- an error. To debug this try: debugmode(true); ---------------------------------------------------------------------- >Comment By: Leo Butler (l_butler) Date: 2010-04-29 15:47 Message: This is fixed in v1.25 by patching mring.lisp (%i4) load("/home/work/maxima/sandbox/maxima/share/linearalgebra/mring.lisp")\$ (%i5) mnewton(f,x,-5.0); (%o5) [[x = 2.013631497110261e-16*%i-5.626466372928149]] --- mring.lisp.~1.24.~ 2008-02-14 01:31:37.000000000 +0000 +++ mring.lisp 2010-04-27 19:13:14.000000000 +0100 @@ -114,11 +114,14 @@ :mring-to-maxima #'(lambda (s) (add (realpart s) (mult '\$%i (imagpart s)))) ;; was complexify :maxima-to-mring #'(lambda (s) (progn - (setq s (\$rectform (meval s))) - (if (complex-number-p s 'float-or-rational-p) - (complex (\$float (\$realpart s)) (\$float (\$imagpart s))) + (setq s (coerce-expr-to-clcomplex (\$rectform (meval s)))) + (if (complexp s) + s (merror "Unable to convert ~:M to a complex long float" s)))))) +(defun coerce-expr-to-clcomplex (s) + (complex (funcall (coerce-float-fun (\$realpart s))) (funcall (coerce-float-fun (\$imagpart s))))) + ---------------------------------------------------------------------- Comment By: Leo Butler (l_butler) Date: 2010-04-29 15:47 Message: The reported bug is not present in the current cvs version of Maxima. Thank you for your report. If you see this bug in a later version of Maxima, please submit a new bug report. ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=104933&aid=2994196&group_id=4933 ```