Sponsored links: Algebra eBooks
 

Related

rk-sin

result: rk(x*sin(y)+y...

Calculate

rk

f: x2^2+t^2+x1^2;

result: rk([x2,f],[x1...

Calculate

rk

T:4;

F:t/4;

w:1/4;

Calculate

rk

result:rk((y*(1/3))+(...

Calculate

rk-sin

result: rk(x*sin(y)+y...

Calculate

rk

results: rk(-2.5*x^2,...

Calculate

rk-sin

result: rk((y-x)*sin(...

Calculate

rk-sin

result:rk((y-x)*sin(y...

Calculate

rk

result: rk(y^(1/3)+x^...

Calculate

rk

result: rk(y^(1/3)+x^...

Calculate

rk

Run Example
(%i1)result: rk(((y-x)*sin(y*x)),y,5,[x,-3,10,0.1]);
(%o1) [[- 3, 5], [- 2.9, 4.437674780748283], [- 2.8, 4.462011491837269], 
[- 2.7, 4.586110203555572], [- 2.6, 4.745473012471332], 
[- 2.5, 4.925332389376685], [- 2.4, 5.122082648452681], 
[- 2.3, 5.335951371507967], [- 2.2, 5.568610493939755], 
[- 2.1, 5.822456451362866], [- 2.0, 6.100459972766338], 
[- 1.9, 6.406213064540006], [- 1.8, 6.744061436492595], 
[- 1.7, 7.119298743148908], [- 1.6, 7.538429709865417], 
[- 1.5, 8.009523349402457], [- 1.4, 8.542688101917909], 
[- 1.3, 9.150710292947638], [- 1.2, 9.849899831501928], 
[- 1.1, 10.66115567573268], [- 1.0, 11.61109694091529], 
[- 0.9, 12.73240422801607], [- 0.8, 14.05951126915607], 
[- 0.7, 15.60109155789042], [- 0.6, 17.18216614036799], 
[- 0.5, 17.60870376473243], [- 0.4, 16.28352186031173], 
[- 0.3, 17.04699895963675], [- 0.2, 18.67153483455791], 
[- 0.1, 18.15796170018035], [0.0, 16.9748108649895], [0.1, 18.14294259758864], 
[0.2, 18.65870130500707], [0.3, 17.07863293942715], [0.4, 16.36161915486202], 
[0.5, 17.5932586257231], [0.6, 17.20638305440314], [0.7, 15.72355470091753], 
[0.8, 14.35441214611837], [0.9, 13.42256966861004], [1.0, 13.52032027380415], 
[1.100000000000001, 14.3288684722572], [1.2, 13.72473312553487], 
[1.3, 12.80555990210402], [1.4, 11.90681687799816], [1.5, 11.09223904103386], 
[1.600000000000001, 10.37048718816664], [1.7, 9.73431228120943], 
[1.800000000000001, 9.172280847344435], [1.9, 8.673144986813446], 
[2.0, 8.227216440159339], [2.100000000000001, 7.826528688339948], 
[2.2, 7.464611553660763], [2.300000000000001, 7.136202249626115], 
[2.4, 6.836992826002452], [2.5, 6.56343176529668], 
[2.600000000000001, 6.312573458231622], [2.7, 6.081965187768359], 
[2.800000000000001, 5.869562710006372], [2.9, 5.673667912758386], 
[3.0, 5.492884151874554], [3.100000000000001, 5.326086544875647], 
[3.2, 5.172405815628657], [3.300000000000001, 5.031225281935476], 
[3.4, 4.902191139052023], [3.5, 4.785235807979614], 
[3.600000000000001, 4.680611441356332], [3.7, 4.588922683021562], 
[3.800000000000001, 4.51112867183104], [3.9, 4.448446165404911], 
[4.0, 4.402028625374295], [4.100000000000001, 4.372264036926429], 
[4.2, 4.357670552299489], [4.300000000000001, 4.353848144745031], 
[4.4, 4.35352274131246], [4.5, 4.348398947084699], 
[4.600000000000001, 4.331881719075291], [4.7, 4.30058442074811], 
[4.800000000000001, 4.253713345264512], [4.9, 4.191273181948321], 
[5.0, 4.112365821617212], [5.1, 4.014475991336682], 
[5.200000000000001, 3.895535531390356], [5.300000000000001, 3.76140438672922], 
[5.4, 3.63102586278815], [5.5, 3.521490474569624], [5.6, 3.433539532480061], 
[5.700000000000001, 3.359750969330649], 
[5.800000000000001, 3.293981305095513], [5.9, 3.232971397896864], 
[6.0, 3.175243192424779], [6.1, 3.120124170456137], 
[6.200000000000001, 3.06726322035541], [6.300000000000001, 3.016437700796482], 
[6.4, 2.967483558543225], [6.5, 2.920270016164411], 
[6.600000000000001, 2.874690047640952], [6.700000000000001, 2.83065785565719], 
[6.800000000000001, 2.788112373522923], [6.9, 2.747031495963191], 
[7.0, 2.707473456048027], [7.100000000000001, 2.669698542533514], 
[7.200000000000001, 2.63455558731323], [7.300000000000001, 2.604793641130309], 
[7.4, 2.588491059751161], [7.5, 2.573654276997369], 
[7.600000000000001, 2.492493336680742], 
[7.700000000000001, 2.474084174762838], 
[7.800000000000001, 2.481051681661025], [7.9, 2.310377109352376], 
[8.0, 2.470859971844421], [8.100000000000001, 2.52069928797462], 
[8.200000000000001, 2.421350083412636], 
[8.300000000000001, 2.405530821339541], [8.4, 2.474603317024763], 
[8.5, 2.327575490467552], [8.600000000000001, 2.472005075935695], 
[8.700000000000001, 2.194765551000867], 
[8.800000000000001, 1.918719343219902], [8.9, 1.750627588397179], 
[9.0, 1.357622827504271], [9.100000000000001, 1.138644402246663], 
[9.200000000000001, 0.74957332797638], [9.300000000000001, 1.106580498354709], 
[9.4, 0.66273073002655], [9.5, 0.82883942730555], 
[9.600000000000001, 1.038800906615676], 
[9.700000000000001, 1.583050215238806], 
[9.800000000000001, 1.641985526668064], [9.9, 1.778801529616948], 
[10.0, 1.752012636075708]]
(%i2) plot2d([discrete, result]);
plotplot2d([discrete, result]);
Run Example
result: rk(x*sin(y)+y*sin(x),y,-2,[x,-1,5,0.1]);
(%o1) [[- 1, - 2], [- 0.9, - 1.757037313842795], [- 0.8, - 1.548459932584421], 
[- 0.7, - 1.374516940537385], [- 0.6, - 1.233077439694283], 
[- 0.5, - 1.120873797280061], [- 0.4, - 1.034424889817311], 
[- 0.3, - 0.97058527266901], [- 0.2, - 0.92681481010586], 
[- 0.1, - 0.90128300774374], [0.0, - 0.89289380364406], 
[0.1, - 0.90128300752101], [0.2, - 0.9268148080466], 
[0.3, - 0.97058526654018], [0.4, - 1.034424879109829], 
[0.5, - 1.120873786954176], [0.6, - 1.2330774433845], 
[0.7, - 1.374516976857475], [0.8, - 1.548460005089033], 
[0.9, - 1.757037378545495], [1.0, - 1.999999966332647], 
[1.1, - 2.273542834416308], [1.2, - 2.569945307139254], 
[1.3, - 2.878686109637773], [1.4, - 3.188834454277601], 
[1.5, - 3.491528583997136], [1.6, - 3.781340608092715], 
[1.7, - 4.056277042668273], [1.8, - 4.316991168281269], 
[1.9, - 4.565893500557055], [2.0, - 4.806544609723964], 
[2.1, - 5.043434142234045], [2.2, - 5.282129056006286], 
[2.3, - 5.529755507529757], [2.4, - 5.795752106236415], 
[2.5, - 6.092620793642309], [2.6, - 6.435618295364179], 
[2.7, - 6.838407169807223], [2.8, - 7.299883577223483], 
[2.9, - 7.785021287060351], [3.0, - 8.226030541742771], 
[3.100000000000001, - 8.561183104399884], [3.2, - 8.767796222021325], 
[3.3, - 8.856648314711979], [3.4, - 8.852334311213076], 
[3.5, - 8.780578101503691], [3.600000000000001, - 8.662920262388715], 
[3.7, - 8.515099479161721], [3.800000000000001, - 8.347124125794425], 
[3.9, - 8.164016944162988], [4.0, - 7.966528027506175], 
[4.100000000000001, - 7.751277528788695], [4.2, - 7.509800462421755], 
[4.300000000000001, - 7.225635752603592], [4.4, - 6.867847190522696], 
[4.5, - 6.379870783378075], [4.600000000000001, - 5.680097831240163], 
[4.7, - 4.768964238327176], [4.800000000000001, - 3.912307601930725], 
[4.9, - 3.343828579725686], [5.0, - 3.024003391891168]]
(%i2) 
Run Example
F: 2*(Dy^2)+2*y(x)^2+3*y(x)*exp(2*x)*sin(x)-5*cos(x);
                   2 x                             2          2
(%o1)          3 %e    y(x) sin(x) - 5 cos(x) + 2 y (x) + 2 Dy
(%i2) Fy: diff(F, y(x));
                                2 x
(%o2)                       3 %e    sin(x) + 4 y(x)
(%i3) Fdy: diff(F, Dy);
(%o3)                                4 Dy
(%i4) Fdy1: diff(Fdy,x)+diff(Fdy,y(x))*'diff(y(x),x)+diff(Fdy,Dy)*'diff(y(x),x,2);
                                    2
                                   d
(%o4)                           4 (--- (y(x)))
                                     2
                                   dx
(%i5) eqn: Fy - Fdy1 = 0;
                      2
                     d                 2 x
(%o5)           - 4 (--- (y(x))) + 3 %e    sin(x) + 4 y(x) = 0
                       2
                     dx
(%i6) eiler: subst(Dy='diff(y(x), x), eqn);
                      2
                     d                 2 x
(%o6)           - 4 (--- (y(x))) + 3 %e    sin(x) + 4 y(x) = 0
                       2
                     dx
(%i7) result_eiler: ode2(eiler, y(x), x);
                    2 x              2 x
                3 %e    sin(x) - 6 %e    cos(x)         x         - x
(%o7)    y(x) = ------------------------------- + %k1 %e  + %k2 %e
                              40
(%i8) lab2: bc2(result_eiler, x=-1, y(-1)=3, x=1, y(1)=4);
                 2 x              2 x
             3 %e    sin(x) - 6 %e    cos(x)
(%o8) y(x) = -------------------------------
                           40
         6                        6                 4         2    x
   ((3 %e  + 3) sin(1) + (6 - 6 %e ) cos(1) - 160 %e  + 120 %e ) %e
 - -----------------------------------------------------------------
                                 5
                            40 %e  - 40 %e
         3                              3                 3             - x
   ((3 %e  + 3 %e) sin(1) + (6 %e - 6 %e ) cos(1) + 120 %e  - 160 %e) %e
 + ------------------------------------------------------------------------
                                      4
                                 40 %e  - 40
(%i9)   answer: solve(eiler,diff(y(x),x,2));
                      2               2 x
                     d            3 %e    sin(x) + 4 y(x)
(%o9)               [--- (y(x)) = -----------------------]
                       2                     4
                     dx
(%i10) /*Сведение к ДУ 2го порядка*/ answer: rhs(answer[1]);
                                2 x
                            3 %e    sin(x) + 4 y(x)
(%o10)                      -----------------------
                                       4
(%i11)  dv1: v2;
(%o11)                                v2
(%i12)  dv2: subst([y(x) = v1, diff(y(x),x)= v2],answer);
                                 2 x
                             3 %e    sin(x) + 4 v1
(%o12)                       ---------------------
                                       4
(%i13)  /*Система ДУ 2го порядка*/ dy1: 0;
(%o13)                                 0
(%i14)   method_runge1: rk([dv1, dv2],[v1,v2],[3, dy1],[x, -1, 1, 0.1]);
(%o14) [[- 1, 3, 0], [- 0.9, 3.014565639645424, 0.29136015965372], 
[- 0.8, 3.058330229677211, 0.58446923327208], 
[- 0.7, 3.131617231099893, 0.88231732046499], 
[- 0.6, 3.235055745151696, 1.188037764092314], 
[- 0.5, 3.369598202053319, 1.504976303869394], 
[- 0.4, 3.536545568696226, 1.836772763912328], 
[- 0.3, 3.737581474323364, 2.187458259698132], 
[- 0.2, 3.974816974092952, 2.561571361526052], 
[- 0.1, 4.250848037978851, 2.964297132432738], 
[0.0, 4.568828268957076, 3.401633453093063], 
[0.1, 4.932559820115439, 3.88058953067538], 
[0.2, 5.346605992551779, 4.409421928116329], 
[0.3, 5.816429547885871, 4.997913795840119], 
[0.4, 6.348561348318897, 5.657703172394944], 
[0.5, 6.950804523026611, 6.402666153632392], 
[0.6, 7.632479921456876, 7.24936029293484], 
[0.7, 8.404719107388436, 8.217532632950373], 
[0.8, 9.280811510385794, 9.3306950839346], 
[0.9, 10.27661249913441, 10.61676720363683], 
[1.0, 11.41101896139716, 12.10878248341357]]
(%i15)    b: method_runge1[length(method_runge1)][2];
(%o15)                         11.41101896139716
(%i16)  /*обращение ко 2-му элементу  последней строки матрицы */ dy1: 1;
(%o16)                                 1
(%i17)  method_runge2: rk([dv1, dv2],[v1,v2],[3, dy1],[x, -1, 1, 0.1]);
(%o17) [[- 1, 3, 1], [- 0.9, 3.114732306312091, 1.296364326320389], 
[- 0.8, 3.259666064399434, 1.604535969400557], 
[- 0.7, 3.436137268630573, 1.927655779996846], 
[- 0.6, 3.645807720733294, 2.269110028591403], 
[- 0.5, 3.890693054140048, 2.632602090379503], 
[- 0.4, 4.173198582554035, 3.022237712146453], 
[- 0.3, 4.496164478286138, 3.442626882332135], 
[- 0.2, 4.862922110871896, 3.899005788039424], 
[- 0.1, 5.277363749268849, 4.397382834922812], 
[0.0, 5.744028253818411, 4.944713212366896], 
[0.1, 6.268205857454947, 5.549106983394855], 
[0.2, 6.856065656783875, 6.220076131662296], 
[0.3, 7.514809995909583, 6.968826357830245], 
[0.4, 8.252860516793938, 7.808599617541072], 
[0.5, 9.080081249179367, 8.755073343115022], 
[0.6, 10.00804469003993, 9.826821872131141], 
[0.7, 11.05034733285044, 11.04584466378564], 
[0.8, 12.22298148884805, 12.43816422014128], 
[0.9, 13.54477041167392, 14.03449399282192], 
[1.0, 15.03787358087404, 15.87097263131225]]
(%i18)  a: method_runge2[length(method_runge1)][2] - b;
(%o18)                         3.626854619476882
(%i19) dy1: (4 - b) / a;
(%o19)                        - 2.043373594739258
(%i20)  /*решение на правом конце отрезка*/ans: rk([dv1, dv2],[v1,v2],[3, dy1],[x, -1, 1, 0.1]);
(%o20) [[- 1, 3, - 2.043373594739258], 
[- 0.9, 2.809887717905709, - 1.762238817115877], 
[- 0.8, 2.646925901331035, - 1.499908200204694], 
[- 0.7, 2.509369027340694, - 1.253699685307823], 
[- 0.6, 2.395736004261276, - 1.020996755190098], 
[- 0.5, 2.304806740944737, - 0.79918445303245], 
[- 0.4, 2.235625611168013, - 0.58557500879822], 
[- 0.3, 2.187512994607847, - 0.37732016073743], 
[- 0.2, 2.160086388246562, - 0.17130683030661], 
[- 0.1, 2.153292938943883, 0.035967648966163], 
[0.0, 2.167455651353452, 0.2485450184163], 
[0.1, 2.203335975497769, 0.4711850254268], 
[0.2, 2.262215972335935, 0.70957893938686], 
[0.3, 2.346003786572795, 0.9706031091296], 
[0.4, 2.457366710973079, 1.262618171364815], 
[0.5, 2.599896684913224, 1.595819418568802], 
[0.6, 2.778313600741394, 1.982643360550179], 
[0.7, 2.99871224998251, 2.438234511458236], 
[0.8, 3.26885906516147, 2.980974704542669], 
[0.9, 3.598544917213016, 3.633074528583059], 
[1.0, 4.000000000000018, 4.421222476809256]]
(%i21)  /*возврат списка*/total: makelist([p[1],p[2]], p, ans);
(%o21) [[- 1, 3], [- 0.9, 2.809887717905709], [- 0.8, 2.646925901331035], 
[- 0.7, 2.509369027340694], [- 0.6, 2.395736004261276], 
[- 0.5, 2.304806740944737], [- 0.4, 2.235625611168013], 
[- 0.3, 2.187512994607847], [- 0.2, 2.160086388246562], 
[- 0.1, 2.153292938943883], [0.0, 2.167455651353452], 
[0.1, 2.203335975497769], [0.2, 2.262215972335935], [0.3, 2.346003786572795], 
[0.4, 2.457366710973079], [0.5, 2.599896684913224], [0.6, 2.778313600741394], 
[0.7, 2.99871224998251], [0.8, 3.26885906516147], [0.9, 3.598544917213016], 
[1.0, 4.000000000000018]]
(%i22)  /*список из пар*/plot2d([rhs(lab2),[discrete,total]], [x, -1, 1],[xlabel,"x"],[ylabel,"y(x)"],[legend, "2 lab", "5 lab"]);
(%o22) 
(%i23) 

Related Help

Help for Rk