UweD
UweD

Reputation: 222

Simplifying large coefficients in SymPy

I use SymPy for symbolic calculations in Python and get e.g. an expression like

Z =  2.02416176758139e+229 / (2.42579446609411e+232 * s + 9.8784848517664e+231)

Is there a function in SymPy (e.g. in sympy.simplify?) to get something like

Z = 2.024 / (2425.8 * s + 987.8)

Upvotes: 0

Views: 155

Answers (1)

smichr
smichr

Reputation: 18964

The intent of your request can be met by allowing cancellation:

>>> 1/(1/Z)
1/(1198.41926912424*second + 488.028427864731)

or

>>> factor(Z)
0.00083443251102827/(1.0*second + 0.407226786516346)

But there is no built-in method of accessing the exponent in an exponential form.

Upvotes: 2

Related Questions