nm

11368 Reputation

20 Badges

13 years, 39 days

MaplePrimes Activity


These are questions asked by nm

From another question I asked, I learned that parse("string") returns an unevaluated Maple expression. 

But in interactive mode (in worksheet), the result looks the same as normal evaluated expression. That is why I did not know this. For example

ode1:= :-parse("diff(y(x),x$2)=0");
ode2:= diff(y(x),x$2)=0;

it gives

There is no difference when looking at it.  That is why when I was in Maple debugger, I could not see why Maple was complaining about it. An eval  was needed.

I looked at the types to see if there is something like type(variable,`unevaluated`) or such, and could not find one.

If Maple can at least display unevaluated expression with different color, or different notations when in the worksheet interface,  I would have noticed that parse returns unevaluated expression.

In Mathematica, these things are done using wrappers, (called Hold or Inactive) but these are visible in the notebook and use different color shading or Hold is present and had to expliclity removed,  and so looking at them, one can see the differerence between the expressions. 

How can one in Maple distinguish between unevaluated expression such as ode1 above and evaluated one such as ode2 above?  This can be useful to use inside a proc for example.  Is there an option in the GUI itself to tell Maple may be to color each differently?

 

I can't figure why dsolve and odeadvisor fail to process ode when it is parsed from string and only inside a proc, but works ok in global space.

This works OK:

restart;
ode  :=  :-parse("diff(y(x),x$2)=0"):
func := :-parse("y(x)"):

dsolve(ode);
DEtools:-odeadvisor(ode,func);

But the same code, when inside a proc, fail

restart;
foo:=proc()
  local ode,func;  
  local x,y; #adding this did not  help

  ode  :=  :-parse("diff(y(x),x$2)=0");
  func :=  :-parse("y(x)");

  dsolve(ode);
  try
     DEtools:-odeadvisor(ode,func);
  catch:
     error lastexception;
  end try;

end proc;

foo()

It seems to have with name scoping, but I do not see what is the problem. :-parse works fine.

How to resolve this? Since I must use :-parse as I am reading the ode as string from database with Maple as string from inside a proc inside a module and the above is just a simple example that shows the problem.

Maple 2020.1 with Physics 724

According to Wikipedia, Abel's first order odes have general analytical solutions, due to "Panayotounakos, Dimitrios E.; Zarmpoutis, Theodoros I. (2011)" where the claim is that, if I understand it right, all Abel ode's can be solved analytically.

https://en.wikipedia.org/wiki/Abel_equation_of_the_first_kind

"Construction of Exact Parametric or Closed Form Solutions of Some Unsolvable Classes of Nonlinear ODEs (Abel's Nonlinear ODEs of the First Kind and Relative Degenerate Equations)"

Maple is very good on solving ODE's, but some Abel ode's it can not solve. For example

restart;
ode:=diff(y(t),t)= y(t)^3+exp(-5*t);#_Abel
ode:=diff(y(x),x) = (1+x^3*y(x))*y(x)^2;#_Abel
ode:=diff(y(x),x) = y(x)^2-a*x*(1-x^(n-1))*y(x)^3;#_Abel
ode:=diff(y(x),x) = a*y(x)^2+x*y(x)^3*(b+c*x^(n-1));#_Abel
ode:=diff(y(x),x) = f0(x)+f1(x)*y(x)+f2(x)*y(x)^2+f3(x)*y(x)^3;#_Abel
ode:=(tan(x)*sec(x)-2*y(x))*diff(y(x),x)+sec(x)*(1+2*y(x)*sin(x)) = 0;#_Abel, `2nd type`, `class A`
ode:=x*(a+y(x))*diff(y(x),x)+b*x+c*y(x) = 0; #[_Abel, `2nd type`, `class B`]
ode:=(g0(x)+y(x)*g1(x))*diff(y(x),x) = f0(x)+f1(x)*y(x)+f2(x)*y(x)^2+f3(x)*y(x)^3;#_Abel, `2nd type`, `class C`

etc..

All the above Abel ode's are from Book: Ordinary differential equations and their solutions. By George Moseley Murphy. 1960

I am just asking what is the status of this. Is it true there is now a method to solve all these exactly and may be Maple's implementation is not in yet for this? 

btw, I found the description of solution methods in https://fr.maplesoft.com/support/help/Maple/view.aspx?path=odeadvisor/Abel much easier to follow to learn how to solve Abel ode's. That paper mentioned on Wikipeida, I had hard time following after the 3rd page. (need more time to study it).

Could someone please comment on the status of solving Abel's first order ODE's in Maple and if it possible now to solve them all analytically?

 

 

 

 

 

Why when trying to substitute a term in denominator, subs does not work, when this term is product. But it works when this term is single variable?

subs((x*y)=t,1/(x*y));

does not work. i.e. it does not return 1/t

But this works

subs(z=t,1/z);

and returns 1/t

algsubs does not work either on the first example above. 

Just wondering why, that is all.

 

I do not think Maple help on the subject is easy to follow as the exampels are not clear. I was hoping someone can give a very simple example.  

Now, I run long script, over say 1,000 problems. This takes long time each time I run it. Since each problem is completely independent of others, and there is no shared data at all (for each problem, its output is written to separate file), I am thinking of using the parallel programming in Maple, and hoping this will speed it up. I have an intel PC, with modern CPU. I think it has may be 10 or 16 cores, not sure now, so in theory it should be faster to complete.

For a very basic example, suppose I have this sequential program

foo:=proc(i::integer)
   return i^2;
end proc;

for i from 1 to 10 do
   foo(i);
od;

Where foo() is now called 10 times, one after the other. How would one change the above to make it run in parallel?

I know I need to call Threads:-Task:-Start and then use Threads:-Task:-Continue 

But I am not sure how to use Threads:-Task:-Continue to tell it to call foo in parallel passing each task 1,2,3,.... in turn, and wait until they are all done. This is the part not clear to me how to do even after looking at the help example under Task Programming Model

Could someone show how to do the above for this simple example?   

Since I have 1,000 problems, do I need to create 1,000 tasks at once, one for each problem and wait for them to all be done? what if I have 10,000 problems, creating 10,000 tasks at once might not work, would it? or will Maple handle this internally by queuing the creation of tasks as needed? This part is also not clear to me.

 

thanks

 

First 119 120 121 122 123 124 125 Last Page 121 of 200