solve a PDE with pdsolve

305 views
Skip to first unread message

rolfd...@gmail.com

unread,
May 3, 2017, 2:00:11 PM5/3/17
to sympy
Hi,
I have just started using sympy and tried to solve a PDE like this:





My approach in sympy was:

from sympy.solvers.pde import pdsolve
from sympy import Function, diff, pprint, Eq, init_printing
from sympy.abc import x,t,c
init_printing()
u = Function('u')
w = Eq(diff(u(t),t,2) - (c**2*diff(u(x),x,2)),0)
pdsolve(w, u(x,t),hint="all")

Unfortunataly I've got some error-messages which I can't handle.
Is there any help?
Thanks a lot.


The error messages were:


ValueError                                Traceback (most recent call last)
<ipython-input-12-e0eef578ab5a> in <module>()
----> 1 pdsolve(w, u(x,t),hint="all")

C:\WinPython\WinPython-32bit-3.5.2.1\python-3.5.2\lib\site-packages\sympy\solvers\pde.py in pdsolve(eq, func, hint, dict, solvefun, **kwargs)
    171     # See the docstring of _desolve for more details.
    172     hints = _desolve(eq, func=func,
--> 173         hint=hint, simplify=True, type='pde', **kwargs)
    174     eq = hints.pop('eq', False)
    175     all_ = hints.pop('all', False)

C:\WinPython\WinPython-32bit-3.5.2.1\python-3.5.2\lib\site-packages\sympy\solvers\deutils.py in _desolve(eq, func, hint, ics, simplify, **kwargs)
    224     if hints['order'] == 0:
    225         raise ValueError(
--> 226             str(eq) + " is not a differential equation in " + str(func))
    227 
    228     if not hints['default']:

ValueError: -c**2*Derivative(u(x), x, x) + Derivative(u(t), t, t) is not a differential equation in u(x, t)


c2d2dx2u(x)+d2dt2u(t)=0




M





Aaron Meurer

unread,
May 3, 2017, 6:58:05 PM5/3/17
to sy...@googlegroups.com
You need to use u(x, t) everywhere. SymPy considers u(x) and u(x, t) to be completely different functions. 

Unfortunately, pdsolve is currently not very powerful, and it is unable to solve your PDE.

Aaron Meurer

--
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 sympy+unsubscribe@googlegroups.com.
To post to this group, send email to sy...@googlegroups.com.
Visit this group at https://groups.google.com/group/sympy.
To view this discussion on the web visit https://groups.google.com/d/msgid/sympy/59512994-6ded-4253-9951-2c32d62a8905%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

rolfd...@gmail.com

unread,
May 4, 2017, 12:21:16 PM5/4/17
to sympy
Pity, it is a very important PDE, it is the one-dimensional wave equation. Nevertheless many thanks.
To unsubscribe from this group and stop receiving emails from it, send an email to sympy+un...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages