Está en la página 1de 7
18 Example program, time integration [Ths program: computes the mamerical solution of dyii=fay) wit Heun's method (he modified Euler method) + Filename exprogm J Functionsite exfm JsSorpeses —sexheunm, extabelm x stands for example +6 Seren management: lear %¢ Clear work memory es % Clear text window ca % Clear graphical screen |yonrt: of % Intl condition 0. % Start tine te % Bnd ime Jsteps=inpur(Give de number of sep) tend-O megs Time ep lester {96Call forthe script file containing Heun's methd the modified Euler meshod) Jexzabel S6Call forthe trip ile designed to prin the rer 6 The commands from eserip ile or substited divecly ino U program. |peuse(s) 6 The program pauses a whe before it shows the graph old on Jplouierapk ercph), graph yeraph2.)): Secomponentofy are cistnguohed by 6 ploting the 2nd component with a brokon ine exit tend 55) Gis preferable 1 call ats afer plot tide Inual value problem: Name compulsory) |xiabe( Satu using Hear for A= numer) hota of 5 Rea s method Seip file with lename exon 8 Assuming (C0) “osteps” tps are boing exceed 96 The derivave ofthe dif eg is ven in the fron file em. 96 The resus are putin tgraph and raph seph= (0): barah- (0 96 sart saving enue reps Aheexfty) 6 Paste the new res afer te od resus 28 [i Fecorincton 7 Function ie wh ename em uncon yace = ext yace = 2) -yahee 2-201) 9 Prncresult. Srp fle with le name exelm 56 The reue which are stored im teraph ond yeraph are 9 printed man Big floating pom forma: ma abe 3m onder to make a hardcopy of the tables you need 0 remove the ret and the ato comment smb (8) 36 for sacallyo command cine format sing of frm he pat Besen quotation mars) Sex which needs to Be printed ie gven, and forever mber sé which hast be printed he forma iver se sear mean: feo format wih | decimal ond Spins 36 5815 Te means: lang pot (exponen) format with 7 decimals and 15 postions 6 ‘meas contin printing an eno line % Afr the format sing the variables which (posi) need Be print flow. the acl fle starts nm: 36 dary oes rin Hean's mated, h=¥5.3 [porinprstep #9) lind: Trape/l0nrstns print every 100 esa ‘Iovingfl Lf WSF LS 7e 15 Te KigrapheNyeraphl:2k Ji Yote ha nrseps nes fo be 6 i mule of 10 ve day of [eRe fhe example program sewn’ method od 100 le to 3) 2 co 08000006+00 .0000000e+00 $ 0S S2ssssioe07 -29886«0001 To 10 S70l46ite-01 “$.2607651601 1S LS G4t6a2ite-0! “52958459001 20 20 1.20512076+00 “1 2028466¢+00 35 25 Lezeoooreson “14233635000 30 30 Lorsiszes00 “207S0112¢%00 35 3S Dsassosseson “2sassesver00 Go 40 30276955e+00 “30276578400 4S istereson 3 sier78e+00 50 50 40101983e+00 0101978200 29 19 Example program, filling a penta-diagonal matrix [9 wi gies methods ns example order ta const the NW dimeronalpotaagonal mas lx FRRRRRRRRES Peseore cand b are given constants, Noe that the mais Ais symone for b = 0 ot thats evisable to use parse and pigs forthe consacion of ery large maces (N> 1000), shel sparse 4 Methd 1: Consrcion using a lop. 6 imeoder to make he commands in te lop also valid for he fs andthe last colin we st a extra eos, | esseraiaeeg Crus 2 x +4) mars connsng ofzercs Sorjois Biss) 4b 6-44 ent S6Asigns ves to the comfiiems Bi), BGI) B=?) BO*3) and Blind) 6 Copies 8, withou he fre oad las 40 count Removes temporary matric B 9% Changes the ape lef andthe Loverigh cefiten of 4 {Only the nonero elements of Aare stored no th memory Sc When Wi large bate othe non sor clement of 4 on {Foran LUcomposion hs sas comping time al 3 MOY ve space 56 Method 2: Contraction on the basis ofthe diagonals of A %6Firiy we male vectors ll contin the element of agonal ym? me tonen(e2.i)s 96 Ths diagonal contains (4-2) elements al eal © ¢ tel =e nen) Yl = 68/4) nes 1) wl =erpbd)tones. ¥ MeHS:Stones(0-2.): 596 Th frst and it hamentof th an agonal have diferent vals We consact a column vector conssing 2 sce by 6 *onexf\-2 1) and ad the ves athe beginning andthe and Noe ha we use he semicolons Beene we ae ming column ctor Avdlagim2-2)dag(om! 1 dig.) agp 1ag2.2) ‘lear vin unl ¥ vel #2 Acsparsett): 6 See above 30

También podría gustarte