I'm writing a sympy expression to a javascript snippet in an html page that
is then interpreted by Geogebra to set parameters in an embedded applet.
I'm just using the string printer, as I'm not having sympy actually output
javascript code, just the mathematical expression like "3x**2+2."
Unfortunately, Geogebra does not interpret "3e-5" as "0.00005" but instead
as the constant "3e" minus 5. It will, however, interpret "3E-5" as
"0.00005".
Is there an easy way to get sympy to output a float using scientific
notation with a capital E? For single numbers, I can just use
"%E" % expression
to format it in that notation. But if expression=S("3e-17*x+1"), then this
syntax does work, because Add cannot be converted to a float.
I suppose could try to figure out how to use re.sub to replace the "e" with
"E" after printing and before writing to the html page, but I thought there
might be a more elegant solution.
Duane
--
You received this message because you are subscribed to the Google Groups
"sympy" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sympy.
For more options, visit https://groups.google.com/groups/opt_out.