I have two solutions of nonlinear ODE numerically solved by Maple, and I'd like to add them up to plot it. The third line is obviously wrong, since sol1 and sol2 are data, which cannot be simply added together. How could do I this task properly? More generally, how could I plot a multivariate function g(sol1, sol2)? (e.g. for summation, g(sol1,sol2)=sol1+sol2)
sol1 := dsolve({diff(y(x), [x$2])+2*b*(diff(y(x), [x$1]))+
(1.5*o)^2*sin(y(x)) = g*(1.5*o)^2*cos(o*x),
y(0) = 0, (D(y))(0) = 0}, y(x), type = numeric);
sol2 := dsolve({diff(y(x), [x$2])+2*b*(diff(y(x), [x$1]))+
(1.5*o)^2*sin(y(x)) = g*(1.5*o)^2*cos(o*x), y(0) = 0.1e^(-4), (D(y))(0) = 0},
y(x), type = numeric);
odeplot(sol1+sol2, [x, y(x)], 0 .. 7, color = red);
I'm not sure what you intend with
y(0) = 0.1e^(-4). Do you intend0.1e-4 = 0.00001or0.1*exp(-4)or something else? What you wrote (as plaintext 1D Maple Notation code) gets parsed like(0.1e)^(-4) = 10000.0.One way to add your two solutions involves using the
output=listprocedureoption. Below I make up values forg,o, andbsince you didn't give them. I usey(0) = 0.1e1 = 1.0as initial condition forsol2just because it produces a solution that is visibly distinct from that ofsol1.