Question: solving two systems of ODEs using dsolve


I have used dsolve to obtain the solution of the inserted two systems below. The obtained results for the first system is accurate, where the obtaind solution of the second one is not accurate. I think the problem is in approximating the first system solution to be used in the second one. I would appreciate any advice on how to  obtain accurate results for the second system

 restart; endv := 5; sys0 := diff(f(x), `$`(x, 2))+g(x)*f(x) = 0, diff(g(x), `$`(x, 2))+f(x) = 0; bcs0 := f(0) = 1, f(1) = 2, g(0) = 0, g(1) = 1; V := Vector(endv+1, proc (j) options operator, arrow; .1*(j-1) end proc); sol0 := dsolve({bcs0, sys0}, numeric, output = Array(V)); ss := sol0(2); ExportMatrix(results0, sol0(2), target = Matlab, format = rectangular, mode = ascii);

deg := 3; f0 := spline(ss(1 .. endv, 1), ss(1 .. endv, 2), x, deg); fd0 := spline(ss(1 .. endv, 1), ss(1 .. endv, 3), x, deg); g0 := spline(ss(1 .. endv, 1), ss(1 .. endv, 4), x, deg); gd0 := spline(ss(1 .. endv, 1), ss(1 .. endv, 5), x, deg); fdd0 := -g0*f0; gdd0 := -f0; fddd0 := -g0*fd0-f0*gd0; gddd0 := -fd0;

sys1 := diff(h(x), `$`(x, 2))+fddd0*gddd0 = 0, diff(k(x), `$`(x, 2))-fdd0-gdd0 = 0; bcs1 := h(0) = 0, h(1) = 0, k(0) = 0, k(1) = 0; sol1 := dsolve({bcs1, sys1}, numeric, output = Array(V)); ss := sol1(2); ExportMatrix(results1, sol1(2), target = Matlab, format = rectangular, mode = ascii);

 

Please Wait...