




版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進(jìn)行舉報或認(rèn)領(lǐng)
文檔簡介
上機作業(yè)一姓名:學(xué)號:班級:時間:2012年3月26日1:作業(yè)題目0≤x≤1,t>0u(x,0)=sinx0≤x≤1u(0,t)=u(1,t)=0t>0已知:h=0.1;r=0.5;由r=,所以解得2:離散方程顯示格式:k=1,2,3,4,5,6,7,8,9j=0=(1-2r)+r(+)=(1-2r)+r(+)=(1-2r)+r(+)=(1-2r)+r(+)=(1-2r)+r(+)=(1-2r)+r(+)=(1-2r)+r(+)=(1-2r)+r(+)=(1-2r)+r(+)依次將j取到20,即可得離散方程!3:所得結(jié)果0 0.309017 0.587785 0.809017 0.951057 1 0.951057 0.809017 0.587785 0.309017 0 0 0.293893 0.559017 0.769421 0.904508 0.951057 0.904508 0.769421 0.559017 0.293893 0 0 0.279508 0.531657 0.731763 0.860239 0.904508 0.860239 0.731763 0.531657 0.279508 0 0 0.265828 0.505636 0.695948 0.818136 0.860239 0.818136 0.695948 0.505636 0.265828 0 0 0.252818 0.480888 0.661886 0.778093 0.818136 0.778093 0.661886 0.480888 0.252818 0 0 0.240444 0.457352 0.629491 0.740011 0.778093 0.740011 0.629491 0.457352 0.240444 0 0 0.228676 0.434967 0.598681 0.703792 0.740011 0.703792 0.598681 0.434967 0.228676 0 0 0.217484 0.413679 0.56938 0.669346 0.703792 0.669346 0.56938 0.413679 0.217484 0 0 0.206839 0.393432 0.541512 0.636586 0.669346 0.636586 0.541512 0.393432 0.206839 0 0 0.196716 0.374176 0.515009 0.605429 0.636586 0.605429 0.515009 0.374176 0.196716 0 0 0.187088 0.355862 0.489802 0.575797 0.605429 0.575797 0.489802 0.355862 0.187088 0 0 0.177931 0.338445 0.46583 0.547616 0.575797 0.547616 0.46583 0.338445 0.177931 0 0 0.169223 0.32188 0.44303 0.520813 0.547616 0.520813 0.44303 0.32188 0.169223 0 0 0.16094 0.306126 0.421347 0.495323 0.520813 0.495323 0.421347 0.306126 0.16094 0 0 0.153063 0.291144 0.400725 0.47108 0.495323 0.47108 0.400725 0.291144 0.153063 0 0 0.145572 0.276894 0.381112 0.448024 0.47108 0.448024 0.381112 0.276894 0.145572 0 0 0.138447 0.263342 0.362459 0.426096 0.448024 0.426096 0.362459 0.263342 0.138447 0 0 0.131671 0.250453 0.344719 0.405241 0.426096 0.405241 0.344719 0.250453 0.131671 0 0 0.125226 0.238195 0.327847 0.385408 0.405241 0.385408 0.327847 0.238195 0.125226 0 0 0.119097 0.226537 0.311801 0.366544 0.385408 0.366544 0.311801 0.226537 0.119097 0 0 0.113268 0.215449 0.296541 0.348604 0.366544 0.348604 0.296541 0.215449 0.113268 0 圖形分析:從正面看圖形近似為一個立體三角函數(shù)圖像;從側(cè)面看10層以前的結(jié)果變化比較明顯,10層以后趨于平緩,證明結(jié)果已經(jīng)接近準(zhǔn)確值!4:程序c.cpp程序#include<iostream>#include<fstream>#include<string>#include<cmath>#include"guoyiling.h"usingnamespacestd;doubleinitializing(doublex){returnsin(3.14159265358979323846*x);}//初始化條件doubleleftboundary(doublet){return0;}//左邊界條件doublerightboundary(doublet){return0;}//右邊界條件intmain(intargc,char**argv){ double**m=0; unsignedintrow=21;//=t方向的間隔點個數(shù) unsignedintcol=11;//=x方向的間隔點個數(shù) doubletao=0.005;//=時間步長 doublex1=0; doublex2=1; doubler=0.5;//=? alloc(m,row,col); inti(m,initializing,col,x1,x2); boun1(m,leftboundary,row,tao); boun2(m,rightboundary,row,col,tao); compute(m,row,col,r); show(m,row,col); return0;}//====================================================guoyilin.h程序#ifndefGUOYILIN#defineGUOYILIN#include<iostream>usingnamespacestd;//函數(shù)的申明voidalloc(double**&m,unsignedintrow,unsignedintcol);//分配row*col的矩陣給m,采用引用格式voidshow(double**&m,unsignedintrow,unsignedintcol);//輸出矩陣m的內(nèi)容voidinti(double**&m,double(*f)(double),unsignedintcol,doublex1,doublex2);//初始化mvoidboun1(double**&m,double(*f)(double),unsignedintrow,doubletao);//邊界條件x1(左邊界)voidboun2(double**&m,double(*f)(double),unsignedintrow,unsignedintcol,doubletao);//邊界條件x2(右邊界)voidcompute(double**&m,unsignedintrow,unsignedintcol,doubler);//計算u的值//==========================================//函數(shù)的定義voidalloc(double**&m,unsignedintrow,unsignedintcol){ m=newdouble*[row]; for(unsignedinti=0;i<row;++i) m[i]=newdouble[col];}voidshow(double**&m,unsignedintrow,unsignedintcol){ unsignedinti=0; unsignedintj=0; for(i=0;i<row;++i){ for(j=0;j<col;++j)cout<<m[i][j]<<"\t"; cout<<endl; }}voidinti(double**&m,double(*f)(double),unsignedintcol,doublex1,doublex2){ if(x1>x2){doubletemp=x1;x1=x2;x2=temp;} for(unsignedinti=0;i<col;++i) m[0][i]=f(x1+i*(x2-x1)/(col-1));}voidboun1(double**&m,double(*f)(double),unsignedintrow,doubletao){ for(unsignedinti=0;i<row;++i) m[i][0]=f(i*tao);}voidboun2(double**&m,double(*f)(double),unsignedintrow,unsignedintcol,doubletao){ for(unsignedinti=0;i<row;++i) m[i][col-1]=f(i*tao);}voidcompute(double**&m,unsignedintrow,unsignedin
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時也不承擔(dān)用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 公司貸款抵押合同范本
- 全國青島版信息技術(shù)七年級下冊專題二第6課《閱讀材料 濾鏡》教學(xué)設(shè)計
- 包裝木箱合同范本
- 劇團(tuán)戲服贈與合同范本
- 中砂材料采購合同范本
- 2024年貴陽市息烽縣消防救援大隊政府專職消防員招錄考試真題
- 企業(yè)臨時工雇傭合同范本
- 與法人合同范本
- 傳媒藝人合同范本
- 二手車運輸公司合同范本
- 《生態(tài)安全》課件
- 2025年春新人教版一年級下冊數(shù)學(xué)全冊教學(xué)課件
- 1.北京的春節(jié) 練習(xí)題(含答案)
- 抗震支架安裝工程施工方案范文
- GB/T 45071-2024自然保護(hù)地分類分級
- 普通高中生物學(xué)課程標(biāo)準(zhǔn)-(2024修訂版)
- 農(nóng)業(yè)托管合同范例
- 食品中阿維菌素等55種農(nóng)藥最大殘留限量
- 保潔部消殺培訓(xùn)
- 棗莊學(xué)院《數(shù)字電子技術(shù)》2022-2023學(xué)年期末試卷
- 人力資源部人員培訓(xùn)方案(7篇)
評論
0/150
提交評論