nm

10501 Reputation

19 Badges

12 years, 209 days

MaplePrimes Activity


These are questions asked by nm

I was not expecting odesteps to show steps for this ode, but crash the server each and everytime?

Anyone could find why? I am using Maple 2024.2 on windows 10 with latest Physics. This might indicate serious problem somewhere. Software should not really crash this easily.

interface(version);

`Standard Worksheet Interface, Maple 2024.2, Windows 10, October 29 2024 Build ID 1872373`

Physics:-Version();

`The "Physics Updates" version in the MapleCloud is 1827 and is the same as the version installed in this computer, created 2024, November 13, 9:16 hours Pacific Time.`

libname;

"C:\Users\Owner\maple\toolbox\2024\Physics Updates\lib", "C:\Program Files\Maple 2024\lib"

restart;

ode:=5*(1+t^2)*diff(y(t),t)=4*t*y(t)*(y(t)^3-1);

5*(t^2+1)*(diff(y(t), t)) = 4*t*y(t)*(y(t)^3-1)

dsolve(ode);

y(t) = 1/((t^2+1)^(6/5)*c__1+1)^(1/3), y(t) = -(1/2)/((t^2+1)^(6/5)*c__1+1)^(1/3)-((1/2)*I)*3^(1/2)/((t^2+1)^(6/5)*c__1+1)^(1/3), y(t) = -(1/2)/((t^2+1)^(6/5)*c__1+1)^(1/3)+((1/2)*I)*3^(1/2)/((t^2+1)^(6/5)*c__1+1)^(1/3)

Student:-ODEs:-ODESteps(ode);


 

Download crash_server_nov_18_2024.mw

here is small movie

 

 

I am learning patten matching in Maple. 

Any one could explain why patmatch(1, (x::anything)^(n::'nonunit'(anything)))   gives true but patmatch(2, (x::anything)^n::'nonunit'(anything)); gives false?

interface(version);

`Standard Worksheet Interface, Maple 2024.2, Windows 10, October 29 2024 Build ID 1872373`

restart;

patmatch(1, (x::anything)^(n::'nonunit'(anything)))

true

patmatch(2, (x::anything)^n::'nonunit'(anything));

false

Download patmatch_question_nov_16_2024.mw

I was expecting result similar to using this other software

I do not understand Maple's result. How could I change the patmatch so it does not match 1 to the pattern x::anything^n::anything where n is not 1 ?

Update

To give context, I was trying to write this example from the other software  in Maple:

But when I wrote this

expr:=1 + x^2 + x^4;

F:=proc(X::anything,x::symbol)
    local la,y,n;
    if patmatch(X, (y::anything)^(n::'nonunit'(anything)) ,'la') then  
       f(eval(n,la));
     else
        X;
     fi;
end proc;

map(X->F(X,x), expr);

Maple gave 

So I modified the code now to check for explicit 1,  to avoid this bad match, like this

expr:=1 + x^2 + x^4;

F:=proc(X::anything,x::symbol)
    local la,y,n;
    if patmatch(X, (y::anything)^(n::'nonunit'(anything)) ,'la') then  
        if eval(y,la)=1 then #bug in maple?
           X;
        else
           f(eval(n,la));
        fi;
     else
        X;
     fi;
end proc;

map(X->F(X,x), expr);

And now it gives expected result

Given list L:=[3,4,x,x^2,x^3]; return list of all exponents of x (other than 1). So result should be [2,3]

But this has to be done using patmatch, as this is what I am learning. Not using other means. This is my current code that does this.

restart;
L:=[3,4,x,x^2,x^3];
f:=proc(X::anything,x::symbol)
 local la,n;
 if patmatch(X,x^n::nonunit(anything),'la') then
    assign(la);
    RETURN(n);
 else
    RETURN(NULL);
 fi;
end proc;

map(X->f(X,x),L);

Returns [2,3]

I wanted to shorten it using `if` so that no need to call external function f() as shown. So I wrote

L:=[3,4,x,x^2,x^3];
map(X->`if`( patmatch(X,x^n::anything,'la'),[assign(la), n],NULL),L);

But the problem is that on first entry, the assign(la) now assigns value to and hence it is no longer a name for the next element in the list L. This gives error

Error, (in PatternMatching:-AlgStruct:-Match) first operand of `::' must be a name
So I added  unassign('n') like this

restart;
L:=[3,4,x,x^2,x^3];
map(X->[unassign('n'),`if`( patmatch(X,x^n::nonunit(anything),'la'),[assign(la), n],NULL)][],L);

And now this returns 

            [[2], [3]]

How to make it return [2,3]? Why did it add extra []? How can the above be shortened more? and still return [2,3]

edit: I found how to get rid of the extra [], like this

restart;
L:=[3,4,x,x^2,x^3];
map(X->[unassign('n'),`if`( patmatch(X,x^n::nonunit(anything),'la'),[assign(la), n][],NULL)][],L);

Now it returns [2,3] , needed to add extra [] after each closing [.....]

In another system, the code is 

Cases[{3, 4, x, x^2, x^3}, x^n_ -> n]

    {2, 3}
   

I was trying to make the Maple code as short as possible. I know it will not be as short as the above.

The question is: Can above code be made shorter but still use patmatch?

Again, I am looking for only solution using patmatch. I know I can use select and types in Maple to do this also.

Maple 2024.2

I was watching Maple's video for conference 2024. In one of the presentation, this example is given

But in my Mapple 2024.2 I get an error typing the same command:

interface(version);

`Standard Worksheet Interface, Maple 2024.2, Windows 10, October 29 2024 Build ID 1872373`

restart;

my_ode:={diff(x(t),t$2)-t^2*x(t)=0, x(0)=1,D(x)(0)=1}:
MultivariatePowerSeries:-PowerSeries(my_ode,t,x);

Error, invalid input: too many and/or wrong type of arguments passed to MultivariatePowerSeries:-PowerSeries; first unused argument is t

 

 

Download powerSeries_nov_14_2024.mw

Link to the video is here  it is around 39:00 in time. 

Any one knows why I get an error using same command shown in the video?

I wanted to draw vertical line (as y axis) and add a solid disk at some y location (to indicate some point location). I used plottools:-disk  to make the small disk and used plottools:-line to make the y-axis then used plots:-display to combine them.

All is ok, except the disk is transparent. i.e. I can see the y-axis line below it. Is there a way to make it not transparent? i.e. solid color, so that the y-axis below it do not show?

interface(version);

`Standard Worksheet Interface, Maple 2024.2, Windows 10, October 29 2024 Build ID 1872373`

#plot vertical line
L:=plottools:-line([0,0],[0,3],color="blue"):
c1:=plottools:-disk([0,1],.1,color="red"):
c2:=plottools:-disk([0,2],.1,color="green"):
plots:-display([L,c1,c2],scaling=constrained,axes=none)

 


i.e. 

Download plotools_nov_9_2024.mw

5 6 7 8 9 10 11 Last Page 7 of 191