Maple 2020 Questions and Posts

These are Posts and Questions associated with the product, Maple 2020

I have set of assumptions. The set happend to be empty at  time I used it. I forgot to change the set to list when calling assuming. This cased 'numeric exception: division by zero'
 

Is this normal and expected?

restart;
u1:=-ln(csc(x)-cot(x));
the_assumptions_on_x:={};
`assuming`([simplify(u1)],[the_assumptions_on_x])

Error, (in assuming) when calling 'signum'. Received: 'numeric exception: division by zero'
 

I fixed my code to use list at time of the call and the error went away

restart;
u1:=-ln(csc(x)-cot(x));
the_assumptions_on_x:={};
`assuming`([simplify(u1)],convert(the_assumptions_on_x,list))

The question is, why passing {} caused division by zero? 

Maple 2020.1

 

I'm trying to use what is essentially a vector of lists within and expression, using a range variable as one of the indexes, and it doesn’t seem to calculate any result.  Just looking for help or pointers, and I included an example of what I'm talking about in the attached maple doc.  I can convert it into a matrix and get it to calculate the result, however I’m suspecting there must be some way to use the Vector directly but I couldn’t see how to do it.

vector_of_lists_example.mw

thanks,

Brian

Hello,

 

I am one of the software coordinators for CUNY and was wondering how would i obtain access to download Maplesoft for the college community?

I want to do the substitution f(t) - ff(t) = epsilon for any variable t in Maple:

 

expand(myerror);
    2 f(x - 2 h)   f(x)   3 f(x + 3 h)   2 ff(x - 2 h)   ff(x)
  - ------------ - ---- + ------------ + ------------- + -----
        15 h       6 h        10 h           15 h         6 h

       3 ff(x + 3 h)
     - -------------
           10 h     


NULL;
myfunc := t -> f(t) - ff(t) = epsilon;
 myfunc := proc (t) options operator, arrow, function_assign;

    f(t)-ff(t) = epsilon end proc


algsubs(myfunc(t), myerror);
          2               1        3            
        - -- f(x - 2 h) - - f(x) + -- f(x + 3 h)
          15              6        10           
        ----------------------------------------
                           h                    

               2                1         3             
             - -- ff(x - 2 h) - - ff(x) + -- ff(x + 3 h)
               15               6         10            
           - -------------------------------------------
                                  h                     


NULL;
subs(f(-h*n + x) = 1, ff(-h*n + x) = 0, f(x) = 1, ff(x) = 0, f(h*m + x) = 1, ff(h*m + x) = 0, myerror)*epsilon;
                           4 epsilon
                           ---------
                             15 h   

 

How do I change equations from the 2D-output into definitions?

#! Change the order (this case second):
solve({-alpha[-1] + 2*alpha[2] = 1, 1/2*alpha[-1]*h + 2*alpha[2]*h = 0, alpha[-1]/h + alpha[0]/h + alpha[2]/h = 0}, {alpha[a], alpha[b], alpha[c]});
          /            -2             1             1\
         { alpha[-1] = --, alpha[0] = -, alpha[2] = - }
          \            3              2             6/

NULL;
lhs({alpha[-1] = -2/3, alpha[0] = 1/2, alpha[2] = 1/6}[1]) := rhs({alpha[-1] = -2/3, alpha[0] = 1/2, alpha[2] = 1/6}[1]);
     /            -2\       / /            -2             1  
  lhs|alpha[-1] = --| := rhs|{ alpha[-1] = --, alpha[0] = -,
     \            3 /       \ \            3              2  

               1\    \
    alpha[2] = - }[1]|
               6/    /

 

 

Why am I not able to replace O(h^3), and in what other way can I achieve the result (I want to get the coefficients of the f(x), D(f)(x), and D^(2)(f)(x) variables).

Q(h);
1 /          /                                       2    / 3\\
- |alpha[-2] \f(x) - 2 D(f)(x) h + 2 @@(D, 2)(f)(x) h  + O\h //
h \                                                            

   + alpha[0] f(x)

              /                     9                 2    / 3\\\
   + alpha[3] |f(x) + 3 D(f)(x) h + - @@(D, 2)(f)(x) h  + O\h /||
              \                     2                          //


NULL;


subs(f(x) = 1, D(f)(x) = 0, (D@@2)(f)(x) = 0, O(h^3) = 0, collect(Q(h), f(x)));
                         /     / 3\\            /     / 3\\
    alpha[0]   alpha[-2] \1 + O\h // + alpha[3] \1 + O\h //
    -------- + --------------------------------------------
       h                            h                      

 

How do I combine greek letters and latin letters in variable names? e.g. here I want to combine the greek letter Delta and the latin letter x to be used as one variable name:


Delta*x;
                            Delta x

Deltax;
                             Deltax

 

 

The original question (crossed through below) was too vague, so I tried to clarified it:

I have the following expression
Q(h);
 1 /  2                    1                 2    / 3\   1     
 - |- - f(x) - D(f)(x) h + - @@(D, 2)(f)(x) h  + O\h / + - f(x)
 h \  3                    2                             2     

      1                                        2    / 3\\
    + - f(x) + 2 D(f)(x) h + 2 @@(D, 2)(f)(x) h  + O\h /|
      6                                                 /


It doesn't expand this following way...
expand(Q(h));
      /                   1                 2    / 3\\       
    2 |f(x) - D(f)(x) h + - @@(D, 2)(f)(x) h  + O\h /|       
      \                   2                          /   f(x)
  - -------------------------------------------------- + ----
                           3 h                           2 h

                                              2    / 3\
       f(x) + 2 D(f)(x) h + 2 @@(D, 2)(f)(x) h  + O\h /
     + ------------------------------------------------
                             6 h                       


But it does expand when I add the multiplication symbols manually:
expand(2*(f(x) - D(f)(x)*h + 1/2*(D@@2)(f)(x)*h^2 + O(h^3))/(3*h) + f(x)/(2*h) + (f(x) + 2*D(f)(x)*h + 2*(D@@2)(f)(x)*h^2 + O(h^3))/(6*h));
                                                    / 3\
       4 f(x)   1           2                    5 O\h /
       ------ - - D(f)(x) + - h @@(D, 2)(f)(x) + -------
        3 h     3           3                      6 h  

How can I expand my output without having to add the multiplication symbols?


------------------------------------old question below, please disregard----------------------






This happens each time I run a long loop.  (2,500 iterations, which takes about 3 hrs to complete)

Maple always hangs (it does not time out on odetest() ). But my question is not about this (as this is something I have to deal with for long time now and mentioned it before many times. May be one day Maplesoft will fix this). 

But I noticed this also.  When Maple hangs, (and it always hangs at least once during this loop), I then click on the button "interrupt the current operation". This does stop the hangs.

Next I do a restart and starts the loop from the loop counter where it hanged in order to continue.  

But It still hangs at that same iteration. I repeate this again, and it still hangs.

Now I close Maple altogether, start Maple again, open same worksheet, and repeat from the same iteration again from where it was at before, now it does not hang.

This tells me that restart and "interrupt the current operation" do not clean everything as expected. Else why only restarting Maple makes it work?

It means mserver.exe (separate process from the frontend) still is caching something related, and that is why it hangs at that iteration.

I can reproduce this each time I run the whole loop from the start.

I can't make a minimal example, since I have no idea where it hangs and why. And it is related to running a long loop.

I just know it hangs when doing odetest() with timeout which never timeout, and it seems random at what iteration it decides to hang.

But my question is really basic here: Does mserver.exe keep any information about the earlier user session/worksheet even after restart ? help says that restarts clear internal memory of the kernel.

Isn't mserver.exe  the Maple kernel? If so, then what could explain that only restarting Maple clears the hang? I am just looking for ideas that could explain this.

This type of problem is the most annoying thing about Maple for me. 

Maple 2020.1 on windows 10.

 

Anyone maybe helps me with writing the maple code mentioned in the following pdf.

I want to know about the potential flow around 3D domain.

 

Doc1.pdf

 

Dear everyone,

I want to execute a simple example by using Grid:-Send and Grid:-Receive commands. I have two questions:
1) Why does the Grid:-GetLastResult(0) command not return anything?

2) I tried to send the value of a, namely 2, from node 0 to node 1. It seems the execution is not stopped by Grid:-Send(1,a) and a_1:=Grid:-Receive(0) while CPU is not working.
Would anyone guide me?

The answer to the second question is more important to me.

Best wishes

 

 

restart;

Grid:-Run(0,"a:=2;");

Grid:-GetLastResult(0);

Grid:-Get(0,a);

Grid:-Send(1,a);

a_1:=Grid:-Receive(0);

Maple can return multiple values as expression sequence. The problem with this is that if one of the values is NULL, then one gets an error on the receiving end.

For example, suppose a proc foo() is meant to return 3 separate values. When doing 

  a,b,c := foo() 

This will fail if one of the values was NULL. For example, if b  was NULL, then Maple returns a,c only. The NULL value is discarded.

foo:=proc()
 local a,b,c;
  a:=1; b:=NULL; c:=3;
  return a,b,c;
end proc;

a,b,c := foo()

Error, mismatched multiple assignment of 3 variables on the left side and 2 values on the right side

I'd like to use NULL to indicate that this variable has no value (may be it could be something that could not be computed inside foo, or some solution that could not be found, and for any other reason.)

So currently I use {} instead of NULL everywhere to indicate no value for that variable and that works

foo:=proc()
 local a,b,c;
  a:=1; b:={}; c:=3;
  return a,b,c;
end proc;

a,b,c := foo()

And now I check using if b={} instead of if b=NULL and that works OK for what I want.

It would be nice if one could do this

  [a,b,c] := foo() 

And even if b was NULL, it will still keep that slot. But Maple will also replace [a,b,c]  with [a,c]  if b was NULL

So what is NULL used for in Maple exactly? (help says it is used to initialize an expression sequence). Since one can't return NULL as value.

In Mathematica, NULL can be returned as an actual value. For example

foo[] := Module[{a, b, c},
  a = 1; b = Null; c = 3;
  {a, b, c}
 ];

{a, b, c} = foo[]

gives

    {1, Null, 3}

My question: is using {} in place of NULL a common practice  in Maple to indicate no value for a variable being returned? Or is there a better way than this?

 

I have been using Maple 2017 but recently upgraded to MacOS Catalina. It doesn't work anymore. I would upgrade to Maple 2020, but worried will I have to upgrade again when the new MacOS 11 comes out? does anyone have any experiece dealing with similar situation on previous MacOS upgrade?

What is a good way to determine, at run time, a free symbol to use inside a proce, so it does not appear the same as one being passed in from outside?

Here is the problem. Inside a proc, user calls it with an ODE. The independent variable is passed in as the argument called x

Inside this proc, it does change of variables to do something else.  If the proc uses say as the new variabe, this could be the same as the passed in argument in the way it appears when being printed out to file.  

I know the local symbol is not the same as the passed in symbol, even if that happend to be also. As one is local and the other is not. So the math will still work, but the display will look very confusing to the user.

But since I am printing these out, these will show the same. 

So I need a way to make symbol inside proc, which looks different from the one being passed in.

An example will show the problem. 

foo:=proc(ode::`=`,y,x)
local t; #hoping this will not be the same looking as actual x
return PDEtools:-dchange({x=t^2},ode,t)  
end proc;

Now it is called as

ode:=diff(y(x),x)=sin(x);
foo(ode,y,x)

Which gives

The above worked, because the independent variable being passed in happend to be x

But if the proc was next called using global as the independent variable

ode:=diff(y(t),t)=sin(t);
foo(ode,y,t)

The output will be the same. Which looks confusing.

I want the out in this case to be using different letter than t, say z

The point is, the proc needs to use different looking symbol. Since it does not know which symbol the user is using, currently I use Z  since this is not likely to be used as independent variable by a user. most odes use x or t or z as independent variables

Again, this is all for display purposes, as I am printing these out, and want to avoid using the same looking symbol.

What is a good way to come up with symbol that does not look like the one being passed in?   The option of the user passing in the extra variable to use for this is not possible at all, as this is done deep inside and asking the user to pass in the spare symbol to use is not possible.

 

 

Hello

Although I have read the help file on how to use try-catch commands, I am not sure how they work exactly.  Here is an example of how I used them. (It is just a pseudocode).

myrout:=proc(arg1,arg2,arg3,args4,arg5)
try 
   .....
   timelimit(...)
   if condition then 
      ....
   else 
      timelimit(...)
      .....
   end if:
catch "time expired":
    return([a,b,c,d]):
finally
    .......
end try:
return([res1,res2]):
end proc:

Questions:

1) Does catch catch "time expired" from both calls of timelimit?  

2) Will the set of sequences under finally be executed when a "time expired" is caught? Somehow reading the help file i had the impression that it will.  If that is the case, how can it be avoided?  

 

Many thanks

Ed

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