Solving Maple Procedure Problem with DE_soln

In summary, it seems that the procedure is not properly substituting the values for _C1 in the list. This can be fixed by declaring _C1 as a local variable within the procedure or using the "subs" command to substitute the values before returning the list.
  • #1
Warr
120
0
Having a problem with a procedure in maple

the procedure is

> proc1:=proc(f,a,b,xmin,xmax)
> local locallist;
> locallist:=[seq(rhs(f),_C1=a..b)];
> RETURN(locallist);
> end;

the test function I am using for f is

DE_soln = y(x) = (arctan(x)+_C1)/(1+x^2)^2;

Which I got from using the dsolve for a differential equation

When I generated a sequence of this externally (not using the procedure)

with the following command

DE_soln_list := [seq(rhs(DE_soln),_C1=-2..2)];

I got a set of 5 solutions with just had the _C1 replaced by -2,-1,0,1,2 in each respective 'solution'

When I try plugging DE_soln into the procedure, it returns a list of 5 solutions, but all in the form (arctan(x)+_C1)/(1+x^2)^2

_C1 was simply a variable created by dsolve when solving the differential equation.

How do I get the procedure to sub in the numbers for _C1, because it seems that it works differently inside the procedure (I tried to declare _C1 as a local variable inside the procedure but that did nothing)

thanks
 
Physics news on Phys.org
  • #2


Thank you for bringing this issue to our attention. It seems that the procedure is not properly substituting the values for _C1 in the list. This could be due to the fact that _C1 is not explicitly defined as a local variable in the procedure.

To fix this issue, you can try declaring _C1 as a local variable within the procedure, using the following command:

local _C1;

This should allow the procedure to properly substitute the values for _C1 in the list. If this does not work, you can also try using the "subs" command to substitute the values for _C1 in the list, before returning it.

I hope this helps resolve your issue. If you continue to experience problems, please don't hesitate to reach out for further assistance. Happy computing!
 
  • #3



It seems like the issue may be with how you are calling the procedure. In your test function, you are using "DE_soln" as the input for the procedure, which is just a symbolic expression and not a function with a specific value for _C1. This is why the procedure is returning the same expression for each solution, as it is not able to substitute in a specific value for _C1.

To fix this, you could modify your test function to include a specific value for _C1, such as:

DE_soln := y(x) = (arctan(x)+1)/(1+x^2)^2;

This way, when you call the procedure, it will use this specific value for _C1 and return the correct solution. Alternatively, you could also modify the procedure to take in a specific value for _C1 as an additional input, rather than trying to declare it as a local variable within the procedure.

I hope this helps and resolves your issue with the procedure. If you continue to encounter any problems, please provide more details and I would be happy to assist further.
 

Related to Solving Maple Procedure Problem with DE_soln

1. How do I use the DE_soln function in Maple to solve a differential equation?

To use the DE_soln function in Maple, you first need to define your differential equation using the diff function. Then, you can use the DE_soln function to solve for the solution of the differential equation. You can also specify any initial conditions or other parameters as needed.

2. What is the syntax for using DE_soln in Maple?

The syntax for using DE_soln in Maple is:
DE_soln(diff(y(x),x$2) + y(x) = x, y(x), x)
In this example, we are solving the differential equation dy/dx + y = x for the dependent variable y, with respect to the independent variable x.

3. Can I solve higher order differential equations using DE_soln in Maple?

Yes, DE_soln can be used to solve higher order differential equations in Maple. You just need to specify the order of the equation in the diff function, and make sure to include all necessary initial conditions.

4. How do I plot the solution of a differential equation using DE_soln in Maple?

Once you have used the DE_soln function to find the solution of a differential equation, you can use the plot command in Maple to plot the solution. For example, if the solution is stored in a variable called y(x), you can use the command:
plot(y(x), x = 0..10)
This will plot the solution of the differential equation over the interval from x = 0 to x = 10.

5. Is there a way to solve a system of differential equations using DE_soln in Maple?

Yes, DE_soln can be used to solve a system of differential equations in Maple. You just need to define each differential equation separately using the diff function, and then use the DE_soln function to solve for the solution of the system. Make sure to include all necessary initial conditions for each equation.

Similar threads

  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
5K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
4
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
4K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
4K
  • Differential Equations
Replies
2
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
3K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
3K
  • Calculus and Beyond Homework Help
Replies
1
Views
2K
Back
Top