rsweet

25 Reputation

3 Badges

6 years, 341 days

MaplePrimes Activity


These are questions asked by rsweet

Below is a picture of my code and the errors that have arisen when I have tried to use a 2-level indice within a loop and dsolve. I will also paste in the code below.

restart;

with(PDEtools); umain := 1-exp(-y)+sum(A^i*u[i](y, z), i = 1 .. 4); vmain := -1+sum(A^i*v[i](y, z), i = 1 .. 4); wmain := sum(A^i*w[i](y, z), i = 1 .. 4); pde[main] := diff(vmain, y)+diff(wmain, z); pde[main[2]] := vmain*(diff(wmain, y))+wmain*(diff(wmain, z))-(diff(wmain, y$2));

for i to 1 do pde[i] := coeff(pde[main[2]], A^i) = 0; w[i](y, z) := sum(sol[i, k](y)*sin(k*z), k = 1 .. i); for j to i do sys__i__j := [-(diff(sol__i__j(y), y))-(diff(sol__i__j(y), y$2)) = coeff(pde[main[2]], sin(j*z)), sol__i__j(0) = 0, sol__i__j(infinity) = 0]*dsolve([-(diff(sol__i__j(y), y))-(diff(sol__i__j(y), y$2)) = coeff(pde[main[2]], sin(j*z)), sol__i__j(0) = 0, sol__i__j(infinity) = 0]); assign(op(0, sol__i__j*y)) = unapply(dsolve(sys__i__j), op(dsolve(sys__i__j))) end do end do

Getting undefined terms in pdsolve output. Am I expecting too much of pdsolve to be able to solve such complex systems? If so, is there another way I could go about trying to solve such a system with approximations rather than analytically.

Here is the system which produces the undefined terms when solved using pdsolve:

[-(diff(w[3](y, z), y))+cos(z)*(exp(-y)-1)*((1/2)*exp(-y)*sin(2*z)*y-(1/2)*exp(-y)*sin(2*z))-v[2](y, z)*sin(z)*exp(-y)-sin(z)*(exp(-y))^2*cos(2*z)*y-(1/2)*(exp(-y))^2*sin(2*z)*y*cos(z)-(diff(w[3](y, z), y, y)) = 0, w[3](0, z) = 0, w[3](infinity, z) = 0]

 

Get the following for w[3](y,z):

(1/8)*((y^2+4*y-1)*sin(3*z)+(y^2-4*y+3)*sin(z)+undefined)*exp(-y)-3*exp(-2*y)*sin(z)*(1/8)+(1/8)*exp(-2*y)*sin(3*z)+undefined

Code below:

restart;

with(PDEtools); umain := 1-exp(-y)+sum(A^i*u[i](y, z), i = 1 .. 5); vmain := -1+sum(A^i*v[i](y, z), i = 1 .. 5); wmain := sum(A^i*w[i](y, z), i = 1 .. 5); pde[main] := diff(vmain, y)+diff(wmain, z); pde[main[2]] := vmain*(diff(wmain, y))+wmain*(diff(wmain, z))-(diff(wmain, y$2));

sys[1] := [A*coeff(pde[main[2]], A) = 0, w[1](0, z) = sin(z), w[1](infinity, z) = 0]; pdsolve(sys[1]); w[1] := proc (y, z) options operator, arrow, function_assign; sin(z)*exp(-y) end proc; pdex[1] := diff(w[1](y, z), z)+diff(v[1](y, z), y) = 0; pdexbound := v[1](0, z) = 0; sysx[1] := [pdex[1], pdexbound]; pdsolve(sysx[1])

v[1] := proc (y, z) options operator, arrow, function_assign; cos(z)*(exp(-y)-1) end proc

for i from 2 to 3 do pde[i] := coeff(pde[main[2]], A^i) = 0; sys[i] := [pde[i], w[i](0, z) = 0, w[i](infinity, z) = 0]; pdsolve(sys[i]); assign(op(0, lhs(pdsolve(sys[i]))) = unapply(rhs(pdsolve(sys[i])), op(lhs(pdsolve(sys[i]))))); sysx[i] := [diff(w[i](y, z), z)+diff(v[i](y, z), y) = 0, v[i](0, z) = 0]; pdsolve(sysx[i]); assign(op(0, lhs(pdsolve(sysx[i]))) = unapply(rhs(pdsolve(sysx[i])), op(lhs(pdsolve(sysx[i]))))) end do

 

I am trying to get the output of pdsolve to be assigned to the function it is being solved for but I am having issues with 'too many levels of recursion... Below is my code. Would appreciate any advice on how to get around this. I would also like any solution to eventually work within a 'for' loop.

restart; with(PDEtools);
umain := 1-exp(-y)+sum(A^i*u[i](y, z), i = 1 .. 5);
vmain := -1+sum(A^i*v[i](y, z), i = 1 .. 5);
wmain := sum(A^i*w[i](y, z), i = 1 .. 5);
pde[main] := diff(vmain, y)+diff(wmain, z);
pde[main[2]] := vmain*(diff(wmain, y))+wmain*(diff(wmain, z))-(diff(wmain, y$2));

sys[1] := [A^i*coeff(pde[main[2]], A) = 0, w[1](0, z) = sin(z), w[1](infinity, z) = 0];

for i from 2 to 5 do pde[i] := A^i*coeff(pde[main[2]], A^i) = 0; sys[i] := [pde[i], w[i](0, z) = 0, w[i](infinity, z) = 0] end do;


pdsolve(sys[1]);
w[1] := proc (y, z) options operator, arrow, function_assign; pdsolve(sys[1]) end proc;
w[1](y, z);
Error, (in w[1]) too many levels of recursion

Page 1 of 1