intTypePromotion=1
zunia.vn Tuyển sinh 2024 dành cho Gen-Z zunia.vn zunia.vn
ADSENSE

Bài tập về toán cao cấp

Chia sẻ: Nguyenngoc An | Ngày: | Loại File: DOC | Số trang:27

316
lượt xem
89
download
 
  Download Vui lòng tải xuống để xem tài liệu đầy đủ

Bài 1 là. nghiệm gần đúng thứ của nghiệm đúng của phương trình: x= + 0.055 a) Chứng minh là khoảng phân ly nghiệm của phương trình. b) Chứng minh rằng là ánh xạ co và hệ số co .

Chủ đề:
Lưu

Nội dung Text: Bài tập về toán cao cấp

  1. Bµi 1 xk lµ. nghiÖm gÇn ®óng thø k cña nghiÖm ®óng x* cña ph¬ng tr×nh: cos x x= + 0.055 2 a) Chøng minh ( 0,4; 0,8 ) lµ kho¶ng ph©n ly nghiÖm cña ph¬ng tr×nh. cos x + 0.055 lµ ¸nh x¹ co vµ hÖ sè co q = 0,4 . b) Chøng minh r»ng ϕ ( x) = 2 −5 c) Víi x0 = 0, 4 b»ng ph¬ng ph¸p lÆp ®¬n t×m xk víi sai sè ∆ x ≤ 10 . Quy k trßn kÕt qu¶ víi 3 ch÷ sè ®¸ng tin sau dÊu phÈy. §¸nh gi¸ sai sè cña kÕt qu¶ ®· ® - îc quy trßn. d) B»ng ph¬ng ph¸p lÆp Newton, t×m nghiÖm gÇn ®óng cña ph ¬ng tr×nh sau 10 bíc lÆp. T×m xÊp xØ ban ®Çu x0 ®Ó phÐp lÆp Newton héi tô. e) B»ng ph¬ng ph¸p lÆp Newton, t×m nghiÖm gÇn ®óng xk tho¶ m·n: xk − xk −1 ≤ 10−4 Bµi lµm 1_ lý thuyÕt a) Ph¬ng ph¸p lÆp ®¬n XÐt f(x) =0, ®a ph¬ng tr×nh vÒ d¹ng x=f(x) lÊy x0 bÊt kú thuéc kho¶ng nghiÖm [a,b] C«ng thøc lÆp: xn+1= f(xn) q x n − x n −1 Sai sè : 1− q b) Ph¬ng ph¸p Newton f ( xn ) C«ng thøc tÝnh : x n +1 = x n − ,víi sai sè (M/2n)/(xn-xn-1)2 f ' ( xn ) 2- ch¬ng tr×nh a) f[x_]:=x-Cos[x]/2-0.055 Plot[f[x],{x,-1,2}] -Graphics- Tõ ®å thÞ suy ra kho¶ng ph©n ly nghiÖm cña ph ¬ng tr×nh lµ (0,4;0,8) b) Phi[x_]:=Cos[x]/2+0.055 D[Phi[x],x] 1
  2. -Sin[x] ------- 2 Sin(0,8) NhËn thÊy ϕ ’(x) lµ hµm ®¬n ®iÖu trªn (0,4;0,8) nªn | ϕ ’(x)| ≤ ≤ 0,4 víi ∀ x ∈ 2 (0,4;0.8) .VËy ϕ (x) lµ ¸nh x¹ co vµ hÖ sè co q=0,4. c) (*Giai phuong trinh x-cosx/2-0.055=0*) f[x_]:=x-Cos[x]/2-0.055 Phi[x_]:=Cos[x]/2+0.055 q:=0.4 x:=0.4 Eps:=0.00001 xs:=Phi[x] While[q/(1-q)*Abs[x-xs]>Eps,{x=xs,xs=Phi[x]}] x 0.494991 Quy trßn kÕt qu¶ víi 3 ch sè ®¸ng tin sau dÊu phÈy ta ®îc x=0,459 Sai sè cña kÕt qu¶ ®· ®îc qui trßn ∆ =0,000019 d) f[x_]:=x-Cos[x]/2-0.055 f1[x_]:=D[f[u],u]/.u->x f2[x_]:=D[f[u],{u,2}]/.u->x a:=0.4 b:=0.8 If[f[a]*f2[a]>0,x=a,x=b] 0.8 Do[{Print[StringForm["Nghiem gan dung o buoc thu `` la x=``",k,x]],x=x- f[x]/f1[x]},{k,0,10}] Nghiem gan dung o buoc thu 0 la x=0.8 Nghiem gan dung o buoc thu 1 la x=0.508064 Nghiem gan dung o buoc thu 2 la x=0.495017 Nghiem gan dung o buoc thu 3 la x=0.494987 Nghiem gan dung o buoc thu 4 la x=0.494987 Nghiem gan dung o buoc thu 5 la x=0.494987 Nghiem gan dung o buoc thu 6 la x=0.494987 Nghiem gan dung o buoc thu 7 la x=0.494987 Nghiem gan dung o buoc thu 8 la x=0.494987 Nghiem gan dung o buoc thu 9 la x=0.494987 Nghiem gan dung o buoc thu 10 la x=0.494987 e) f[x_]:=x-Cos[x]/2-0.055 f1[x_]:=D[f[u],u]/.u->x f2[x_]:=D[f[u],{u,2}]/.u->x a:=0.4 b:=0.8 If[f[a]*f2[a]>0,x=a,x=b] 0.8 Eps:=0.0001 xs:=x-f[x]/f1[x] 2
  3. While[Abs[x-xs]>Eps,{x=xs,xs=x-f[x]/f1[x]}] N[x,10] 0.4950174737 Bµi 2. Cho ph¬ng tr×nh: x7 + 0,3x3 - 80= 0 a) Chøng minh (1;2, 5) lµ kho¶ng ph©n ly nghiÖm cña ph¬ng tr×nh. b) BiÕn ®æi ph¬ng tr×nh trªn vÒ d¹ng x = ϕ ( x ) trong ®ã ϕ ( x ) lµ ¸nh x¹ co trªn [1;2, 5] −5 c) Dïng ph¬ng ph¸p lÆp ®¬n, t×m nghiÖm gÇn ®óng xk víi sai sè ∆ x ≤ 10 . k d) Dïng ph¬ng ph¸p lÆp ®¬n, t×m nghiÖm gÇn ®óng xk tho¶ m·n: xk − xk −1 ≤ 10−4 e) Dïng ph¬ng ph¸p lÆp Newton, gi¶i gÇn ®óng ph¬ng tr×nh. Bµi lµm 1_ lý thuyÕt a) Ph¬ng ph¸p lÆp ®¬n XÐt f(x) =0, ®a ph¬ng tr×nh vÒ d¹ng x=f(x) lÊy x0 bÊt kú thuéc kho¶ng nghiÖm [a,b] C«ng thøc lÆp: xn+1= f(xn) q x n − x n −1 Sai sè : 1− q b) Ph¬ng ph¸p Newton f ( xn ) C«ng thøc tÝnh : x n +1 = x n − , f ' ( xn ) 2- ch¬ng tr×nh a) f[x_]:=x^7+0.3*x^3-80 Plot[f[x],{x,0,3}] -Graphics- Tõ ®å thÞ suy ra kho¶ng ph©n ly nghiÖm cña ph ¬ng tr×nh lµ (1;2,5) b) Phi[x_]:=(80-0.3*x^3)^(1/7) D[Phi[x],x] 2 3
  4. -0.128571 x ---------------- 3 6/7 (80 - 0.3 x ) Víi x ∈ [1;2,5] th× | ϕ ’(x)|Eps,{x=xs,xs=Phi[x]}] x 1.86351 d) f[x_]:=x^7+0.3*x^3-80 Phi[x_]:=(80-0.3*x^3)^(1/7) x=1. 1. Eps:=0.0001 xs:=Phi[x] While[Abs[x-xs]>Eps,{x=xs,xs=Phi[x]}] N[x,10] 1.863510487 e) f[x_]:=x^7+0.3*x^3-80 a:=1 b:=2.5 f1[x_]:=D[f[u],u]/.u->x f2[x_]:=D[f[u],{u,2}]/.u->x If[f[a]*f2[a]>0,x=a,x=b] 2.5 Do[{Print[StringForm["Nghiem gan dung o lan lap thu `` la x= ``",k,x]],x=x-f[x]/f1[x]}, {k,0,10}] Nghiem gan dung o lan lap thu 0 la x= 2.5 Nghiem gan dung o lan lap thu 1 la x= 2.18795 Nghiem gan dung o lan lap thu 2 la x= 1.97666 Nghiem gan dung o lan lap thu 3 la x= 1.88114 Nghiem gan dung o lan lap thu 4 la x= 1.86405 Nghiem gan dung o lan lap thu 5 la x= 1.86357 Nghiem gan dung o lan lap thu 6 la x= 1.86357 Nghiem gan dung o lan lap thu 7 la x= 1.86357 Nghiem gan dung o lan lap thu 8 la x= 1.86357 Nghiem gan dung o lan lap thu 9 la x= 1.86357 Nghiem gan dung o lan lap thu 10 la x= 1.86357  x 2 − 3 xy + y 2 + 4 x − 3,135 = 0 Bµi 3. Cho hÖ ph¬ng tr×nh   x − xy − y + 4 x + y = 0 2 2 4
  5. B»ng ph¬ng ph¸p lÆp Newton, t×m nghiÖm gÇn ®óng ( xk , yk ) trong l©n cËn cña ®iÓm (1, 2;3, 8) sao cho: ( xk , yk ) − ( xk −1 , yk −1 ) ≤ 10 −3 . Bµi lµm 1_ lý thuyÕt HÖ ph¬ng tr×nh phi tuyÕn:F(X)=0,F:M → M kh¶ vi liªn tôc,M ®ãng ,giíi néi .C«ng thc lÆp Newton: X k +1 = X k − F ( X K ).( F '( X k )) −1 2- ch¬ng tr×nh f[x_,y_]:={x^2-3*x*y+y^2+4*x-3.135,x^2-x*y-y^2+4*x+y} f1[x_,y_]:={D[f[u,v],u],D[f[u,v],v]}/.{u->x,v->y} {x,y}={1.2,3.8} {1.2, 3.8} {xs,ys}={x,y}-f[x,y].Inverse[f1[x,y]] {1.00094, 2.58493} While[Sqrt[(x-xs)^2+(y-ys)^2]>0.001,{{x,y}={xs,ys}, {xs,ys}={x,y}-f[x,y].Inverse[f1[x,y]]}] {x,y} {0.791933, 2.05485} Bµi 4. Cho hÖ ph¬ng tr×nh  10 x + 0,19 y + 0,16 z = 1,84  0, 45    ÷  0,5 x − 8 y − 0,16 z = −2, 76 , gi¸ trÞ ®Çu X =  0,9 ÷ ( 0) 0, 42 x + 0, 4 y − 20 z = −15, 43  1,35 ÷    a) §a hÖ ph¬ng tr×nh trªn vÒ d¹ng X = C . X + d mµ C ∞ < 1 . b) Dïng ph¬ng ph¸p lÆp ®¬n, tÝnh X ( 30) vµ ∆ X ( 30) . Quy trßn kÕt qu¶ víi 3 ch÷ sè ®¸ng tin sau dÊu phÈy. §¸nh gi¸ sai sè cña kÕt qu¶ ®· ® îc quy trßn. −5 c) Dïng ph¬ng ph¸p lÆp ®¬n t×m X ( k ) tho¶ m·n ∆ ( k ) ≤ 10 . X − X ( k −1) ≤ 10 −5 . (k) d) Dïng ph¬ng ph¸p lÆp ®¬n t×m X ( k ) tho¶ m·n X e) Dïng ph¬ng ph¸p lÆp Seidel, tÝnh X (10) . − X ( k −1) ≤ 10 −5 . (k) f) Dïng ph¬ng ph¸p lÆp Seidel t×m X ( k ) tho¶ m·n X Bµi lµm 1_ lý thuyÕt Cho hÖ ph¬ng tr×nh A.x=b, ®a vÒ d¹ng x=Cx+d a) Ph¬ng ph¸p lÆp ®¬n C«ng thøc tÝnh :xn= C.xn-1+d C x n − x x −1 Sai sè : 1− C b) Ph¬ng ph¸p lÆp Seiden 5
  6. i −1 n C«ng thøc tÝnh: xi = ∑ C il .xl + ∑ C il xl + d i ,Víi sai sè nh ph¬ng ph¸p lÆp ®¬n k −1 k k l =1 l =i 2- ch¬ng tr×nh *)Ph¬ng ph¸p l¨p ®¬n A:={{10,0.19,0.16},{0.5,-8,0.16},{0.42,0.4,-20}} b:={{1.84},{-2.76},{-15.43}} E3:=IdentityMatrix[3] c:=Table[-A[[i,j]]/A[[i,i]],{i,1,3},{j,1,3}]+E3 MatrixForm[c] 0 -0.019 -0.016 0.0625 0 0.02 0.021 0.02 0 d:=Table[b[[i]]/A[[i,i]],{i,1,3}] MatrixForm[d] 0.184 0.345 0.7715 X={{0.45},{0.9},{1.35}} {{0.45}, {0.9}, {1.35}} Do[{Print[StringForm["Nghiem o lan lap thu `` la X= `` ",k,X]],X=c.X+d},{k,0,30}] Nghiem o lan lap thu 0 la X= {{0.45}, {0.9}, {1.35}} Nghiem o lan lap thu 1 la X= {{0.1453}, {0.400125}, {0.79895}} Nghiem o lan lap thu 2 la X= {{0.163614}, {0.37006}, {0.782554}} Nghiem o lan lap thu 3 la X= {{0.164448}, {0.370877}, {0.782337}} Nghiem o lan lap thu 4 la X= {{0.164436}, {0.370925}, {0.782371}} Nghiem o lan lap thu 5 la X= {{0.164434}, {0.370925}, {0.782372}} Nghiem o lan lap thu 6 la X= {{0.164434}, {0.370925}, {0.782372}} Nghiem o lan lap thu 7 la X= {{0.164434}, {0.370925}, {0.782372}} Nghiem o lan lap thu 8 la X= {{0.164434}, {0.370925}, {0.782372}} Nghiem o lan lap thu 9 la X= {{0.164434}, {0.370925}, {0.782372}} Nghiem o lan lap thu 10 la X= {{0.164434}, {0.370925}, {0.782372}} Nghiem o lan lap thu 11 la X= {{0.164434}, {0.370925}, {0.782372}} Nghiem o lan lap thu 12 la X= {{0.164434}, {0.370925}, {0.782372}} Nghiem o lan lap thu 13 la X= {{0.164434}, {0.370925}, {0.782372}} Nghiem o lan lap thu 14 la X= {{0.164434}, {0.370925}, {0.782372}} Nghiem o lan lap thu 15 la X= {{0.164434}, {0.370925}, {0.782372}} Nghiem o lan lap thu 16 la X= {{0.164434}, {0.370925}, {0.782372}} Nghiem o lan lap thu 17 la X= {{0.164434}, {0.370925}, {0.782372}} Nghiem o lan lap thu 18 la X= {{0.164434}, {0.370925}, {0.782372}} Nghiem o lan lap thu 19 la X= {{0.164434}, {0.370925}, {0.782372}} Nghiem o lan lap thu 20 la X= {{0.164434}, {0.370925}, {0.782372}} Nghiem o lan lap thu 21 la X= {{0.164434}, {0.370925}, {0.782372}} Nghiem o lan lap thu 22 la X= {{0.164434}, {0.370925}, {0.782372}} 6
  7. Nghiem o lan lap thu 23 la X= {{0.164434}, {0.370925}, {0.782372}} Nghiem o lan lap thu 24 la X= {{0.164434}, {0.370925}, {0.782372}} Nghiem o lan lap thu 25 la X= {{0.164434}, {0.370925}, {0.782372}} Nghiem o lan lap thu 26 la X= {{0.164434}, {0.370925}, {0.782372}} Nghiem o lan lap thu 27 la X= {{0.164434}, {0.370925}, {0.782372}} Nghiem o lan lap thu 28 la X= {{0.164434}, {0.370925}, {0.782372}} Nghiem o lan lap thu 29 la X= {{0.164434}, {0.370925}, {0.782372}} Nghiem o lan lap thu 30 la X= {{0.164434}, {0.370925}, {0.782372}} (*Lap voi sai so cho truoc Eps=0.00005*) X={{0.45},{0.9},{1.35}} {{0.45}, {0.9}, {1.35}} XS=c.X+d {{0.1453}, {0.400125}, {0.79895}} Eps:=0.00001 k=1 1 While[0.0825/(1-0.0825)*Max[Abs[XS[[1]]-X[[1]]],Abs[XS[[2]]-X[[2]]],Abs[XS[[3]]- X[[3]]]]>Eps, {Print[StringForm["Nghiem gan dung o lan lap thu `` la X=`` ",k,X]],X=XS, XS=c.X+d,k=k+1}] Nghiem gan dung o lan lap thu 1 la X={{0.45}, {0.9}, {1.35}} Nghiem gan dung o lan lap thu 2 la X={{0.1453}, {0.400125}, {0.79895}} Nghiem gan dung o lan lap thu 3 la X= {{0.163614}, {0.37006}, {0.782554}} (*Lap voi sai so hai lan lien tiep la Eps=0.00001*) X={{0.45},{0.9},{1.35}} {{0.45}, {0.9}, {1.35}} XS=c.X+d {{0.1453}, {0.400125}, {0.79895}} k=1 1 Eps:=0.00001 While[Max[Abs[XS[[1]]-X[[1]]],Abs[XS[[2]]-X[[2]]],Abs[XS[[3]]-X[[3]]]]>Eps, {Print[StringForm["Nghiem gan dung sau `` lan lap la X=`` ",k,X]],X=XS,XS=c.X+d,k=k+1}] Nghiem gan dung sau 1 lan lap la X={{0.45}, {0.9}, {1.35}} Nghiem gan dung sau 2 lan lap la X={{0.1453}, {0.400125}, {0.79895}} Nghiem gan dung sau 3 lan lap la X={{0.163614}, {0.37006}, {0.782554}} Nghiem gan dung sau 4 lan lap la X= {{0.164448}, {0.370877}, {0.782337}} *)Ph¬ng ph¸p l¨p Seidel A:={{10,0.19,0.16},{0.5,-8,0.16},{0.42,0.4,-20}} b:={{1.84},{-2.76},{-15.43}} E3:=IdentityMatrix[3] 7
  8. c:=Table[-A[[i,j]]/A[[i,i]],{i,1,3},{j,1,3}]+E3 d:=Table[b[[i]]/A[[i,i]],{i,1,3}] X={{0.45},{0.9},{1.35}} {{0.45}, {0.9}, {1.35}} XS=c.X+d {{0.1453}, {0.400125}, {0.79895}} Do[{Print[StringForm["Nghiem gan dung sau `` lan lap la X= ``" , k,X]],X=XS, Do[X[[i]]=Sum[c[[i,j]]*X[[j]],{j,1,i-1}]+Sum[c[[i,j]]*XS[[j]], {j,i,3}]+d[[i]],{i,1,3}]},{k,1,10}] Nghiem gan dung sau 1 lan lap la X= {{0.45}, {0.9}, {1.35}} Nghiem gan dung sau 2 lan lap la X= {{0.163614}, {0.371205}, {0.78236}} Nghiem gan dung sau 3 lan lap la X= {{0.163614}, {0.371205}, {0.78236}} Nghiem gan dung sau 4 lan lap la X= {{0.163614}, {0.371205}, {0.78236}} Nghiem gan dung sau 5 lan lap la X= {{0.163614}, {0.371205}, {0.78236}} Nghiem gan dung sau 6 lan lap la X= {{0.163614}, {0.371205}, {0.78236}} Nghiem gan dung sau 7 lan lap la X= {{0.163614}, {0.371205}, {0.78236}} Nghiem gan dung sau 8 lan lap la X= {{0.163614}, {0.371205}, {0.78236}} Nghiem gan dung sau 9 lan lap la X= {{0.163614}, {0.371205}, {0.78236}} Nghiem gan dung sau 10 lan lap la X= {{0.163614}, {0.371205}, {0.78236}} (*Lap voi sai so hai lan lien tiep la Eps=0.00001*) While[Max[Abs[XS[[1]]-X[[1]]],Abs[XS[[2]]-X[[2]]],Abs[XS[[3]]-X[[3]]]]>Eps, {X=XS, Do[X[[i]]=Sum[c[[i,j]]*X[[j]],{j,1,i-1}]+Sum[c[[i,j]]*XS[[j]], {j,i,3}]+d[[i]],{i,1,3}]}] X {{0.163614}, {0.371205}, {0.78236}} Bµi 5. Cho ma trËn A vµ ma trËn X 0 lµ ma trËn xÊp xØ ban ®Çu cña A −1 :  1 0 −1 0.021 −0.007   0.956  ÷  ÷ X 0 =  0.347 −0.007 0.339 ÷ A=  2 1 45 ÷;  −1 3 2 ÷  −0.050 0.021 −0.007 ÷     B»ng ph¬ng ph¸p lÆp bËc hai, t×m ma trËn nghÞch ®¶o cña ma trËn A. (LÆp 5 lÇn). Bµi lµm 1_ lý thuyÕt Cho ma trËn A= (aij)nxn ,víi Det A ≠ 0 , x0 lµ 1 ma trËn cÊp n tho¶ m·n a) Ph¬ng ph¸p lÆp bËc 2 C«ng thøc tÝnh: xk+1=xk(2E-Axk) b)Ph¬ng ph¸p lÆp bËc 1 C«ng thøc tÝnh: xk+1=B+(E-AB)xk , víi B=x0 2_Ch¬ng tr×nh A:={{1,0,-1},{2,1,45},{-1,3,2}} Det[A] 8
  9. -140 X[0]:={{0.956,0.021,-0.007},{0.347,-0.007,0.339},{-0.050,0.021,-0.007}} E3:=IdentityMatrix[3] MatrixForm[E3-A.X[0]] -0.006 0. 0. -0.009 0.02 -0.01 0.015 0. -0.01 X[k_]:=X[k-1].(2*E4-A.X[k-1]) Do[Print[StringForm["Nghiem o lan lap thu `` la ``",k,MatrixForm[X[k]]]],{k,0,5}] Nghiem o lan lap thu 0 la 0.956 0.021 -0.007 0.347 -0.007 0.339 -0.05 0.021 -0.007 Nghiem o lan lap thu 1 la 0.94997 0.02142 -0.00714 0.350066 -0.00714 0.33568 -0.049994 0.02142 -0.00714 Nghiem o lan lap thu 2 la 0.95 0.0214286 -0.00714286 0.35 -0.00714286 0.335714 -0.05 0.0214286 -0.00714286 Nghiem o lan lap thu 3 la 0.95 0.0214286 -0.00714286 0.35 -0.00714286 0.335714 -0.05 0.0214286 -0.00714286 Nghiem o lan lap thu 4 la 0.95 0.0214286 -0.00714286 0.35 -0.00714286 0.335714 -0.05 0.0214286 -0.00714286 Nghiem o lan lap thu 5 la 0.95 0.0214286 -0.00714286 0.35 -0.00714286 0.335714 -0.05 0.0214286 -0.00714286 MatrixForm[E4-A.X[5]] 0. 0. 0. -16 -17 1.249 10 0. -1.73472 10 -17 2.77556 10 0. 0. 9
  10. Bµi 6. Cho b¶ng gi¸ trÞ cña hµm y = f ( x ) : x 0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 y -1.1742 -0.8113 -0.4124 0.0306 0.52746 1.09 1.73281 2.47365 3.33424 4.34108 a) H·y t×m ®a thøc néi suy Lagrange xÊp xØ b¶ng gi¸ trÞ trªn. b) H·y t×m ®a thøc néi suy Newton tiÕn xÊp xØ b¶ng gi¸ trÞ trªn. c) Dïng ph¬ng ph¸p b×nh ph¬ng tèi thiÓu, t×m ®a thøc bËc 3 xÊp xØ hµm ®· cho. TÝnh sai sè trung ph¬ng. d) Dïng ph¬ng ph¸p b×nh ph¬ng tèi thiÓu, t×m hµm g ( x ) = a + b sin x + c cos x xÊp xØ hµm ®· cho. TÝnh sai sè trung ph¬ng. Bµi lµm 1_Lý thuyÕt a) C«ng thøc cña hµn néi suy Lagrange j −1 ( x − x x − xl n n L x ( x ) = ∑ y j .∏ .∏ l) l = 0 x j − xl l = j +1 x j − x l j =0 b) C«ng thøc cña hµn néi suy Newton tiÕn ∆y ∆2 y 0 ∆n y 0 P ( x ) = y 0 + 0 ( x − x0 ) + ( x − x 0 )( x 0 − x1 ) + .... + ( x − x 0 )( x1 − x 2 )...( x n − x n −1 ) h 2!.h n!.h Víi sai ph©n cÊp 1 ∆1yi=yi+1-yi , ∆kyi= ∆k-1yi+1-∆k-1yi c) Ph¬ng ph¸p b×nh ph¬ng tèi thiÓu 1n ∑ ( yi − g ( xi ) 2 ®¹t Min Cho y=f(x) , cÇn t×m g(x)=(x,a1,a2,…,ak) víi sai sè ∆ = n i =1 VËy t×m a1,a2,…,an cho : n U(a1,a2,…,an)= ∑ ( y i − g ( xi , a1 , a 2 ,...., a n ) ) ®¹t Min 2 i =1 ∂u = 0 víi i=1,..,k Gi¶i hÖ ∂ai 2_Ch¬ng tr×nh DL:={{0,-1.1742},{0.2,-0.8113},{0.4,-0.4124},{0.6,0.0306},{0.8,0.52746}, {1,1.09},{1.2,1.73281},{1.4,2.47365},{1.6,3.33424},{1.8,4.34108}} x[i_]:=DL[[i+1,1]] y[i_]:=DL[[i+1,2]] k:=9 (*Da thuc noi suy Lagrange*) P9[x_]:=Sum[y[i]*Product[(x-x[j])/(x[i]-x[j]),{j,0,i-1}]*Product[(x-x[j])/ (x[i]-x[j]),{j,i+1,k}],{i,0,k}] Expand[P9[x]] 10
  11. 2 3 4 -1.1742 + 1.73348 x + 0.400642 x - 0.0562045 x + 0.516089 x - 5 6 7 8 9 0.73767 x + 0.676649 x - 0.360992 x + 0.105019 x - 0.0128098 x (*Da thuc noi suy Newton tien*) h:=0.2 SP[0,i_]:=y[i] SP[j_,i_]:=SP[j-1,i+1]-SP[j-1,i] P9[x_]:=y[0]+Sum[SP[i,0]/(i!*h^i)*Product[x-x[j],{j,0,i-1}],{i,1,k}] Expand[P9[x]] 2 3 4 -1.1742 + 1.73348 x + 0.400642 x - 0.0562045 x + 0.516089 x - 5 6 7 8 9 0.73767 x + 0.676649 x - 0.360992 x + 0.105019 x - 0.0128098 x c) DL:={{0,-1.1742},{0.2,-0.8113},{0.4,-0.4124},{0.6,0.0306}, {0.8,0.52746},{1,1.09},{1.2,1.73281},{1.4,2.47365},{1.6,3.33424}, {1.8,4.34108}} x[i_]:=DL[[i+1,1]] y[i_]:=DL[[i+1,2]] Phi[0,0]:=1 Phi[k_,x_]:=x^k A:=Table[Sum[Phi[k,x[i]]*Phi[j,x[i]],{i,0,9}],{k,0,3},{j,0,3}] b:=Table[Sum[y[i]*Phi[j,x[i]],{i,0,9}],{j,0,3}] g[x_]:=LinearSolve[A,b].{1,x,x^2,x^3} Expand[g[x]] 2 3 -1.17933 + 1.83492 x + 0.111267 x + 0.31744 x xicma:=Sqrt[(1/10)*Sum[(g[x[i]]-y[i])^2,{i,0,9}]] Print[StringForm["Sai so trung phuong la `` ",xicma]] Sai so trung phuong la 0.00511943 d) DL:={{0,-1.1742},{0.2,-0.8113},{0.4,-0.4124},{0.6,0.0306},{0.8,0.52746}, {1,1.09},{1.2,1.73281},{1.4,2.47365},{1.6,3.33424},{1.8,4.34108}} x[i_]:=DL[[i+1,1]] 11
  12. y[i_]:=DL[[i+1,2]] coso:={1,Sin[x],Cos[x]} Phi[0,0]:=1 Phi[1,x_]:=Sin[x]Phi[2,x_]:=Cos[x] A:=Table[Sum[Phi[k,x[i]]*Phi[j,x[i]],{i,0,9}], {k,0,2},{j,0,2}] b:=Table[Sum[y[i]*Phi[j,x[i]],{i,0,9}],{j,0,2}] g[x_]:=LinearSolve[A,b].coso Expand[g[x]] 2.86077 - 3.86966 Cos[x] + 0.423925 Sin[x] xicma:=Sqrt[(1/10)*Sum[(g[x[i]]-y[i])^2,{i,0,9}]] Print[StringForm["Sai so trung phuong la `` ",N[xicma,5]]] Sai so trung phuong la 0.31623 Bµi 7. Cho b¶ng gi¸ trÞ: x 0 0.05 0.1 0.15 0.2 0.25 y 0.9 1.00017 1.10134 1.20452 1.31075 1.4211 H·y tÝnh gÇn ®óng ®¹o hµm y ', y '' t¹i c¸c ®iÓm líi. Bµi lµm 1_lý thuyÕt Cho y=f(x) biÕt yi=f(xi) ; xi-1-xi=h §¹o hµm víi sai sè cÊp 1 f’(xi)=(yi+1-yi)/h f’’(xi)=(yi+1-2yi+yi-1)/h2 §¹o hµm víi sai sè cÊp 2 f’(xi)=(yi+1-yi-1)/2h §¹o hµm t¹i x0 f’(x0)=(-y2+4y1-3y0)/2h §¹o hµm t¹i xn f’(xn)= (xn-(yn-2-4yn-1+3yn)/2h 2_ Ch¬ng tr×nh DL:={{0,0.9},{0.05,1.00017},{0.1,1.10134},{0.15,1.20452},{0.2,1.31075} ,{0.25,1.4211}} x[i_]:=DL[[i+1,1]] y[i_]:=DL[[i+1,2]] (*Tinh dao ham cap 1 voi do chinh xac cap 1 tai cac diem nut*) h:=0.05 k:=5 Do[Print[StringForm["Gia tri dao ham tai diem `` la ``",x[i], (y[i+1]-y[i])/h]],{i,0,k-1}] Gia tri dao ham tai diem 0 la 2.0034 Gia tri dao ham tai diem 0.05 la 2.0234 12
  13. Gia tri dao ham tai diem 0.1 la 2.0636 Gia tri dao ham tai diem 0.15 la 2.1246 Gia tri dao ham tai diem 0.2 la 2.207 (*Tinh dao ham cap 1 voi do chinh xac cap 2*) h:=0.05 k:=5 Do[Print[StringForm["Gia tri dao ham tai diem `` la ``",x[i], (y[i+1]-y[i-1])/(2*h)]],{i,1,k-1}] Gia tri dao ham tai diem 0.05 la 2.0134 Gia tri dao ham tai diem 0.1 la 2.0435 Gia tri dao ham tai diem 0.15 la 2.0941 Gia tri dao ham tai diem 0.2 la 2.1658 Do[Print[StringForm["Gia tri dao ham tai diem `` la ``",x[0], (-3*y[0]+4*y[1]-y[2])/(2*h)]]] Gia tri dao ham tai diem 0 la 1.9934 Do[Print[StringForm["Gia tri dao ham tai diem `` la ``",x[5], (y[3]-4*y[4]+3*y[5])/(2*h)]]] Gia tri dao ham tai diem 0.25 la 2.2482 (*Tinh dao ham cap 2 voi do chinh xac cap 2*) Do[Print[StringForm["gia tri dao ham cap 2 tai diem ``la: ``",x[i] ,(y[i+1]-2*y[i]+y[i-1])/(2*h)]],{i,1,k-1}] gia tri dao ham cap 2 tai diem 0.05la: 0.01 gia tri dao ham cap 2 tai diem 0.1la: 0.0201 gia tri dao ham cap 2 tai diem 0.15la: 0.0305 gia tri dao ham cap 2 tai diem 0.2la: 0.0412 Bµi 8. LËp tr×nh b»ng Mathematica, dïng c¸c c«ng h×nh thang vµ Ximx¬n tÝnh gÇn 1 2 ∫e ( x + 0,45) dx víi bíc chia h=0,01. ®óng tÝch ph©n sau ®©y: 0 Bµi lµm 1_Lý thuyÕt a) C«ng thøc h×nh thang TÝnh tÝch ph©n hµm f(x) trªn ®o¹n [a,b] Chia ®o¹n [a,b] thµnh n ®o¹n b»ng nhau: a=x 0,x1,x2,....,xn-1=b ; h=(b-a)/n 13
  14. b h n −1 ∑ ( yi + yi +1 ) ∫ f ( x)dx = C«ng thøc tÝnh: 2 i =0 a b) C«ng thøc Ximxon TÝnh tÝch ph©n hµm f(x) trªn ®o¹n [a,b] Chia ®o¹n [a,b] thµnh n ®o¹n b»ng nhau: a=x 0,x1,x2,....,xn-1=b ; h=(b-a)/2n b h n −1 C«ng thøc tÝnh: ∫ f ( x)dx = ∑ ( y 2i + 4 y 2i +1 + y 2i + 2 ) 3 i =0 a 2_Ch¬ng tr×nh a) (*Cong thuc hinh thang*) f[x_]:=E^((x+0.45)^2) a:=0. b:=1 h:=0.01 k:=(b-a)/h x[i_]:=a+i*h y[i_]:=f[x[i]] Print[StringForm["Gia tri tich phan la `` ",(h/2)*Sum[y[i]+y[i+1], {i,0,k-1}]]] Gia tri tich phan la 3.14011 b) (*Cong thuc Simson*) f[x_]:=E^((x+0.45)^2) a:=0. b:=1 h:=0.01 k:=(b-a)/(2*h) x[i_]:=a+i*h y[i_]:=f[x[i]] Print[StringForm["Gia tri cua tich phan la `` ",(h/3)*Sum[y[2*i]+4*y[2*i+1] +y[2*i+2],{i,0,k-1}]]] Gia tri cua tich phan la 3.13993 NIntegrate[f[x],{x,0,1}] 3.13993 Bµi 9. Cho bµi to¸n C«si: y ' = x 2 + y 2 , y(0) = 1.45 a) B»ng ph¬ng ph¸p ¬le, gi¶i gÇn ®óng bµi to¸n, t×m gi¸ trÞ y(1) víi b íc chia h=0,05. 14
  15. b) B»ng ph¬ng ph¸p Runge - Kutta, víi bíc chia h=0,1, t×m gi¸ trÞ y(0,3). Sö dông c«ng 1 ( k + 2k2 + 2k3 + k4 ) , thøc sai ph©n: yi +1 = yi + 61  k h k1 = hf ( xi , yi ) , k2 = hf  xi + , yi + 1  , 2 2   k h k3 = hf  xi + , yi + 2  , k4 = hf ( xi + h, yi + k3 ) 2 2  Bµi lµm 1_Lý thuyÕt Cho y’=f(x,y) ; y(x0)=y0 Gi¶ sö tÝnh gÇn ®óng tÝch ph©n t¹i x=b . Chia ®o¹n [x0,b] thµnh n ®o¹n bëi : x0,x1,x2,…,xn=b ; h=xi+1-xi=(b-x0)/n Gäi yi lµ gi¸ trÞ gÇn ®óng y t¹i xi a)C«ng thøc Ole : yi+1= yi+ hf (xi,yi) b)Ph¬ng ph¸p Runge-kutta Trong bµi nµy ta dïng bé c«ng thøc 1 yi+1 =yi + ( k1 + 2 k2 + 2k3 + k4 ) 6  k1  h k1 = hf( xi , yi ) , k2 = hf  xi + , yi + , 2 2   k2  h k3 = hf  xi + , yi +  , k4 = hf( xi + h , yi + k3 ) 2 2  2_ Ch¬ng tr×nh (*Phuong phap Ole*) f[x_,y_]:=x^2+y^2 x[0]:=0 y[0]:=1 h:=0.05 k:=(1-0)/h x[i_]:=x[0]+i*h y[i_]:=y[i-1]+h*f[x[i-1],y[i-1]] Do [Print[StringForm["Tai x=`` co y=``",x[i],y[i]]],{i,0,k}] Tai x=0 co y=1 Tai x=0.05 co y=1.05 Tai x=0.1 co y=1.10525 Tai x=0.15 co y=1.16683 Tai x=0.2 co y=1.23603 15
  16. Tai x=0.25 co y=1.31442 Tai x=0.3 co y=1.40393 Tai x=0.35 co y=1.50698 Tai x=0.4 co y=1.62665 Tai x=0.45 co y=1.76695 Tai x=0.5 co y=1.93318 Tai x=0.55 co y=2.13254 Tai x=0.6 co y=2.37505 Tai x=0.65 co y=2.6751 Tai x=0.7 co y=3.05403 Tai x=0.75 co y=3.54488 Tai x=0.8 co y=4.20131 (*Phuong phap Runge-Kutta*) f[x_,y_]:=x^2+y^2 x=0. 0. y=1.45 1.45 h:=0.1 k:=(0.3-0)/h Do[{Print[StringForm["Tai x=`` thi y=`` ",x,y]],h1=h*f[x,y], h2=h*f[x+h/2,y+h1/2],h3=h*f[x+h/2,y+h2/2],h4=h*f[x+h,y+h3], x=x+h,y=y+(h1+2*h2+2*h3+h4)/6},{i,0,k}] Tai x=0. thi y=1.45 Tai x=0.1 thi y=1.69626 Tai x=0.2 thi y=2.04548 Tai x=0.3 thi y=2.57926 Bµi 10. a) B»ng ph¬ng ph¸p ¬le, t×m nghiÖm gÇn ®óng trªn [0;2] cña ph¬ng tr×nh y ' = x 2 y 2 + sin( xy ) + 1 víi ®iÒu kiÖn ®Çu y (0) = 0,045 vµ bíc chia h = 0, 05 . () b) Tõ xi , yi ë c©u a, biÕt yi = f xi , h·y viÕt ®a thøc néi suy Newton lïi xuÊt ph¸t tõ x40 víi bËc lµ 6 xÊp xØ hµm f ( x ) . c) ViÕt ®a thøc néi suy Lagrang xÊp xØ hµm f ( x ) . 16
  17. d) Dïng ph¬ng ph¸p b×nh ph¬ng tèi thiÓu, t×m ®a thøc bËc 4 xÊp xØ hµm ®· cho. 2 ∫ f ( x )dx theo c«ng thøc Ximx¬n. e) TÝnh gÇn ®óng 0 f) H·y tÝnh gÇn ®óng ®¹o hµm cÊp hai cña hµm sè f ( x ) t¹i c¸c ®iÓm líi. g) H·y lËp ®a thøc néi suy Newton tiÕn xuÊt ph¸t tõ x0 = 0 víi bËc lµ 7 xÊp xØ hµm f ( x ) . Bµi lµm 1) Lý thuyÕt Gièng nh÷ng bµi tríc 2) Ch¬ng tr×nh f[x_,y_]:=x^2*y^2+Sin[x*y]+1 x[0]:=0 y[0]:=0.045 h=0.05 0.05 k=(2-0)/h 40. x[i_]:=x[0]+i*h y[i_]:=y[i-1]+h*f[x[i-1],y[i-1]] Do[Print[StringForm["Tai x= `` co y= ``",x[i],y[i]]],{i,0,15}] Tai x= 0 co y= 0.045 Tai x= 0.05 co y= 0.095 Tai x= 0.1 co y= 0.145239 Tai x= 0.15 co y= 0.195975 Tai x= 0.2 co y= 0.247488 Tai x= 0.25 co y= 0.300085 Tai x= 0.3 co y= 0.354113 Tai x= 0.35 co y= 0.409979 Tai x= 0.4 co y= 0.468159 Tai x= 0.45 co y= 0.529221 Tai x= 0.5 co y= 0.593852 Tai x= 0.55 co y= 0.662889 Tai x= 0.6 co y= 0.737364 Tai x= 0.65 co y= 0.818557 17
  18. Tai x= 0.7 co y= 0.908077 Tai x= 0.75 co y= 1.00796 x[15]:=0.75 y[15]:=1.00796 Do[Print[StringForm["Tai x= `` co y= ``",x[i],y[i]]],{i,16,30}] Tai x= 0.8 co y= 1.12083 Tai x= 0.85 co y= 1.2501 Tai x= 0.9 co y= 1.40023 Tai x= 0.95 co y= 1.57725 Tai x= 1. co y= 1.78937 Tai x= 1.05 co y= 2.04828 Tai x= 1.1 co y= 2.37138 Tai x= 1.15 co y= 2.787 Tai x= 1.2 co y= 3.34745 Tai x= 1.25 co y= 4.16585 Tai x= 1.3 co y= 5.52766 Tai x= 1.35 co y= 8.19881 Tai x= 1.4 co y= 14.3244 Tai x= 1.45 co y= 34.5295 Tai x= 1.5 co y= 159.909 x[30]:=1.5 y[30]:=159.909 Do[Print[StringForm["Tai x= `` co y= ``",x[i],y[i]]],{i,31,k}] Tai x= 1.55 co y= 3036.73 6 Tai x= 1.6 co y= 1.1108 10 11 Tai x= 1.65 co y= 1.57936 10 21 Tai x= 1.7 co y= 3.39548 10 42 Tai x= 1.75 co y= 1.66598 10 83 Tai x= 1.8 co y= 4.24997 10 166 Tai x= 1.85 co y= 2.92609 10 332 18
  19. Tai x= 1.9 co y= 1.465171495769918 10 663 Tai x= 1.95 co y= 3.87484315919007 10 1326 Tai x= 2. co y= 2.85461460776974 10 h=0.05 0.05 SP[0,i_]:=y[i] SP[j_,i_]:=SP[j-1,i+1]-SP[j-1,i] (*Da thuc noi suy Newton lui voi bac la 6*) k=6 6 P6[x_]:=y[k]+Sum[SP[i,k-i]/(i!*h^i)*Product[x-x[j],{j,k-i+1,k}], {i,1,k}] Expand[P6[x]] 2 3 4 0.045 + 0.99929 x - 0.0024044 x + 0.33135 x + 0.000526821 x + 5 6 0.212101 x + 0.105084 x P6[x]/.x->0.1 0.145239 (*Da thuc noi suy Lagrang *) k=40 40 P40[x_]:=Sum[y[i]*Product[(x-x[j])/(x[i]-x[j]),{j,0,i-1}]* Product[(x-x[j])/(x[i]-x[j]),{j,i+1,k}],{i,0,k}] Expand[P40[x]] 1326 1328 2 0.045 - 1.42730730388488 10 x + 1.21422260937252 10 x- 1329 3 1331 4 4.70240933273359 10 x + 1.11698956440737 10 x- 1332 5 1333 6 1.84401357890734 10 x + 2.26851256305512 10 x- 19
  20. 1334 7 1335 8 2.17452081681773 10 x + 1.67532445991487 10 x- 1336 9 1336 10 1.06126022259783 10 x + 5.6240468231827 10 x- 1337 11 1337 12 2.52730276117492 10 x + 9.7349127102442 10 x- 1338 13 1338 14 3.24234270467635 10 x + 9.4042223001819 10 x- 1339 15 1339 16 2.38917430653038 10 x + 5.34190597206554 10 x- 1340 17 1340 18 1.05521669756695 10 x + 1.84723272986763 10 x- 1340 19 1340 20 2.87260537036554 10 x + 3.97533692543942 10 x- 1340 21 1340 22 4.90153439631411 10 x + 5.38795729985022 10 x- 1340 23 1340 24 5.28061134686613 10 x + 4.61213574875424 10 x- 1340 25 1340 26 3.58601120261389 10 x + 2.47782327147754 10 x- 1340 27 1339 28 1.51784798549344 10 x + 8.2164479183371 10 x- 1339 29 1339 30 3.91401751655829 10 x + 1.63203100758555 10 x- 1338 31 1338 32 20
ADSENSE

CÓ THỂ BẠN MUỐN DOWNLOAD

 

Đồng bộ tài khoản
2=>2