Ispit iz Primjene Softwarea Mathematica 07 Februar 2008.

Zadatak 1.

In[1]:=

A = (3.35   0.45   0.56   0.57)        0.60   3.56   0.53   0.43       0.65   0.49   3.92   0.76       0.75   0.34   0.38   3.37

Out[1]=

RowBox[{{, RowBox[{RowBox[{{, RowBox[{3.35, ,, 0.45, ,, 0.56, ,, 0.57}], }}], ,, RowBox[{{, Ro ... 0.49, ,, 3.92, ,, 0.76}], }}], ,, RowBox[{{, RowBox[{0.75, ,, 0.34, ,, 0.38, ,, 3.37}], }}]}], }}]

In[2]:=

B = Inverse[A]

Out[2]=

RowBox[{{, RowBox[{RowBox[{{, RowBox[{0.320766, ,, RowBox[{-, 0.03139}], ,, RowBox[{-, 0.03752 ... ox[{-, 0.0632043}], ,, RowBox[{-, 0.019426}], ,, RowBox[{-, 0.0187971}], ,, 0.314144}], }}]}], }}]

In[3]:=

a = (1.32)       2.41       1.26       0.49

Out[3]=

RowBox[{{, RowBox[{RowBox[{{, 1.32, }}], ,, RowBox[{{, 2.41, }}], ,, RowBox[{{, 1.26, }}], ,, RowBox[{{, 0.49, }}]}], }}]

In[4]:=

rjesenje = B . a

Out[4]=

RowBox[{{, RowBox[{RowBox[{{, 0.28, }}], ,, RowBox[{{, 0.6, }}], ,, RowBox[{{, 0.2, }}], ,, RowBox[{{, RowBox[{-, 1.80249*10^-18}], }}]}], }}]

In[5]:=

MatrixForm[rjesenje]

Out[5]//MatrixForm=

( 0.27999999999999997`     )            0.5999999999999999`            0.2`            -1.802486111757151`*^-18

In[6]:=

RowBox[{Solve, [, RowBox[{RowBox[{{, RowBox[{RowBox[{RowBox[{RowBox[{3.35, x1}], +, RowBox[{0. ... , +, RowBox[{0.38, x3}], +, RowBox[{3.37,  , x4}]}], ==, 0.49}]}], }}], ,, {x1, x2, x3, x4}}], ]}]

Out[6]=

RowBox[{{, RowBox[{{, RowBox[{RowBox[{x1, , 0.28}], ,, RowBox[{x2, , 0.6}], ,, RowBox[{x3, , 0.2}], ,, RowBox[{x4, , RowBox[{-, 3.35912*10^-18}]}]}], }}], }}]

SvojstveneVrijednosti[C_] := Module[{temp, ret, Lambda}, temp = C ; For[i = 1, ...  Lambda] ; ret = Solve[Det[temp] 0, Lambda] ; Lambda/.ret]

In[15]:=

SvojstveneVrijednosti[A]

Out[15]=

RowBox[{{, RowBox[{2.72022, ,, RowBox[{RowBox[{3.14275, }], -, RowBox[{0.0319529,  , & ... , ,, RowBox[{RowBox[{3.14275, }], +, RowBox[{0.0319529,  , }]}], ,, 5.19427}], }}]

In[9]:=

Eigenvalues[A]

Out[9]=

RowBox[{{, RowBox[{5.19427, ,, RowBox[{RowBox[{3.14275, }], +, RowBox[{0.0319529,  , & ... , ,, RowBox[{RowBox[{3.14275, }], -, RowBox[{0.0319529,  , }]}], ,, 2.72022}], }}]

Zadatak 2.

In[16]:=

MojRotateLeft[lista_, n_] := Module[{temp, n1}, temp = {} ; n1 = Mod[n, Length ... i = 1, i≤n1, i ++, temp = Append[temp, lista[[i]]] ] ; temp]

In[17]:=

MojRotateLeft[{1, 2, 3, 4, 5}, 8]

Out[17]=

{4, 5, 1, 2, 3}

In[18]:=

MojInsert[lista_, elem_, n_] := Module[{lista1, i, p}, p = Length[lista] ; lis ... 1[[j + 1]] = lista[[j]], {j, n, p} ] ] ; Return[lista1] ] 

In[19]:=

MojInsert[{1, 2, 3, 4}, Pi, 4]

Out[19]=

{1, 2, 3, π, 4}

Zadatak 3.

In[20]:=

Clear[f, x, x0, izvod] ; Tangenta[f_, x_, x0_] := Module[{izvod, funkc}, izvod := D[f, ... 2371;funkc := f/.xx0 ; Return[izvod * (x - x0) + funkc] ]

In[22]:=

RowBox[{RowBox[{Clear[x, x0, k, f, izvod, temp1, temp2] ;, , lista = {} ;, , R ... otStyle {RGBColor[1, 0, 0], RGBColor[0, 0, 1]} ] ]}], , ]}]}],  }]

[Graphics:HTMLFiles/rjesenjaIspitPrimjena2_26.gif]

[Graphics:HTMLFiles/rjesenjaIspitPrimjena2_27.gif]

[Graphics:HTMLFiles/rjesenjaIspitPrimjena2_28.gif]

[Graphics:HTMLFiles/rjesenjaIspitPrimjena2_29.gif]

[Graphics:HTMLFiles/rjesenjaIspitPrimjena2_30.gif]

[Graphics:HTMLFiles/rjesenjaIspitPrimjena2_31.gif]

[Graphics:HTMLFiles/rjesenjaIspitPrimjena2_32.gif]

[Graphics:HTMLFiles/rjesenjaIspitPrimjena2_33.gif]

[Graphics:HTMLFiles/rjesenjaIspitPrimjena2_34.gif]

[Graphics:HTMLFiles/rjesenjaIspitPrimjena2_35.gif]

[Graphics:HTMLFiles/rjesenjaIspitPrimjena2_36.gif]

[Graphics:HTMLFiles/rjesenjaIspitPrimjena2_37.gif]

[Graphics:HTMLFiles/rjesenjaIspitPrimjena2_38.gif]

[Graphics:HTMLFiles/rjesenjaIspitPrimjena2_39.gif]

[Graphics:HTMLFiles/rjesenjaIspitPrimjena2_40.gif]

[Graphics:HTMLFiles/rjesenjaIspitPrimjena2_41.gif]

[Graphics:HTMLFiles/rjesenjaIspitPrimjena2_42.gif]

[Graphics:HTMLFiles/rjesenjaIspitPrimjena2_43.gif]

[Graphics:HTMLFiles/rjesenjaIspitPrimjena2_44.gif]

[Graphics:HTMLFiles/rjesenjaIspitPrimjena2_45.gif]

In[25]:=

Show[lista]

[Graphics:HTMLFiles/rjesenjaIspitPrimjena2_47.gif]

Out[25]=

⁃Graphics⁃

Ispit iz Primjene Softwarea Mathematica 24 januar 2008.

Zadatak 1.

In[26]:=

A = (4      -2     1      3.14)       2      3.1    4/3    7       1      3      -11    0       6      0      2      -1

Out[26]=

RowBox[{{, RowBox[{RowBox[{{, RowBox[{4, ,, -2, ,, 1, ,, 3.14}], }}], ,, RowBox[{{, RowBox[{2, ,, 3.1, ,, 4/3, ,, 7}], }}], ,, {1, 3, -11, 0}, ,, {6, 0, 2, -1}}], }}]

In[27]:=

B = Inverse[A]

Out[27]=

RowBox[{{, RowBox[{RowBox[{{, RowBox[{0.0423864, ,, 0.0000846669, ,, 0.0281701, ,, 0.133686}], ...  RowBox[{{, RowBox[{0.117899, ,, 0.0751419, ,, 0.000952503, ,, RowBox[{-, 0.103805}]}], }}]}], }}]

In[28]:=

a = (2)       1       3       6

Out[28]=

{{2}, {1}, {3}, {6}}

In[29]:=

rjesenje = B . a

Out[29]=

RowBox[{{, RowBox[{RowBox[{{, 0.971483, }}], ,, RowBox[{{, 0.423299, }}], ,, RowBox[{{, RowBox[{-, 0.0689654}], }}], ,, RowBox[{{, RowBox[{-, 0.309034}], }}]}], }}]

In[30]:=

MatrixForm[rjesenje]

Out[30]//MatrixForm=

( 0.9714827784006282`   )            0.42329920081506`            -0.06896541992310834`            -0.3090341694424473`

In[31]:=

RowBox[{Solve, [, RowBox[{RowBox[{{, RowBox[{RowBox[{RowBox[{4x1, -, 2x2, +, x3, +, RowBox[{3. ...  11x33, ,, , 6x1 + 2x3 - 1x46}], }}], ,, {x1, x2, x3, x4}}], , ]}]

Out[31]=

RowBox[{{, RowBox[{{, RowBox[{RowBox[{x1, , 0.971483}], ,, RowBox[{x2, , 0.423 ... , , RowBox[{-, 0.0689654}]}], ,, RowBox[{x4, , RowBox[{-, 0.309034}]}]}], }}], }}]

In[34]:=

SvojstveneVrijednosti[C_] := Module[{temp, ret, Lambda}, temp = C ; For[i = 1, ...  Lambda] ; ret = Solve[Det[temp] 0, Lambda] ; Lambda/.ret]

In[35]:=

SvojstveneVrijednosti[A]

Out[35]=

RowBox[{{, RowBox[{RowBox[{-, 11.0283}], ,, RowBox[{-, 4.68372}], ,, RowBox[{RowBox[{5.40601,  ...   , }]}], ,, RowBox[{RowBox[{5.40601, }], +, RowBox[{2.713,  , }]}]}], }}]

In[36]:=

Eigenvalues[A]

Out[36]=

RowBox[{{, RowBox[{RowBox[{-, 11.0283}], ,, RowBox[{RowBox[{5.40601, }], +, RowBox[{2. ... ox[{RowBox[{5.40601, }], -, RowBox[{2.713,  , }]}], ,, RowBox[{-, 4.68372}]}], }}]




Zadatak 2.

In[37]:=

MojJoin[lista1_, lista2_] := Module[{temp}, temp = {} ; For[i = 1, i<=Lengt ... ;=Length[lista2], i ++, temp = Append[temp, lista2[[i]]] ] ; temp]

MojJoin[{6, 7, 8, 9, 10}, {1, 2, 3, 4, 5}]

{6, 7, 8, 9, 10, 1, 2, 3, 4, 5}

In[38]:=

MojInsert[lista_, elem_, n_] := Module[{lista1, i, p}, p = Length[lista] ; lis ... 371;lista1[[j + 1]] = lista[[j]], {j, n, p} ] ] ; Return[lista1] ]

MojInsert[{1, 2, 3, 4}, Pi, 4]

{1, 2, 3, π, 4}



Zadatak 3.

In[39]:=

Clear[f, x, x0, izvod] ; Tangenta[f_, x_, x0_] := Module[{izvod, funkc}, izvod := D[f, ... 2371;funkc := f/.xx0 ; Return[izvod * (x - x0) + funkc] ]

Tangenta[x^3, x, 1]

1 + 3 (-1 + x)

In[41]:=

Clear[x, x0, k, f, izvod, temp1, temp2] ; lista = {} ; For[x0 = -2, x0<3, x ... }, PlotStyle {RGBColor[1, 0, 0], RGBColor[0, 0, 1]} ] ] ]

[Graphics:HTMLFiles/rjesenjaIspitPrimjena2_76.gif]

[Graphics:HTMLFiles/rjesenjaIspitPrimjena2_77.gif]

[Graphics:HTMLFiles/rjesenjaIspitPrimjena2_78.gif]

[Graphics:HTMLFiles/rjesenjaIspitPrimjena2_79.gif]

[Graphics:HTMLFiles/rjesenjaIspitPrimjena2_80.gif]

[Graphics:HTMLFiles/rjesenjaIspitPrimjena2_81.gif]

[Graphics:HTMLFiles/rjesenjaIspitPrimjena2_82.gif]

[Graphics:HTMLFiles/rjesenjaIspitPrimjena2_83.gif]

[Graphics:HTMLFiles/rjesenjaIspitPrimjena2_84.gif]

[Graphics:HTMLFiles/rjesenjaIspitPrimjena2_85.gif]

[Graphics:HTMLFiles/rjesenjaIspitPrimjena2_86.gif]

[Graphics:HTMLFiles/rjesenjaIspitPrimjena2_87.gif]

[Graphics:HTMLFiles/rjesenjaIspitPrimjena2_88.gif]

[Graphics:HTMLFiles/rjesenjaIspitPrimjena2_89.gif]

[Graphics:HTMLFiles/rjesenjaIspitPrimjena2_90.gif]

[Graphics:HTMLFiles/rjesenjaIspitPrimjena2_91.gif]

[Graphics:HTMLFiles/rjesenjaIspitPrimjena2_92.gif]

[Graphics:HTMLFiles/rjesenjaIspitPrimjena2_93.gif]

[Graphics:HTMLFiles/rjesenjaIspitPrimjena2_94.gif]

[Graphics:HTMLFiles/rjesenjaIspitPrimjena2_95.gif]

In[44]:=

Show[lista]

[Graphics:HTMLFiles/rjesenjaIspitPrimjena2_97.gif]

Out[44]=

⁃Graphics⁃


Created by Mathematica  (February 6, 2008)