简体   繁体   中英

Python: sympy, I cannot solve the hyperbolic sine equation

I have one problem that the sympy module is not solve the following equation.

import sympy as sy
from sympy import Symbol
from sympy import *

deld = Symbol('deld')
sinh = sy.sinh
a = (-0.00026478*deld - 1.75012e-9*sinh(0.62831 - 62831.85307*deld) + 1.750123e-9*sinh(62831.85307*deld - 0.62831) + 2.64786e-9)
b = (0.00026478*deld + 1.75012e-9*sinh(0.62831 - 62831.85307*deld) - 1.750123e-9*sinh(62831.85307*deld - 0.62831) - 2.34686e-9)
c= -1

d = sy.solve((a/b)+c, deld)


print (d)

I want to get the numerical value of 'deld'. But python does not solve this equation with memory error. I already tired to solve this problem with 128GB RAM, But it was failed.

Please any help. Thank you.

If you want a numerical solution then in SymPy it is better to use nsolve . The numerical problem that you have posed is extremely ill conditioned so many numerical solvers will struggle. It is also not something that can easily be solved symbolically (which is what you are asking for by calling solve rather than nsolve ).

Plotting the function reveals that there is a root in the range [0.6e-5, 0.7e-5] . We can ask nsolve to find that root:

In [62]: nsolve((a/b+c), deld, [0.6e-5, 0.7e-5])
Out[62]: 6.50904815581165e-6

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM