Matematički programi za inženjere
Ishodi učenja predmeta:
nakon uspješno svladanoga predmeta moći ćete
Vaše obveze za ostvarivanje prava na potpis:
Ocjenjivanje:
ako na kolokvijima ostvarite
Sadržaj predmeta:
Literatura:
Dopunska literatura:
Uvođenje u SageMath
SageMath (Sage) — otvoreni programski sustav za simboličku matematiku (Computer Algebra System, CAS)
(Drugi simbolički programski sustavi: Macsyma, Reduce, Mathematica, Maxima, MATLAB, SymPy, ...)
Osnovne mogućnosti:
Numeričko računanje (number crunching — drobljenje brojeva):
53575430359313366047421252453000090528070240585276680372187519418517552556246806\ 12465991894078479290637973364587765734125935726428461570217992288787349287401967\ 28388741211549271053730253118557093897709107652323749179097063369938377958277197\ 3038531457285598238843271083830214915826312193418602834034689 5357543035931336604742125245300009052807024058527668037218751941851755255624680612465991894078479290637973364587765734125935726428461570217992288787349287401967283887412115492710537302531185570938977091076523237491790970633699383779582771973038531457285598238843271083830214915826312193418602834034689 |
nelinearne jednadžbe:
npr. kvadratna jednadžba x2+x2−1=0
![]() |
0.7807764064044151 0.7807764064044151 |
-1.2807764064044151 -1.2807764064044151 |
matrice, vektori, sustavi linearnih jednadžbi:
|
[4.00000000000000 1.00000000000000 1.00000000000000 1.00000000000000] [1.00000000000000 4.00000000000000 1.00000000000000 1.00000000000000] [1.00000000000000 1.00000000000000 4.00000000000000 1.00000000000000] [1.00000000000000 1.00000000000000 1.00000000000000 4.00000000000000] [4.00000000000000 1.00000000000000 1.00000000000000 1.00000000000000] [1.00000000000000 4.00000000000000 1.00000000000000 1.00000000000000] [1.00000000000000 1.00000000000000 4.00000000000000 1.00000000000000] [1.00000000000000 1.00000000000000 1.00000000000000 4.00000000000000] |
(4.000000000000001.000000000000001.000000000000001.000000000000001.000000000000004.000000000000001.000000000000001.000000000000001.000000000000001.000000000000004.000000000000001.000000000000001.000000000000001.000000000000001.000000000000004.00000000000000)
|
(-3.00000000000000, 3.00000000000000, 3.00000000000000, -3.00000000000000) (-3.00000000000000, 3.00000000000000, 3.00000000000000, -3.00000000000000) |
4x0+x1+x2+x3=−3
x0+4x1+x2+x3=3
x0+x1+4x2+x3=3
x0+x1+x2+4x3=−3
(-1.00000000000000, 1.00000000000000, 1.00000000000000, -1.00000000000000) (-1.00000000000000, 1.00000000000000, 1.00000000000000, -1.00000000000000) |
(-1.00000000000000, 1.00000000000000, 1.00000000000000, -1.00000000000000) (-1.00000000000000, 1.00000000000000, 1.00000000000000, -1.00000000000000) |
(-3.00000000000000, 3.00000000000000, 3.00000000000000, -3.00000000000000) (-3.00000000000000, 3.00000000000000, 3.00000000000000, -3.00000000000000) |
(0.000000000000000, 0.000000000000000, 0.000000000000000, 0.000000000000000) (0.000000000000000, 0.000000000000000, 0.000000000000000, 0.000000000000000) |
189.000000000000 189.000000000000 |
x x |
numerička integracija:
![]() |
(4.3999999999999995, 4.884981308350688e-14) (4.3999999999999995, 4.884981308350688e-14) |
(4.399999999999951, 4.400000000000048) (4.399999999999951, 4.400000000000048) |
Simboličko baratanje matematičkim izrazima:
(y, z, a, b, c) (y, z, a, b, c) |
„pojednostavnjenje” izraza:
(x−y+z)2
|
x^2 - 2*x*y + y^2 + 2*x*z - 2*y*z + z^2 x^2 - 2*x*y + y^2 + 2*x*z - 2*y*z + z^2 |
x2−2xy+y2+2xz−2yz+z2
|
(x - y + z)^2 (x - y + z)^2 |
(x−y+z)2
|
„točno” rješavanje jednadžbi:
[x == -1/4*sqrt(17) - 1/4, x == 1/4*sqrt(17) - 1/4] [x == -1/4*sqrt(17) - 1/4, x == 1/4*sqrt(17) - 1/4] |
[x=−14√17−14,x=14√17−14]
|
-1.28077640640442 0.780776406404415 -1.28077640640442 0.780776406404415 |
-1.2807764064044151374553524639935192562867998063434 0.78077640640441513745535246399351925628679980634341 -1.2807764064044151374553524639935192562867998063434 0.78077640640441513745535246399351925628679980634341 |
simboličko rješavanje jednadžbi:
[x == -1/2*(b + sqrt(b^2 - 4*a*c))/a, x == -1/2*(b - sqrt(b^2 - 4*a*c))/a] [x == -1/2*(b + sqrt(b^2 - 4*a*c))/a, x == -1/2*(b - sqrt(b^2 - 4*a*c))/a] |
[x=−b+√b2−4ac2a,x=−b−√b2−4ac2a]
|
definiranje funkcija:
|
x ↦ −x3−3x2+1
|
(0.584000000000000, -1.43200000000000) (0.584000000000000, -1.43200000000000) |
−a3−3a2+1
|
deriviranje:
-sin(x) -sin(x) |
x ↦ −3x2−6x
|
(1.92000000000000, -6.72000000000000) (1.92000000000000, -6.72000000000000) |
![]() |
integriranje:
cos(x) cos(x) |
-x^3 - 3*x^2 -x^3 - 3*x^2 |
−x3−3x2
|
−x3−3x2+1
|
-1/5*cos(x)^5 + cos(x)^3 - 3*cos(x) -1/5*cos(x)^5 + cos(x)^3 - 3*cos(x) |
−15cos(x)5+cos(x)3−3cos(x)
|
22/5 22/5 |
4.40000000000000 4.40000000000000 |
Grafički prikaz funkcija i podataka:
![]() ![]() |
Programiranje:
[0, 1, 4, 9, 16, 25, 36, 49, 64, 81] [0, 1, 4, 9, 16, 25, 36, 49, 64, 81] |
|
![]() |
|
Numeričko računanje
Aritmetičke operacije:
operacije imaju „klasični” prioritet:
-1 -1 |
funkcijski poziv ima viši prioritet:
1 1 |
promjena prioriteta:
-55 -55 |
8 8 |
4 4 |
[-11, -11, -11, -11, -11] [-11, -11, -11, -11, -11] |
[] [] |
Traceback (click to the left of this block for traceback) ... TypeError: can't multiply sequence by non-int of type 'list' Traceback (most recent call last): File "<stdin>", line 1, in <module> File "_sage_input_63.py", line 10, in <module> exec compile(u'open("___code___.py","w").write("# -*- coding: utf-8 -*-\\n" + _support_.preparse_worksheet_cell(base64.b64decode("WzIgKyAzXSAqIFs0IC0gMTVd"),globals())+"\\n"); execfile(os.path.abspath("___code___.py")) File "", line 1, in <module> File "/tmp/tmpmlyAJN/___code___.py", line 3, in <module> exec compile(u'[_sage_const_2 + _sage_const_3 ] * [_sage_const_4 - _sage_const_15 ] File "", line 1, in <module> TypeError: can't multiply sequence by non-int of type 'list' |
cijeli, racionalni i „realni” brojevi:
6 6 |
13/2 13/2 |
6 6 |
1 1 |
13 13 |
6.50000000000000 6.50000000000000 |
6.50000000000000 6.50000000000000 |
6.50000000000000 6.50000000000000 |
6.50000000000000 6.50000000000000 |
0.153846153846154 0.153846153846154 |
0.15384615384615384615384615384615384615384615384615 0.15384615384615384615384615384615384615384615384615 |
6.5000000000000000000000000000000000000000000000000 6.5000000000000000000000000000000000000000000000000 |
1/302875106592253 1/302875106592253 |
3.30169095523012e-15 3.30169095523012e-15 |
u računanju s „realnim” brojevima potreban je oprez:
1.00000000000000 1.00000000000000 |
True True |
1.00000000000000 1.00000000000000 |
False False |
0.99999999999999989 0.99999999999999989 |
Relacijske operacije:
False False |
True True |
False False |
True True |
prioritet relacijskih operatora niži je od prioriteta aritmetičkih:
True True |
False False |
True True |
False False |
Logičke operacije:
True True |
prioritet logičkih operatora niži je od prioriteta relacijskih:
False False |
False False |
False False |
|