此为 Mathematica 4 文档,内容基于更早版本的 Wolfram 语言
查看最新文档(版本11.2)

Solve

Usage

Solve[eqns, vars] 求解变量 vars 的方程或方程组.
Solve[eqns, vars, elims] 求解变量 vars的方程, 并消去变量elims.


Notes

• 方程以lhs Equal rhs 的形式给出.
• 联立方程可放在一个列表中或使用&&联合起来.
• 可以指定单变量或一个变量列表. • Solve[eqns] 试图求解出eqns中所有变量.
• 例如: Solve[3 x + 9 Equal 0, x].
Solve 按形如 x -> sol 的规则给出解.
• 如存在多个变量, 则解按规则列表:  x ->  , y ->  , ...  给出.
• 如存在多个解, Solve 给出由它们构成的列表.
• 如一个特定根的重数大于1, Solve 将给出对应解的多个副本.
Solve 主要处理线性和多项式方程.
• 可选项 InverseFunctions 指定 Solve 是否应使用逆函数以求解更多一般方程的解. 缺省设置为 InverseFunctions->Automatic. 这时, Solve 可使用逆函数, 但会输出一个警告信息. 参见 InverseFunctions的注释.
Solve 只给出一般的解. 它不处理只有参数满足特殊条件才有效的解. Reduce 给出完整的解集.
Solve 并不总能得到方程的显式解. 它将给出它能给出的显式解, 然后按Root对象给出剩余根的符号表示. 如果符号参数个数足够少, 你可以使用 N 获得这些解的数值近似.
• 如果方程无解,Solve 返回 {} .
Solve[eqns, ... , Mode->Modular] 用于求解同余方程. 你可以通过引用方程 ModulusEqualp来指定要使用的特殊模数. 如果你不使用这样的方程,Solve将按可能的模数求解.
Solve 使用特殊有效的技术处理近似数值系数的线性方程稀疏系统.
• 参见Mathematica 全书: 1.5.7节 和 3.4.4节.
• 实现注释: 参见A.9.5节.
Further Examples

Polynomial equations in one variable

These are standard formulas for the solutions of normalized quadratic and cubic equations.

In[1]:=  

Out[1]=

In[2]:=  

Out[2]=

Here are two simple equations of higher degree with solutions in terms of powers. They can be rewritten in terms of trigonometric functions that sometimes automatically reduce to radicals.

In[3]:=  

Out[3]=

In[4]:=  

Out[4]=

In[5]:=  

Out[5]=

In[6]:=  

Out[6]=

For some equations, Mathematica produces the result in terms of Root objects (or algebraic numbers). The first argument of Root is an irreducible polynomial expressed as a pure function and the second argument identifies the choice of root.

In[7]:=  

Out[7]=

We can get a numerical result by applying N.

In[8]:=  

Out[8]=

This pulls all of the rules for x out of the result.

In[9]:=  

Out[9]=

Polynomial equations in more than one variable

Here we solve for x and y.

In[10]:=  

In[11]:=  

Out[11]=

In this case we eliminate y first and then solve for x.

In[12]:=  

Out[12]=

In[13]:=  

Here we solve two simultaneous algebraic equations. The spurious potential solution  is rejected.

In[14]:=  

Out[14]=

Here are three simultaneous algebraic equations; y and z must be paired up correctly with x.

In[15]:=  

Out[15]=

Here Solve returns an empty list, indicating no solution. Every potential solution forces an equation in the parameter z alone, so there are no generic solutions.

In[16]:=  

Out[16]=

We can get solutions by solving for z as well as x and y.

In[17]:=  

Out[17]=

We eliminate e, s, and t to get d in terms of the remaining variables.

In[18]:=  

Out[18]=

Verification is not done by default for polynomial systems. The purported solutions to this system are nowhere near correct.

In[19]:=  

Out[19]=

When there is numeric instability, setting VerifySolutions to True will take longer but will make the result more reliable.

In[20]:=  

Out[20]=

In[21]:=  

Radical equations

In radical equations, Solve discards parasite solutions.

In[22]:=  

Out[22]=

In[23]:=  

Out[23]=

In[24]:=  

Out[24]=

To see all candidate solutions, including parasites, set VerifySolutions to False.

In[25]:=  

Out[25]=

If you can be sure that zero denominators will not affect the solution set, clearing them often makes Solve faster.

In[26]:=  

Out[26]=

In[27]:=  

Out[27]=

In[28]:=  

Suppressing messages

The equations that follow in the rest of this notebook come from various papers and from questions submitted by users. Solve generates warning messages for many non-polynomial equations.

In[29]:=  

Out[29]=

To improve readability, we will now suppress warning messages about inverse functions. These messages will be turned back on at the end of this set of examples.

In[30]:=  

Equations involving trigonometric or hyperbolic functions, or their inverses

In[31]:=  

Out[31]=

In[32]:=  

Out[32]=

In[33]:=  

Out[33]=

In[34]:=  

Out[34]=

Equations involving exponentials and logarithms

In[35]:=  

Out[35]=

In[36]:=  

Out[36]=

In[37]:=  

Out[37]=

In[38]:=  

Out[38]=

In[39]:=  

Out[39]=

In[40]:=  

Out[40]=

In[41]:=  

Out[41]=

In[42]:=  

Out[42]=

In[43]:=  

Out[43]=

In[44]:=  

Out[44]=

In[45]:=  

Out[45]=

In[46]:=  

Out[46]=

Equations or solutions that involve ProductLog

In[47]:=  

Out[47]=

In[48]:=  

Out[48]=

In[49]:=  

Out[49]=

In[50]:=  

Out[50]=

This last example comes from a typo in a quadratic.

In[51]:=  

Out[51]=

We will now turn the inverse function warning messages back on that were turned off earlier in this set of examples.

In[52]:=