Ask Your Question

Human readable representation of formulas

asked 2013-04-29 06:55:02 -0500

anonymous user


updated 2013-04-29 08:39:45 -0500

calc314 gravatar image


i do have question regarding the representation of formulas in sage.

Is a formula typed into sage, the routines will transform the expression, which could be less human readable. How can I programm sage to use the typed in formula and still compute a solution?



will be transformed to

(1.57548476454294e-6)*(h + 140)^2 + 0.190000000000000


edit retag flag offensive close merge delete


Are you trying to preserve the exact input? Perhaps a string literal is what you need.

rickhg12hs gravatar imagerickhg12hs ( 2013-04-29 11:24:26 -0500 )edit

2 answers

Sort by ยป oldest newest most voted

answered 2013-04-29 08:39:23 -0500

calc314 gravatar image

In this example you've given, I'd suggest writing 0.19 and 0.91 as 19/100 and 91/100, respectively. Then, Sage will not attempt to use floating point arithmetic on them, and the expressions will appear nicer. For a more attractive output, you can also use show(f(h)) to have a nicely typeset version appear in the notebook.

edit flag offensive delete link more

answered 2013-04-29 09:42:48 -0500

this post is marked as community wiki

This post is a wiki. Anyone with karma >750 is welcome to improve it.

Thank you for your response to my question. Output with your notation:

   --> 91/57760000*(h + 140)^2 + 19/100

Other example:

S(A) = (0.25+1.91*((A+140)/760)^2) >= 0.85
    --> (3.30678670360111e-6)*(A + 140)^2 + 0.250000000000000 >= (17/20)

S(A) = (25/100+191/100*((A+140)/760)^2) >= 85/100
    -->  191/57760000*(A + 140)^2 + 1/4 >= (17/20)

Is there a other way to display the same formula as programmed, because for a quick review the output is not handy?

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools


Asked: 2013-04-29 06:55:02 -0500

Seen: 110 times

Last updated: Apr 29 '13