nm

3646 Reputation

17 Badges

7 years, 362 days

MaplePrimes Activity


These are questions asked by nm

I gave odetest some confusing long candidate solution to check for me. It gave an internal error

restart;
ode:=3*y(x)*cos(x)+4*x*exp(x)+2*x^3*y(x)+(3*sin(x)+3)*diff(y(x),x) = 0:
sol:=y(x) = -1/3/(exp(I*x)+I)^2*exp(((24*I*x*exp(I*x)-24*x)*polylog(2,I*exp(I*x))+(-24*I-24*exp(I*x))*polylog(3,I*exp(I*x))+(4*I*x^3-3*I*x+6*I*Re(x)-6*Im(x))*exp(I*x)-6*I*Im(x)+3*x-6*Re(x))/(3*exp(I*x)+3*I))*(1-I*exp(I*x))^(-4*x^2)*(4*int((1-I*exp(I*x))^(4*x^2)*x*(2*I*exp(((-24*I*x*exp(I*x)+24*x)*polylog(2,I*exp(I*x))+(24*I+24*exp(I*x))*polylog(3,I*exp(I*x))+(6*Im(x)-6*I*Re(x)-4*I*x^3+(3+6*I)*x)*exp(I*x)+6*I*Im(x)+6*Re(x)+(-6+3*I)*x)/(3*exp(I*x)+3*I))+exp(((-24*I*x*exp(I*x)+24*x)*polylog(2,I*exp(I*x))+(24*I+24*exp(I*x))*polylog(3,I*exp(I*x))+(6*Im(x)-6*I*Re(x)-4*I*x^3+(3+9*I)*x)*exp(I*x)+6*I*Im(x)+6*Re(x)+(-9+3*I)*x)/(3*exp(I*x)+3*I))-exp(((-24*I*x*exp(I*x)+24*x)*polylog(2,I*exp(I*x))+(24*I+24*exp(I*x))*polylog(3,I*exp(I*x))+(6*Im(x)-6*I*Re(x)-4*I*x^3+(3+3*I)*x)*exp(I*x)+6*I*Im(x)+6*Re(x)+(-3+3*I)*x)/(3*exp(I*x)+3*I)))/(sin(x)+1),x)-3*C[1]):

timelimit(30,odetest(sol,ode));

Error, (in tools/map) too many levels of recursion

I agree that the solution I gave it is very long and most likely is wrong solution. But that is besides the point. The problem with these internal recursion errors, is that try/catch does not catch them. So the whole program stops, and not able by bypass this error.

Should odetest have handled this better?

fyi, I posted similar internal error from Maple about 2 weeks ago in https://www.mapleprimes.com/questions/229872-Error-in-Discontzero-Too-Many-Levels

due to too many levels of recursion as well, but that was fromt rying to evaluate int. 

Maple 2020.1 , Physics 708

 

why does Maple say that timelimit got one argument when doing

timelimit(30,solve(x^2+a=0,x) assuming a>0)

There is clearly 2 arguments in the above, The first is 30 and the second argument is solve(x^2+a=0,x) assuming a>0

I know the workaround is to add [ ] around solve(). 

timelimit(30, [solve(x^2+a=0,x) assuming a>0])

Maple 2020.1 windows

I've asked about this 5 years ago

 

https://www.mapleprimes.com/questions/203628-Maple-2015-No-Longer-Autoscroll-As

And according to the reply there at the time, this is supposed to have been fixed in Maple 2015.1:

It appears that the scrolling issue has been fixed in the next version of Maple

But ever since then, whenever I use Maple, the worksheet do not auto-scroll as the program runs and prints outout to the screen. I have to keep using the mouse to move the bar down to see the latest prints.

Not only that, the bar itself (on the right side) shrinks in size as more outpout is printed.

It becomes smaller and smaller with time, and becomes very hard to grab it with the mouse since it become so thin.  Once all the output is deleted, the bar become long again.

So I think there is an option to enable autoscrolling somewhere.

But I am not able to find it. I looked at options, display, general and interface and see nothing there to turn it on.

Sometimes I get the feeling that the folks at Maplesoft do not use Maple interface the way we users use it, becuase this is such a basic interface problem and any one who uses Maple interface for more than one day must see these problems all the time.

So how come these are still not fixed?  Here is a screen shot showing the bar on the right after long print out, and showing how it was before.

I use only worksheet mode, not document mode. On windows 10.

 

 

 

 

I do not understand what I am doing wrong. I have an Object, with private variable call hint. This private variable can be seen only by other proc's inside the object as expected.

Now inside one of those other proc's, I nested a small local proc inside it.

What I want is to access the object private variable from inside this small local proc nested inside.

But not able to. I tried different combinations and nothing is working.  Here is one of many attempts. 

restart;
module my_class()
   option object;
   local hint::string:="X"; #private variable to the object
 
   export foo::static:=proc(o::my_class) #can be seen from outside
      local boo; #local proc inside proc foo

      boo:=proc(o::my_class) #local proc
          print("inside boo()");
          print(o:-hint);
      end proc;

      print("in foo(), calling local proc boo()");
      print("hint is ",o:-hint); #works OK
      o:-foo:-boo(o); #tried also o:-boo(o) and boo(o)
   end proc;
end module;

called it as

o:=Object(my_class);
o:-foo(o)

Error, (in my_class:-foo) module `my_class` does not export `boo`
 

Also tried different combinations but so far nothing worked. For example, I tried making the nested proc static, but that did not help:

restart;
module my_class()
   option object;
   local hint::string:="X"; #private variable to the object
 
   export foo::static:=proc(o::my_class) #can be seen from outside
      local boo; #local proc inside proc foo

      boo::static:=proc(o::my_class) #local proc, static
          print("inside boo()");
          print(o:-hint);
      end proc;

      print("in foo(), calling local proc boo()");
      print("hint is ",o:-hint); #works OK
      boo(o);
   end proc;
end module;

o:=Object(my_class);
o:-foo(o)

Error, (in boo) module `my_class` does not export `hint`
 

But this error do not show up, when I made boo local to the object itself (vs. local to the proc). As follows, where the nested boo() proc is moved one level higher.

restart;
module my_class()
   option object;
   local hint::string:="X"; #private variable to the object
 
   export foo::static:=proc(o::my_class) #can be seen from outside     
      print("in foo(), calling local proc boo()");
      print("hint is ",o:-hint); #works OK
      o:-boo(o);
   end proc;

   local boo:=proc(o::my_class) #local proc to the object
      print("inside boo()");
      print(o:-hint);
   end proc;
end module;

now

o:=Object(my_class);
o:-foo(o)

works. No problem and no error.

How does one call a local proc to an object? Similar to how one does it in normal non-object proc's? 

Are local proc's inside object proc's allowed? Or for an Object, only one level of nesting is allowed?

Maple 2020.1

 

 

 

In Maple, an expression of type `*` can have many operands. I need to break it to product of two operands only.

For example given, expr:=A*B*C, I want first_part to be A and second_part to B*C

The way I do it now is clumsy.

I first check if expression is of type `*`, then use first_part :=op(1,expr) to find the first term, then divide the expression by that first term to find the second part. second_part:=expr/first_part

second_part:=op(2..nops(expr)) does not exaclty works, since it gives me B,C instead of B*C.

What would be a good way to do this? Notice that expr:=-A is actually a `*`, where first_part:=-1 and second_part:=A. Which is OK.

restart;
expr         := A*B*C;
first_part   := op(1,expr);
second_part  := expr/first_part;

1 2 3 4 5 6 7 Last Page 3 of 82