Roots of the equation

Use sym establish variable or syms

>> syms x
>> (x+x)/3
 
ans =
 
(2*x)/3
 
>> y=sym('y')
 
y =
 
y

 

solve()

1. A linear equation

Solutions of y = x * sin (x) -x; y is the equation x is the symbol

>> solve(cos(x).^2-sin(x).^2,x)
 
ans =
 
pi/4

2. linear equations

Syms XY >> 
>> EQ1 = X-Y-2 *. 5; 
>> = X + Y-EQ2. 6; 
>> A = Solve (EQ1, EQ2, X, Y) 

A = 

  struct contains the following fields: 

    X: [sym. 1. 1 ×] 
    Y: [sym. 1. 1 ×] 

>> AX 
 
ANS = 
 
17/3 
 
>> AY 
 
ANS = 
 
1/3

 Solutions ax ^ 2-b = 0

>> syms x a b
solve(a*x^2-b)
 
ans =
 
  b^(1/2)/a^(1/2)
 -b^(1/2)/a^(1/2)

 

Syms xab >> 
>> Solve (A * X ^ 2-b, b)% by b to solve for the unknowns 
 
ANS = 
 
A * X ^ 2

Derivation

>> syms x
>> y=4*x^5
 
y =
 
4*x^5
 
>> yprime=diff(y)
 
yprime =
 
20*x^4

 integral

For x ^ 2 * exp (x) integral, z (0) = 0

subs is the assignment function , the replacement function with variable values alternate symbol

>> syms x
>> y=x^2*exp(x);
>> z=int(y);
>> z=z-subs(z,x,0)%exp(x)*(x^2 - 2*x + 2) 用0替代x z(0)=2 z=z-2;
 
z =
 
exp(x)*(x^2 - 2*x + 2) - 2

 To be continued

 

Guess you like

Origin www.cnblogs.com/zuiaimiusi/p/11318798.html