此为 Mathematica 7 文档,内容基于更早版本的 Wolfram 语言
查看最新文档(版本11.1)
Mathematica HowTo
How to | Solve a Partial Differential Equation
Mathematica's differential equation solving functions can be applied to many different classes of differential equations, automatically selecting the appropriate algorithms without needing pre-processing by the user. One such class are PDE's.
This sets up the c=2 transport equation, , using D to take derivatives, and stores it as the variable pde:
In[1]:=
Click for copyable input
Out[1]=
Use DSolve to solve the equation and store the solution in soln. The first argument to DSolve is an equation, the second argument is the function to solve for, and the third argument is a list of the independent variables.
In[2]:=
Click for copyable input
Out[2]=
The answer is given as a rule and C[1] is an arbitrary function.
To use soln as a function, say f[x, t], use /. and [[...]] (the short forms of ReplaceAll and Part, respectively):
In[3]:=
Click for copyable input
Out[3]=
You can evaluate f[x, t] like any other function:
In[4]:=
Click for copyable input
Out[4]=
You can add an initial condition like y(0,t)=sin(t) by making the first argument to DSolve a list:
In[5]:=
Click for copyable input
Out[5]=