3.3. ()
,
,
Simbolic
MatLab , . MatLab . Symbolic Math Toolbox MatLab , , , . MatLab, , . Maple 3000 . MatLab Symbolic, , Maple . . , , Maple, .
help symbolic . help sym / name.m, name , name.m m-, . Symbolic Math Toolbox , 3.3.1.
3.3.1.
, , , , | |
Symbolic Symbolic Toolbox.
,
MatLab , , . ., , , . , . ,
>> sin(x)^2 + s()^2 ??? Undefined function or variable 'x'. >> sin('x')^2 + cos('x')^2 ans = >> |
|
|
, MatLa , . , - , . - '' 1.
Mple MatLab , . () , sym():
_ = sym( ' _ ' )
,
>> = sym ('x') x= x >>a=sym ('alfa') a alfa >> |
MatLab .
>>sqrt(2) ans= 1.4142 >>a=sqrt(sym(2)) a= 2^(1/2) >>double(a) ans= 1.4142 >> |
Symbolic , MatLab. :
>>1/2+3/4 ans= 1.2500 >>sym(1/2+3/4) ans= 5/4 >>pi/2 ans= 1.5708 sym(pi/2) ans= pi/2 >>sin(pi/3) ans= 0.8660 >>sym(sin(pi/3)) ans= sqrt(3/4) >>exp(1) ans= 2.7183 >>sym(exp(1)) ans= 6121026514868074*2^(-51) >> |
, MatLab
(double), Symbolic , .
,
, . , .
syms:
Syms argl arg2...
,
>>a=sym('a '); >>b=sym('b'); >>c=sym('c'); >>x=sym('x '); >> |
>>syms a b c x >> |
syms.
>>syms x y1 y2 >>y1=sin(x)^2; >>y2=cos(x)^2; >>y1+y2 ans= sin(x)^2+cos(x)^2 >> |
. 'real', 'unreal', 'imag'. ,
>>x=sym('x', real); >>y=sym('y', real); >>z=x+i*y z= x+i*y >>real(z) ans= x >>imag(z) ans= y |
real(z) imag(z) z.
, , ,
|
|
>>sym 'x', 'unreal' % >>syms x unreal |
.
,
sym('_ ')
, , , . . . ,
>> sym x a b >> f=(sin(x)+a)^2*(cos(x)+b^2/sqrt(abs(a+b)) f=(sin(x)+a)^2*(cos(x)+b^2/sqrt(abs(a+b)) >> |
, . findsym(S) S. S. . :
>>sym x, z, y >> =2; b = 4; >> findsym (a*x^2 + b*y + z) ans = , , z >>findsym(a + b + x + y + z,) ans = , , z >> |
, . ,
>>syms a b c d >>M=[a b; c d] M= [ a, b] [ c, d] >> inv(M) ans= [ d/(a*d-b*c), -b/(a*d-b*c)] -c/(a*d-b*c), a/(a*d-b*c)] >> |
MatLab MathCad, Maple Mathematica, , , . . pretty(S). S , , ,
>> syms x a b >> f=(sin(x)+a)^2*(cos(x)+b)^2/sqrt(abs(a+b)) f=(sin(x)+a)^2*(cos(x)+b)^2/sqrt(abs(a+b)) >> pretty(f) 2 2 (sin(x) + a) (cos(x) + b) ------------------------------- 1/2 | a + b | >> |
. sym(). . , , .
vpa():