On Tue, 1 Sep 2009, Mikie wrote: > > When I run the server with the function above and the following string > from a text box I get > [y=-1,x=0]. The string is "[3*x-y-1,x+(1/3)*y]" > > It is changing the input value to [3*x-y-1,x]
1/3 = 0 in Python. Also, I hope you realize how dangerous eval("random string someone gave you from the web") is! - Robert > > On Sep 1, 10:38 am, Mikie <thephantom6...@hotmail.com> wrote: >> Sorry, wrong function >> >> def MSolveSys(syss): >> eqns=eval(syss) >> solns=maxima.solve(eqns) >> return solns >> >> On Sep 1, 10:31 am, Jason Grout <jason-s...@creativetrax.com> wrote: >> >> >> >>> Robert Bradshaw wrote: >>>> On Sep 1, 2009, at 9:17 AM, Mikie wrote: >> >>>>> Here is function I am using to solve systems of linear equations. >> >>>>> def MSolveSys(syss): >>>>> eqns=eval(syss) >>>>> solns=maxima.solve(syss) >>>>> return solns >> >>>>> Works great in the notebook, but when I put it in a Python script it >>>>> rounds the coeficients of the variables and thus produces bad >>>>> solutions. >> >>>> Perhaps eval here is the culprit. You might have to parse it a bit >>>> yourself. SR("...") will parse expressions. >> >>> Mikie effectively isn't using "eval", right? That line (and the "eqns" >>> variable) is not being used. >> >>> Jason >> >>> -- >>> Jason Grout- Hide quoted text - >> >>> - Show quoted text -- Hide quoted text - >> >> - Show quoted text - > > > --~--~---------~--~----~------------~-------~--~----~ To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to sage-support-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-support URLs: http://www.sagemath.org -~----------~----~----~----~------~----~------~--~---