Solving Maple Procedure Issues with DE_soln

  • Context: Maple 
  • Thread starter Thread starter Warr
  • Start date Start date
  • Tags Tags
    Maple Procedure
Click For Summary
SUMMARY

The discussion centers on a Maple procedure issue where the user attempts to substitute a constant variable, _C1, in the function DE_soln within a defined procedure. The procedure, proc1, generates a list of solutions but fails to replace _C1 with specific numerical values when executed. The user successfully generates a list of solutions externally but encounters difficulties when using the procedure, indicating a scope issue with the variable _C1. The solution requires modifying the procedure to correctly substitute the values for _C1.

PREREQUISITES
  • Familiarity with Maple programming language and syntax
  • Understanding of procedures and local variables in Maple
  • Knowledge of differential equations and the dsolve function in Maple
  • Experience with sequence generation in Maple
NEXT STEPS
  • Review Maple documentation on local variables and scope within procedures
  • Explore the use of the subs function in Maple for variable substitution
  • Learn about the seq function and its application in generating sequences in Maple
  • Investigate advanced usage of the dsolve function for handling constants in differential equations
USEFUL FOR

Maple users, mathematicians working with differential equations, and developers creating procedures in Maple who need to manage variable substitution effectively.

Warr
Messages
119
Reaction score
0
Having a problem with a procedure

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
I've honestly tried everything I can think of and looked on ever maple forum. Maybe I'm missing something...
 

Similar threads

  • · Replies 3 ·
Replies
3
Views
3K
  • · Replies 0 ·
Replies
0
Views
2K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 1 ·
Replies
1
Views
4K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 2 ·
Replies
2
Views
3K
  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 1 ·
Replies
1
Views
4K
  • · Replies 9 ·
Replies
9
Views
6K
  • · Replies 3 ·
Replies
3
Views
2K