# Question:How do I modify the code for initial value problem to solve boundary value problem

## Question:How do I modify the code for initial value problem to solve boundary value problem

Maple 2016

Dear all,

Please I want to solve the following boundary value problem numerically with the attached code

y''=((y')^2+y^2)/(2*exp(x)),      0<x<1

with boundary conditions as follows

y(0)-y'(0)=0, y(1)+y'(1)=2*exp(1)

The exact solution is y(x)=exp(x).

How do I modify the code to be able to handle it?

Please the delta in the code represents y'.

Thank you for your time and best regards

restart;
 >
e1:=y[n+2] = (1/12)*h^2*f(n)+(5/6)*h^2*f(n+1)+(1/12)*h^2*f(n+2)+2*y[n+1]-y[n]:
 >
 >
 >

h          Num.y          Num.z            Ex.y           Ex.z        Error y        Error z
0.25000      0.702642933  -11.119327426    0.044732488   -9.516563326       0.65791         1.6028
0.50000     -1.480941776    3.706008390   -0.195836551   -1.080050970        1.2851         4.7861
0.75000      2.177304037    3.857405154    1.966274055   -2.618345553       0.21103         6.4758
1.00000     -0.353401232  -12.899134092   -0.541621655  -16.265122833       0.18822          3.366
1.25000      2.205257809   -0.748313267    1.880461001    0.803458961        0.3248         1.5518
1.50000     -0.457853582   -9.260175135    0.888094914  -17.501091793        1.3459         8.2409
1.75000      2.368665639   -0.220734441    0.227799905   -7.823705892        2.1409          7.603
2.00000     -0.556459764  -11.300336415    2.230324739   -5.428300487        2.7868          5.872
2.25000      2.205494666   -0.953807966   -0.582405956  -17.141951993        2.7879         16.188
2.50000     -0.947043873  -11.871777444    1.457323206    3.126163062        2.4044         14.998
2.75000      1.867780693   -1.104185167    0.366014055  -11.889781987        1.5018         10.786
3.00000     -1.448466064  -12.600325627   -0.692660166   -0.858678078       0.75581         11.742
3.25000      1.408438927   -1.076955833    1.243407129    4.765140072       0.16503         5.8421
3.50000     -1.960671678  -12.838644035   -1.682658102   -6.465546461       0.27801         6.3731
3.75000      0.947838606   -0.761420206    0.210882522   14.697480238       0.73696         15.459
4.00000     -2.352223093  -12.652936159   -0.678627396    0.245000716        1.6736         12.898
4.25000      0.596650899   -0.266003839   -1.802692162    9.387643085        2.3993         9.6536
4.50000     -2.528856863  -12.055589881    0.398695396   14.817725265        2.9276         26.873
4.75000      0.441416507    0.296276900   -2.296698552    0.729525901        2.7381        0.43325
5.00000     -2.446901406  -11.201642111   -0.256333100   19.522565217        2.1906         30.724

 >