Maple 2018 Questions and Posts

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

I was trying the solution given in 

https://www.mapleprimes.com/questions/225083-Maple-Command-To-Find-Domain-Of-Function

Which works fine for some functions, but fail for some reason for other functions.

restart;
f:=x*ln(y);
solve(evalc(Im(f)), {x,y});

But fails on 

restart;
f:=sqrt(x)*ln(y);
solve(evalc(Im(f)), {x,y});

Using Maple 2018.1 with Physics 

`2018, July 3, 20:10 hours, version in the MapleCloud: 78, version installed in this computer: 74`

Why this error happen on some functions? Is there a way around it?

One way to workaround it I found, is to use solve for one variable at a time. Now Maple do not give an error

restart;
f:=sqrt(x)*ln(y);
solve(evalc(Im(f)), {x});
solve(evalc(Im(f)), {y});

Strange it failed when using {x,y} at same time on this one, but not on the first one. But the above answer is wrong. For "x", it should be x>=0 and not x=0. If I remove the "y" now it gives correct answer

restart;
f:=sqrt(x)*ln(y);
solve(evalc(Im(f)), {x});

f:=sqrt(x);
solve(evalc(Im(f)), {x});


 

This makes no sense to me.

I am finding too many bugs in Maple making it not useable and having to keep coming with workarounds. 

Maybe it should be tested more thoroughly before release.

how I can dsolve these equations?

thanks.

Boundary conditions are:

u(0) = 0, u(0.1e-2) = 0, w(0) = 0, w(0.1e-2) = 0, (D(w))(0) = 0, (D(w))(0.1e-2) = 0

error masseage:

Error, (in dsolve/numeric/bvp/convertsys) unable to convert to an explicit first-order system
 

error.mw
 

dsys3 := {1.857142857*10^11*(diff(u(x), x, x)), 1.547619048*10^10*(diff(w(x), x, x, x))-1.300000000*10^11*(diff(w(x), x)), -1.300000000*10^11*(diff(w(x), x, x))+3.541600000*10^(-13)*(1.082793750-81250.00*w(x))/(1.019000000*10^(-6)-w(x))^2+1.040549102*10^(-32)/(1.019000000*10^(-6)-w(x))^4-2.124960000*10^(-15)*(1.082793750-81250.00*w(x))*(diff(w(x), x))^2/(1.019000000*10^(-6)-w(x))^4+1.151020000*10^(-10)*(diff(w(x), x))^2/(1.019000000*10^(-6)-w(x))^3-7.083200000*10^(-16)*(1.082793750-81250.00*w(x))*(diff(w(x), x, x))/(1.019000000*10^(-6)-w(x))^3+2.877550000*10^(-11)*(diff(w(x), x, x))/(1.019000000*10^(-6)-w(x))^2-2.081098205*10^(-34)*(diff(w(x), x))^2/(1.019000000*10^(-6)-w(x))^6-4.162196410*10^(-35)*(diff(w(x), x, x))/(1.019000000*10^(-6)-w(x))^5, u(0) = 0, u(0.1e-2) = 0, w(0) = 0, w(0.1e-2) = 0, (D(w))(0) = 0, (D(w))(0.1e-2) = 0, ((D@@2)(w))(0) = 0, ((D@@2)(w))(0.1e-2) = 0}; dsol5 := dsolve(dsys3, numeric, abserr = 0.1e-1, output = array([.5]))

Error, (in dsolve/numeric/bvp/convertsys) unable to convert to an explicit first-order system

 

``

 

Download error.mw

 

is there a way to have output left justified, instead of centered?

in other words, i want this:

 

4-1

3

 

not the normal

4-1

                                                                 3

 

thanks

 

When I run a proc, I get an error

Error, (in SolveTools:-Inequality:-Piecewise) piecewise takes at least 2 parameters


But when I do restart; and then run the same command where the error was generated from inside the proc, but outside the proc, I get no error.

So I did not understand why it fails inside the proc, as I am typing the same exact command.

It turned out that an internal symbol _Z1 must have got messed up due to earlier calls made in the proc. It seems to have assumptions on it. To show this, here is screen shot. Only when I cleared the assumptions on _Z1, did it work. I do not use _Z1 any where in my code. This came back from a Maple call.

 

 

Now to proof this:

restart;
assume(_Z1::integer);
solve({x <> (  (1/2)*Pi+_Z1*Pi ), x < infinity, -infinity < x},{x})

 

I never set _Z1 myself in my code. This was done by Maple internally somewhere and caused this error. In my proc, I made call to singular and to solve only. And noticed this problem. 

What should I do to avoid this problem? Why Maple fails above when its own _Z1 symbol is assumed integer? Is this a bug?


As a workaround for now, I could do this

_Z1:='_Z1'; #when I clear this, the error goes away. Why?
sol:=solve({x <> (1/2)*Pi+_Z1*Pi, x < infinity, -infinity < x},{x}):
simplify(sol) assuming _Z1::integer;

ofcourse,  I do not know that Maple will use _Z1 all the time, since I have to hardcode this in the code for now to pass through this problem. So this is a temp. solution for me.


 

 

 

 

Hello,

There seems to be an error in CUDA and/or . (dot)

The exemple is taken from the help page for CUDA.

Kind regards,

Jean-Michel

(Ican't uoload the document. Seems UPLOAD is not working).

Just run the hepl page for CUDA

This is a new question came up from a follow up to https://www.mapleprimes.com/questions/225083-Maple-Command-To-Find-Domain-Of-Function

Does Maple have support for removing points from an interval automatically? An example will make this clear. This is all on the real line. No complex domain.

Given one interval,. say real_domain :=  x>-infinity and x<infinity: and now I want to remove from this interval, another interval. This second interval can be defined as single point(s) or as interval(s) itself. 

I will give an example of both.

when the singularity interval to remove is defined as one or more single points, here is an example using one point:

real_domain :=  x>-infinity and x<infinity:
singlarity_pt := 1/2:

So I want Maple to give me automatically the new interval as   {x>-infinity and x<1/2} , {x>1/2 and x<infinity}:

Becuase the singularity point was "removed" from the real domain. I tried solve, but it did not work

solve(x<>singlarity_pt and real_domain,{x})
                         

I know I could probably code this by hand, and add logic to figure it if the singularities are points. But this can get complicated if the real domain itself has many sub intervals itself. I thought Maple should be able to do this. fyi, In Mathematica, this is done as follows

singularity = 1/2;
realDomain = -Infinity < x < Infinity;
Reduce[x != singularity && realDomain , x, Reals]

Here is second example where now the singulartiy interval to remove, is not single point, but an interval itself. I found that in this case, solve did the right thing

real_domain :=  x>-infinity and x<infinity:
singlarity_domain := x>-1/2 and x<1/2:

Now the final domain should be   -infinity<x<-1/2 , 1/2<x<infinity, 

solve( not(singlarity_domain) and real_domain,{x})

The question is, why it worked when the singulaity is an interval, but it did not work when it is a specific point? And how can one make it work for single points? Is there a different command to use other than solve for this?

In general, singularities can contain single points and also intervals, but single points is more commin. So I need it to work for both cases.

This has to be done non-interactivally and without plotting or such, as it will be part of a script. 

Thanks for any hints

 

int(int(x,y^4..16),y=0..2);


yields the output $\int_0^2\int_{y^4}^{16} x(x) dx dy$.

 

I can't final an equivalent to Mathematica's Flatten for sets. I know Maple has ListTools:-Flatten for lists.   

For example, given set r:={a,{b,c},d,{e,f,{g,h}}}; How to convert it to  {a,b,c,d,e,f,g,h}; 

does one have to convert each set and all the inner sets to lists, then apply ListTools:-Flatten to the result? How to map convert(z,list) for all levels?

     map(z->convert(z,list),r);

does not work, since it only maps at top level, giving {[a], [d], [b, c], [e, f, {g, h}]}

So doing

   ListTools:-Flatten(convert(map(z->convert(z,list),r),list));

Gives [a, d, b, c, e, f, {g, h}] 

 

     

In attempting to store procedures in a table to create an extensible module, I used the following procedure to test whether a procedure could be queried from the table and executed.

proc() print("Metric is default") end proc;

The result was proc () print("Metric is default") end proc

I have checked the statement with mint in the code editor, but it reports no errors. I get the same result when I use an eval statement around the procedure.  I would be very interested in understanding what is wrong with the procedure as defined.

 


 

I can't figure out why this pattern is failing

restart;
r:= y=3;
patmatch(r,y=z::integer,'la');
patmatch(r,identical(y)=z::integer,'la');
patmatch(r,y::anything=z::anything,'la');

What Am I doing wrong?

 

 

Last week, in the first of a series of three articles, I demonstrated the new color syntax highlighting in the command line (TTY) interface of Maple 2018.1. This week, we'll look at a new facility for manipulating the command line history, the history meta-commands.

For the series of screen shots in this article, assume that the .maple_history file in your home directory initially contains the following:

    p1 := plot(sin,color="DeepPink"):
    p2 := plot(cos,color="DodgerBlue"):
    plots[display](p1,p2);

Now we'll start cmaple and execute a series of commands:

    |\^/|     Maple 2018.1 (X86 64 LINUX)
._|\|   |/|_. Copyright (c) Maplesoft, a division of Waterloo Maple Inc. 2018
 \  MAPLE  /  All rights reserved. Maple is a trademark of
 <____ ____>  Waterloo Maple Inc.
      |       Type ? for help.
> y := 1/(x^4+1);
                                     1
                              y := ------
                                    4
                                   x  + 1

> int(y,x);
     1/2           1/2             1/2           1/2
1/4 2    arctan(x 2    + 1) + 1/4 2    arctan(x 2    - 1)

                    2      1/2
            1/2    x  + x 2    + 1
     + 1/8 2    ln(---------------)
                    2      1/2
                   x  - x 2    + 1

> diff(%,x);
          1                       1              1/2
--------------------- + --------------------- + 2
       1/2     2               1/2     2
2 ((x 2    + 1)  + 1)   2 ((x 2    - 1)  + 1)

    /         1/2        2      1/2              1/2 \
    |  2 x + 2         (x  + x 2    + 1) (2 x - 2   )|
    |--------------- - ------------------------------|
    | 2      1/2               2      1/2     2      |
    \x  - x 2    + 1         (x  - x 2    + 1)       /

      2      1/2        /      2      1/2
    (x  - x 2    + 1)  /  (8 (x  + x 2    + 1))
                      /

> simplify(%);
memory used=5.2MB, alloc=41.3MB, time=0.11
                                 4
                                x  + 1
                 -------------------------------------
                   2      1/2     2     1/2    2     2
                 (x  + x 2    + 1)  (x 2    - x  - 1)

> normal(%,expanded);
                                   1
                                 ------
                                  4
                                 x  + 1

There are two parts to the history:

  1. Session history consists of the commands you've entered in the current session.
  2. Command history consists of all commands from previous sessions, together with the session history (up to a maxium specified by interface(historysize), which is 1000 lines by default).

History meta-commands all begin with two exclamation marks at the beginning of the line. The !!= meta-command lists the session history:

> !!=
<< y := 1/(x^4+1);
<< int(y,x);
<< diff(%,x);
<< simplify(%);
<< normal(%,expanded);

Notice that each displayed line of the history is preceeded by << to differentiate it from Maple input and other Maple output. Each meta-command also has a long form. The long form for !!= is !!list:

> !!list
<< y := 1/(x^4+1);
<< int(y,x);
<< diff(%,x);
<< simplify(%);
<< normal(%,expanded);

Most meta-commands can take an argument specifying the amount of history to be affected. For example, a numeric argument refers to the last lines of the command history. Here, !!=8 includes the 3 lines from the previous history, as well as the 5 lines of session history:

> !!=8
<< p1 := plot(sin,color="DeepPink"):
<< p2 := plot(cos,color="DodgerBlue"):
<< plots[display](p1,p2);
<< y := 1/(x^4+1);
<< int(y,x);
<< diff(%,x);
<< simplify(%);
<< normal(%,expanded);

An argument beginning with a forward slash ("/") refers to all history lines beginning with the most recent one that contains the text entered after the slash (if the text to be searched for does not begin with a space or a digit, the slash can be omitted):

> !!=/diff
<< diff(%,x);
<< simplify(%);
<< normal(%,expanded);

We'll quit Maple and start a new session to illustrate another aspect of the history meta-commands.

> quit
memory used=6.4MB, alloc=41.3MB, time=0.14

In the new session, the meta-command !!=/x^4 will list everyting from the previous session starting from the most recent matching line:

    |\^/|     Maple 2018.1 (X86 64 LINUX)
._|\|   |/|_. Copyright (c) Maplesoft, a division of Waterloo Maple Inc. 2018
 \  MAPLE  /  All rights reserved. Maple is a trademark of
 <____ ____>  Waterloo Maple Inc.
      |       Type ? for help.
> !!=/x^4
<< y := 1/(x^4+1);
<< int(y,x);
<< diff(%,x);
<< simplify(%);
<< normal(%,expanded);

If a !!= meta-command with a numeric or search argument is executed as the first command in a fresh session, not only is the specified amount of command history listed, but that part of the history is then considered to be session history. Executing just !!= with no argument shows that this is the case:

> !!=
<< y := 1/(x^4+1);
<< int(y,x);
<< diff(%,x);
<< simplify(%);
<< normal(%,expanded);

The !!! meta-command (long form !!play) re-executes the entire session history:

> !!!
>> y := 1/(x^4+1);
                                     1
                              y := ------
                                    4
                                   x  + 1

>> int(y,x);
     1/2           1/2             1/2           1/2
1/4 2    arctan(x 2    + 1) + 1/4 2    arctan(x 2    - 1)

                    2      1/2
            1/2    x  + x 2    + 1
     + 1/8 2    ln(---------------)
                    2      1/2
                   x  - x 2    + 1

>> diff(%,x);
          1                       1              1/2
--------------------- + --------------------- + 2
       1/2     2               1/2     2
2 ((x 2    + 1)  + 1)   2 ((x 2    - 1)  + 1)

    /         1/2        2      1/2              1/2 \
    |  2 x + 2         (x  + x 2    + 1) (2 x - 2   )|
    |--------------- - ------------------------------|
    | 2      1/2               2      1/2     2      |
    \x  - x 2    + 1         (x  - x 2    + 1)       /

      2      1/2        /      2      1/2
    (x  - x 2    + 1)  /  (8 (x  + x 2    + 1))
                      /

>> simplify(%);
memory used=5.2MB, alloc=41.3MB, time=0.10
                                 4
                                x  + 1
                 -------------------------------------
                   2      1/2     2     1/2    2     2
                 (x  + x 2    + 1)  (x 2    - x  - 1)

>> normal(%,expanded);
                                   1
                                 ------
                                  4
                                 x  + 1

Notice that each command is displayed with a >> prompt. This prompt is used whenever a command in the history is being played back.

History commands can be played back one step at a time using the !!. (or !!step) meta-command. Each command is displayed with the >> prompt, and you are given the opportunity to edit it before pressing Enter to execute it. Here, we've changed the exponent of from 4 to 3 before pressing Enter, and then pressed Enter four more times to re-execute the remaining commands:

> !!.
>> y := 1/(x^3+1);
                                     1
                              y := ------
                                    3
                                   x  + 1

>> int(y,x);
                                                                  1/2
                          2                 1/2        (2 x - 1) 3
  1/3 ln(x + 1) - 1/6 ln(x  - x + 1) + 1/3 3    arctan(--------------)
                                                             3

>> diff(%,x);
                1          2 x - 1               2
            --------- - -------------- + ------------------
            3 (x + 1)       2              /         2    \
                        6 (x  - x + 1)     |(2 x - 1)     |
                                         3 |---------- + 1|
                                           \    3         /

>> simplify(%);
                                   1
                          --------------------
                                    2
                          (x + 1) (x  - x + 1)

>> normal(%,expanded);
                                   1
                                 ------
                                  3
                                 x  + 1

When editing a command prefixed with the >> prompt, the command is edited in-place in the history. In other words, the history is permanently modified. History meta-commands are not played back (or infinite loops could result), and lines containing only comments are displayed but not offered for editing.

Still in the same session, let's use !!. with a search pattern to generate and display the plots from the older history, pressing Enter after each command:

> !!./p1 :=
>> p1 := plot(sin,color="DeepPink"):
>> p2 := plot(cos,color="DodgerBlue"):
>> plots[display](p1,p2);

                                                                        
                                    |                                   
 -*\    /*-*                      1-+*     *-*\                     /*- 
   \   //  \\                    // |\\   /   \                     /   
    \  /    \\                   /  | \  //    \                   /    
    \ /      *                  *   |  * *     \\                  /    
     **      ||                 |   |  |*       *                 *     
     *|       |                |    |   *       ||               ||     
     ||       ||               |    |  |*        |               |      
    |||        |              |     |  | |       |               |      
    | ||       |              |     | || |        |             ||      
    |  |       ||            || 0.5 | |  |        |             |       
   |   |        |            |      | |   |       |             |       
   |   ||       |            |      |||   |        |           ||       
   |    |       ||           |      ||    |        |           |        
  |     |        |          |       ||     |       |           |        
  |     ||       |          |       ||     |        |         ||        
  |      |       ||         |       |      |        |         |         
 ||      |        |        |        |       |       |         |         
 |       ||       |        |        |       |       ||       ||         
 +--------+-------++-------+-------++-------+--------+-------+--------+ 
  -6      |  -4    |    -2|       0||        |2      |   4   |      6|| 
          ||       |      |        ||        |       ||     ||       |  
           |       |      |       | |        |        |     |        |  
           |        |    ||       | |        ||       |     |       ||  
           |        |    |        | |         |       ||    |       |   
            |       |    |       || |         |        |   |        |   
            |        |  ||       |  |         ||       |   |        |   
            |        |  |      -0.5 |          |       ||  |       |    
             |       |  |       ||  |          |        | |        |    
             |        |||       |   |          ||       | |       ||    
             ||       ||        |   |           |       |*|       |     
              |       **       |    |           |        *        |     
              |*      |*       |    |            |      **|      *      
               \     /*\\     *     |            *\     / *      /      
               \\    /  \    //     |             \    // \\    /       
                \\  //   \   /      |             \\   /   \\  //       
                 *-*/    \*-*    -1 |              \*-*     *-*/        
                                    |                                   
                                                                        

>> !! y := 1/(x^3+1);
> _

On the last line above, we typed !! followed by a space (long form !!stop) to tell Maple to stop playing back commands and give a fresh prompt. If we now issue !!=, we see that the session history still contains only the five commands it contained originally. The played back commands were not appended to the history:

> !!=
<< y := 1/(x^3+1);
<< int(y,x);
<< diff(%,x);
<< simplify(%);
<< normal(%,expanded);

Issuing a new command at the regular > prompt adds it to the end of the session history:

> cos(Pi) + 1;
                                   2

> !!=
<< y := 1/(x^3+1);
<< int(y,x);
<< diff(%,x);
<< simplify(%);
<< normal(%,expanded);
<< sin(Pi) + 1;

The !!- (or !!drop) meta-command deletes one or more commands from the history:

> !!-
> !!=
<< y := 1/(x^3+1);
<< int(y,x);
<< diff(%,x);
<< simplify(%);
<< normal(%,expanded);
> !!-/simpl
> !!=
<< y := 1/(x^3+1);
<< int(y,x);
<< diff(%,x);

In addition to the meta-commands described above for manipulating the history within a session, there are three meta-commands to copy history to and from files:

  • !!> (or !!save ) writes the session history to the specified file.
  • !!< (or !!read ) replaces the session history with the contents of the specified file.
  • !!+ (or !!append ) appends the contents of the specified file to the session history.

Used together, these meta-commands let you save important sessions for later examination or reuse without relying on the .maple_history file, or let you make large changes to the current session history using your favorite text editor.

The !!? (or !!help) meta-command displays a short summary of all the meta-commands:

> !!?

The sequence "!!" at the beginning of a line introduces a history meta-command.
Each has a short or long form (shown below in parentheses). The long form name
may be used instead of the single character appearing after "!!".

!!=specifier    - list session history or specified lines (list)
!!!specifier    - play back session history or specified lines (play)
!!.specifier    - step through session history or specified lines (step)
!!-specifier    - drop one or specified lines from history (drop)
!!<filename     - read file into session history (read)
!!+filename     - append file to session history (append)
!!>filename     - save session history to file (save)
!!?             - help for history meta-commands (help)
!!              - stop the single-step playback in progress (stop)

The 'specifier' is optional. If present, it can be an integer, N, referring to
the N most recent command lines, or a string beginning with a "/" character,
referring to the lines from the most recent one containing that string. The "/"
may be omitted if the search string does not begin with a space or digit.

Detailed information can be found in the ?edit_history help page.

 

Does Maple have a function which finds the domain of its variables such that the function is real valued?

I am only interested in a function of two variables, x and y.  I'd like to know what is the range of x and y, where f(x,y) is real valued.

For example, given f(x,y)= x * ln(y), then the domain is all of x, and for y>0.    So it is the upper half plane.  For f(x,y)=sin(x)*cos(y), then it is the whole plane (all x and all y) and so on. 

I looked at singular(), and this does part of what I want, but it only gives me the singular points. So for the above it gives y=0 and x=x, but I am looking for something a little more specific. I also looked at package called RealDomain, but I do not see how to use this for what I want to do. But I could have missed something.

I do not know what the function is beforehand, but it will always be a function of x and y, and I need an automated way to determine the range of x and y where this function is real valued. 

I can't do plots and look at them, since this is all automated and has to be done algorithmically only and non-interactive.

I could use singular, and try evaluating the function at different points and see if it produces real or complex values, but this is not practial to do and can fail.

Does Maple have support for such functionality?

 

I am still buffled by a Record in Maple.

I simply want to make one variable be a Record. Then make separate variable, by making a COPY of the content of the first variable, then change the second variable. Sounds easy, right?

When I do this, I find that the changes in the second variable are being made also to the first variable.

I used eval() to make a copy of all field of first variable to the second.  May be this is not the correct way, but do not know how else (other by explicit copying one field one at a time).

I looked at help, and see nothing there. It talks about making the Record packed. I tried that, but it is still not working. Not a single example in help of how to copy the "content" of one record to another.

I simply want to make a new instance of the first variable, a copy. and change the second instance without the first changing at same time. Why is this so hard in Maple?

restart;
c:=Record('a','b'):
c:-a:=0:
c:-b:=-1:

c1:=eval(c): #make a copy of c??
print("c1=",eval(c1)); #yes, made a copy

c1:-b:=99:  #change one field  in the second variable

print("c1=",eval(c1));
print("c=",eval(c)); #why did c change?

I tried using Record[packed]('a' , 'b'): since help says something about same Record sharing same memory but that make no difference.

How to make a copy of a record to another in Maple without them being the same? I know I could do this

restart;
c:=Record('a','b'):
c:-a:=0:
c:-b:=-1:

c1:=Record('a','b'):
c1:-a:=c:-a;
c1:-b:=c:-b;

c1:-b:=99:  #change one field  in the second variable

print("c1=",eval(c1));
print("c=",eval(c)); #Now it did not change.

But my actual record has many fields. and I do not want to do the above each time.

hi 

i cant comute the double integrate with infinity integral of my function and just evaluating

The calculation steps are too time consuming and will not be answered

 

Well I also come to think of it, disagree with calling the double factorial function the double factorial function, i would have thought bi-factorial to be better. or singular parity factorial function. 

 

But my interface (2016)  queries me everytime i enter "n!!" as to whether I am referring to the double factorial function or the application of the factorial twice in iteration, ie :  (n!)!

I just think this was a bad decision to make common place and the notation cabal need to review and change this. 

First 27 28 29 30 31 32 33 Last Page 29 of 39