Exercício Calculo Númerico
Por: Paulo Vasconcelos • 1/12/2016 • Exam • 440 Palavras (2 Páginas) • 252 Visualizações
Exercio 1 pag 36
A = np.array([[1., 2., 3., 4., 5.],[2.,3.,7., 10., 13.],[3.,5.,11., 16., 21.],[2., -7., 7., 7., 2.],[1., 4., 5., 3., 10.]])
A
b = np.array([[2.],[2.],[17.],[57.],[7]])
b
np.linalg.solve(A,b)
Resultado:
array([[-128.15384615],
[ 15. ],
[ 51.5 ],
[ 14.73076923],
[ -22.65384615]])
------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Exercio 2 pag 36
import numpy as np
from gaussElimin import gaussElimin
from numpy import linalg
A = np.array([[0.8754, 3.0081, 0.9358, 1.1080],[2.4579, -0.8758, 1.1516, -4.5148],[5.2350, -0.8473, -2.3582, 1.1419],[2.1015, 8.1083, -1.3232, 2.1548]])
A
b = np.array([[0.8472],[1.1221],[2.5078],[-6.4984]])
b
gaussElimin(A,b)
Resultado:
array([[ 1.00006463],
[-1.00000865],
[ 2.00018761],
[ 1.00008472]]
---------------------------------------------------------------------------------------------------------------------------------------------------------------------
Exercicio 7 pag37
Gauss
import numpy as np
from gaussElimin import gaussElimin
from numpy import linalg
A = np.array([[1., 2., 3., 4.],[3., 2., 8., 4.],[2., 1., 9., 7.],[4., 2., -8., -4.]])
A
b = np.array([[20.],[26.],[10.],[2.]])
b
gaussElimin(A,b)
Resultado:
array([[ -3.84 ],
[ 13.72 ],
[ 2.736],
[ -2.952]])
Matricial
import numpy as np
from numpy import linalg
A = np.array([[1., 2., 3., 4.],[3., 2., 8., 4.],[2., 1., 9., 7.],[4., 2., -8., -4.]])
A
b = np.array([[20.],[26.],[10.],[2.]])
b
np.linalg.solve(A,b)
Resultado:
array([[ -3.84 ],
[ 13.72 ],
[ 2.736],
[ -2.952]])
-------------------------------------------------------------------------------------------------------------------------------------------------------------------
Exercicio 7.2 pag 37
import numpy as np
from gaussElimin import gaussElimin
from numpy import linalg
A = np.array([[2., 10., -6., 4., 8.],[-3., -12., -9., 6., 3.],[-1.,
...