You are on page 1of 9

2010


1.
ime_objekta = sym('niz_znakova')
>> bb = sym('bb')
bb=
bb
>> g = sym('gama')
g=
gama

>> c = sym(5)
c=
5
>> e = 13
e=
13

syms ime_promenljive1 ime_promenljive2 ime_promenljive3 ...


>> syms y z d
>> y
y = y

2.
ime_izraza = matematiki_izraz
>> syms a b c x y
>> f = a*x^2+b*x+c
f=
a*x^2+b*x+c
>> g=2*a/3+4*a/7-6.5*x+x/3+4*5/3-1.5
g =
26/21*a-37/6*x+31/6

2010

3. findsym
findsym(S) findsym(S,n)

>> syms x h w y d t
>> S=h*x^2+d*y^2+t*w^2
S =
h*x^2+d*y^2+t*w^2
>> findsym(S)
ans =
d, h, t, w, x, y
>> findsym(S,5)
ans =
x,y,w,t,h
>> findsym(S,1)
ans =
x

4.
collect(S) collect(S, ime_promenljive)
>> syms x y
>> s=(x^2+x-exp(x))*(x+3)
s =
(x^2+x-exp(x))*(x+3)
>> f=collect(s)
f =
x^3+4*x^2+(-exp(x)+3)*x-3*exp(x)

>> t=(2*x^2+y^2)*(x+y^2+3)
t =

2010

(2*x^2+y^2)*(x+y^2+3)
>> h=collect(t,y)
h =
y^4+(2*x^2+x+3)*y^2+2*x^2*(x+3)

expand(S)
>> syms a x y
>> s=(x+5)*(x-a)*(x+4)
s =
(x+5)*(x-a)*(x+4)
>> t=expand(s)
t =
x^3+9*x^2-a*x^2-9*x*a+20*x-20*a

>> expand(sin(x-y))
ans =
sin(x)*cos(y)-cos(x)*sin(y)

factor(S)
>> syms x
>> s=x^3+4*x^2-11*x-30
s =
x^3+4*x^2-11*x-30
>> factor(s)
ans =
(x-3)*(x+5)*(x+2)

simplify(S)
>> syms x y
>> s=x*(x*(x-8)+10)-5

2010

s =
x*(x*(x-8)+10)-5
>> SA=simplify(s)
SA =
x^3-8*x^2+10*x-5

>> simplify((x+y)/(1/x+1/y))
ans =
x*y

F = simple(S)

simple(S)

[F how] = simple(S)

>> syms x
>> s=(x^3-4*x^2+16*x)/(x^3+64)
s =
(x^3-4*x^2+16*x)/(x^3+64)
>> f=simple (s)
f =
x/(x+4)
>> [g metoda]=simple(s)
g =
x/(x+4)
metoda =
factor

pretty(S)
>> syms a b c x
>> s=sqrt(a*x^2+b*x+c)
s =
(a*x^2+b*x+c)^(1/2)
>> pretty(s)

2010

V
1/2
2

(a x

+ b x + c)

5.


h = solve(jednacina) h = solve(jednacina,promenljiva)
>> syms a b x y z
>> h=solve(exp(2*z)-5)
h =
1/2*log(5)

>> s=x^2-x-6
s =
x^2-x-6
>> k=solve(s)
k =
[ -2]
[

3]

>> solve('cos(2*y)+3*sin(y)=2')
ans =
[ 1/2*pi]
[ 1/6*pi]
[ 5/6*pi]

>> t=a*x^2+5*b*x+20
t =
a*x^2+5*b*x+20
>> solve(t)
ans =
[ 1/2/a*(-5*b+(25*b^2-80*a)^(1/2))]
[ 1/2/a*(-5*b-(25*b^2-80*a)^(1/2))]

2010

>> M=solve(t,a)
M =
-5*(b*x+4)/x^2

>> syms x y t
>> s=10*x+12*y+16*t;
>> [xt yt]=solve(s,'5*x-y=13*t')
xt =
2*t
yt =
-3*t

>> s=10*x+12*y+16*t;
>> B=solve(s,'5*x-y=13*t')
B =
x: [1x1 sym]
y: [1x1 sym]
>> B.x
ans =
2*t
>> B.y
ans =
-3*t

6.
diff.
diff(S) diff(S,promenljiva) diff(S,promenljiva,n)

S , promenljiva , n

2010

>> syms x y t
>> s=exp(x^4);
>> diff(s)
ans =
4*x^3*exp(x^4)

>> r=5*y^2*cos(3*t);
>> diff(r,t,3)
ans =
-15*y^2*sin(3*t)

>> diff(s,2)
ans =
12*x^2*exp(x^4)+16*x^6*exp(x^4)

7.

int.
int(S) int(S,promenlljiva)
int(S,dg,gg) int(S,promenlljiva,dg,gg)

S , promenljiva , dg gg

>> syms x y t
>> s=2*cos(x)-6*x;
>> int(s)
ans =
2*sin(x)-3*x^2

>> int(x*sin(x))
ans =
sin(x)-x*cos(x)

>> r=5*y^2*cos(4*t);
>> int(r,y)

2010

ans =
5/3*y^3*cos(4*t)

>> syms y
>> int(sin(y)-5*y^2,0,pi)
ans =
2-5/3*pi^3

8.


dsolve('jednacina') dsolve('jednacina','promenljiva')
>> dsolve('Dy=4*t+2*y')
ans =
-2*t-1+exp(2*t)*C1

>>dsolve('D2x + 2*Dx+x=0')
ans=
C1*exp(-t)+C2*exp(-t)*t

>>dsolve('Ds=a*x^2')
ans=
a*x^2*t+C1

>> dsolve('Ds=a*x^2','x')
ans =
1/3*a*x^3+C1

>> dsolve('Ds=a*x^2','a')
ans =
1/2*a^2*x^2+C1

2010


dsolve(jednacina,uslov, promenljiva)


dsolve(jednacina,uslov1, uslov2, ... {promenljiva})
>> dsolve('Dy+4*y=60','y(0)=5')
ans =
15-10*exp(-4*t)

>> dsolve('D2y-2*Dy+2*y=0','y(0)=1','Dy(0)=0')
ans =
-exp(t)*sin(t)+exp(t)*cos(t)
>> factor(ans)
ans =
exp(t)*(-sin(t)+cos(t))

You might also like