Contact
CoCalc Logo Icon
StoreFeaturesDocsShareSupport News AboutSign UpSign In
| Download
Project: Numerik Üb 5
Views: 50
#k=1 print "Funktion aus A 5.3" f=2*x^5+4*x^3+2*x show(f) plot(f,-1,1) print "exakter Integralwert" IO=integral(f, x, -1, 1) show(IO) # Integralwert der Gewichtsfunktion I=integral(1, x, -1, 1) #k=1 print "k=1" x0=-1*sqrt(1/3) x0.numerical_approx() y0=f(x0) y0.numerical_approx() x1=1*sqrt(1/3) x1.numerical_approx() y1=f(x1) y1.numerical_approx() I1=I*(1/2*f(x0)+1/2*f(x1)) I1.numerical_approx()
Funktion aus A 5.3
2x5+4x3+2x\displaystyle 2 \, x^{5} + 4 \, x^{3} + 2 \, x
exakter Integralwert
0\displaystyle 0
k=1 -0.577350269189626 -2.05280095711867 0.577350269189626 2.05280095711867 0.000000000000000
#k=2 print "Funktion aus A 5.3" f=2*x^5+4*x^3+2*x show(f) plot(f,-1,1) print "exakter Integralwert" IO=integral(f, x, -1, 1) show(IO) # Integralwert der Gewichtsfunktion I=integral(1, x, -1, 1) x0=-1*sqrt(3/5) x0.numerical_approx() y0=f(x0) y0.numerical_approx() x1=0 x1.numerical_approx() y1=f(x1) y1.numerical_approx() x2=sqrt(3/5) x2.numerical_approx() y2=f(x2) y2.numerical_approx() I2=I*(5/18*y0+8/18*y1+5/18*y2) I2.numerical_approx()
Funktion aus A 5.3
2x5+4x3+2x\displaystyle 2 \, x^{5} + 4 \, x^{3} + 2 \, x
exakter Integralwert
0\displaystyle 0
Gewichtsfunktion -0.774596669241483 -3.96593494651640 0.000000000000000 0.000000000000000 0.774596669241483 3.96593494651640 0.000000000000000
3f9c616-b48f-4b28-937c-a59fc850c217︠ ︠f6e278a4-3a8d-49f4-969c-d84e55115ae1︠ print "Funktion aus A 5.3" f=2*x^5+4*x^3+2*x show(f) plot(f,-1,1) print "exakter Integralwert" IO=integral(f, x, -1, 1) show(IO) print "Gewichtsfunktion" I=integral(1, x, -1, 1) a=0 b=4 #Transformationsfunktion t=(b-a)/2*x+(b+a)/2 #I4 ist der Integralwert der Gewichtsfunktion I4=integral(1, x, 0, 4) #k=1 x0=t(-1*sqrt(1/3)) print "x0 Stützstelle" x0.numerical_approx() y0=f(x0) print "g(x0)" y0.numerical_approx() x1=t(1*sqrt(1/3)) print "x1 Stützstelle" x1.numerical_approx() y1=f(x1) print "g(x1)" y1.numerical_approx() #Integralwert auf [0,4] I4g=(b-a)/2*I*(1/2*f(x0)+1/2*f(x1)) print "Quadratur Ergebnis" I4g.numerical_approx() print "Analytischer Integralwert" Io=integral(f, x, 0, 4) Io.numerical_approx() print "Unterschied" r=Io-I4g r.numerical_approx()
Funktion aus A 5.3
2x5+4x3+2x\displaystyle 2 \, x^{5} + 4 \, x^{3} + 2 \, x
exakter Integralwert
0\displaystyle 0
Gewichtsfunktion x0 Stützstelle 0.845299461620749 g(x0) 4.96971361653256 x1 Stützstelle 3.15470053837925 g(x1) 756.808064161245 Quadratur Ergebnis 1523.55555555556 Analytischer Integralwert 1637.33333333333 Unterschied 113.777777777778
︠d1b42417-8332-4559-a6b9-4dbd2d0f542c︠ ︠56edf4b6-27e1-43e1-a9df-075ad93e2b29︠ print "Funktion aus A 5.3" f=2*x^5+4*x^3+2*x plot(f,0,4) print "exakter Integralwert" IO=integral(f, x, 0, 4) print "Gewichtsfunktion" Iw=integral(1, x, -1, 1) #5.3b a=0 b=4 #Transformationsfunktion t=(b-a)/2*x+(b-a)/2 #k=2 x0=t(-1*sqrt(3/5)) print "x0 Stützstelle" x0.numerical_approx() y0=f(x0) print "g(x0)" y0.numerical_approx() x1=t(0) print "x1" x1.numerical_approx() y1=f(x1) print "g(x1)" y1.numerical_approx() x2=t(sqrt(3/5)) print "x2" x2.numerical_approx() y2=f(x2) print "g(x2)" y2.numerical_approx() I4g2=(b-a)/2*Iw*(5/18*y0+8/18*y1+5/18*y2) print "Quadratur Ergebnis" I4g2.numerical_approx() print "Analytischer Integralwert" Io=integral(f, x, 0, 4) Io.numerical_approx() print "Unterschied" r=Io-I4g2 r.numerical_approx()
Funktion aus A 5.3
exakter Integralwert Gewichtsfunktion x0 Stützstelle 0.450806661517033 g(x0) 1.30531462108711 x1 2.00000000000000 g(x1) 100.000000000000 x2 3.54919333848297 g(x2) 1312.29468537891 Quadratur Ergebnis 1637.33333333333 Analytischer Integralwert 1637.33333333333 Unterschied -7.65359997600967e-15
#5.3.c print "Funktion aus A 5.3" f=2*x^5+4*x^3+2*x plot(f,0,4) print "exakter Integralwert" I02=integral(f, x, 0, 2) print "Wert der Gewichtsfunktion auf [0,2]" I=integral(1, x, -1, 1) a=0 b=2 #Transformationsfunktion t=(b-a)/2*x+(b+a)/2 #k=1 x0=t(-1*sqrt(1/3)) print "x0 Stützstelle" x0.numerical_approx() y0=f(x0) print "g(x0)" y0.numerical_approx() x1=t(1*sqrt(1/3)) print "x1 Stützstelle" x1.numerical_approx() y1=f(x1) print "g(x1)" y1.numerical_approx() #Integralwert auf [0,2] QI02=(b-a)/2*I*(1/2*f(x0)+1/2*f(x1)) print "Quadratur Ergebnis" QI02.numerical_approx() print "Analytischer Integralwert" I02.numerical_approx() print "Unterschied" r=I-QI02 r.numerical_approx() c=2 d=4 #Transformationsfunktion t1=(d-c)/2*x+(d+c)/2 print "Wert des Integrals auf [2,4]" I24=integral(f, x, 2, 4) I24.numerical_approx() x0=t1(-1*sqrt(1/3)) print "x0 Stützstelle" x0.numerical_approx() y0=f(x0) print "g(x0)" y0.numerical_approx() x1=t1(1*sqrt(1/3)) print "x1 Stützstelle" x1.numerical_approx() y1=f(x1) print "g(x1)" y1.numerical_approx() #Integralwert auf [2,4] QI24=(d-c)/2*I*(1/2*f(x0)+1/2*f(x1)) print "Quadratur Ergebnis" QI24.numerical_approx() print "Analytischer Integralwert" I24.numerical_approx() print "Unterschied" r=I24-QI24 r.numerical_approx() print "Gesammt Quadratur" Ig=QI02+QI24 Ig.numerical_approx() print "Analytischer Wert" AW04=integral(f, x, 0, 4) AW04.numerical_approx() print "Unterschied" r=AW04-Ig r.numerical_approx()
Funktion aus A 5.3
exakter Integralwert Wert der Gewichtsfunktion auf [0,2] x0 Stützstelle 0.422649730810374 g(x0) 1.17426910388984 x1 Stützstelle 1.57735026918963 g(x1) 38.3812864516657 Quadratur Ergebnis 39.5555555555556 Analytischer Integralwert 41.3333333333333 Unterschied -37.5555555555556 Wert des Integrals auf [2,4] 1596.00000000000 x0 Stützstelle 2.42264973081037 g(x0) 228.631969108761 x1 Stützstelle 3.57735026918963 g(x1) 1362.03469755791 Quadratur Ergebnis 1590.66666666667 Analytischer Integralwert 1596.00000000000 Unterschied 5.33333333333343 Gesammt Quadratur 1630.22222222222 Analytischer Wert 1637.33333333333 Unterschied 7.11111111111092
︠c2e3d8da-6878-4ecf-a667-c9af57683eb3︠