解方程式

常係數多項式方程式

eqn=x^2-3x + 2==0

Solve[eqn,x]

x^2 /.%2

eqn=9 x -3 == 4x+2

Solve[eqn,x]

Solve[x^3-2x^2-5x+6==0,x]

Solve[x^2+3x== x+7,x]

N[%]

Solve[x^3-2x^2+3x-2== 0,x]

多項式方程式符號運算

eqn=(a-x) ((a-x)^3-2b^2 (a-x))-b (b (a-x)^2-b^3)==0

Solve[eqn,x]

N[%]

Expand[%]

一般方程式

eqn=x+3 Exp[-x]==3

Solve[eqn,x]

FindRoot[eqn,{x,3}]

eqn /. %

FindRoot[5 Sin[x] -x==0,{x,2}]

求極值

Minimize[x^2-2x-1,x]

Maximize[-x^2+5x-3,x]

Maximize[{(E^(-x)) (x^2),x>0},x]

N[%]

Plot[(E^(-x)) (x^2),{x,0,8}]

聯立方程組

Solve[{-3x+8y==5,8x-12y==-11},{x,y}]

A={{-3,8},{8,-12}}

A.{x,y}=={5,-11}

Solve[%,{x,y}]

A={{1,-1,1},{-1,1,-1},{0,10,25},{20,10,0}}

MatrixForm[A]

A.{x1,x2,x3}=={0,0,90,80}

Solve[%,{x1,x2,x3}]

LinearSolve[A,{0,0,90,80}]

A={{2,1,-3},{5,0,2},{8,-1,7}}

A.{x,y,z}=={8,3,0}

LinearSolve[A,{8,3,0}]

LinearSolve[A,{1,5,9}]