nm

8552 Reputation

19 Badges

12 years, 347 days

MaplePrimes Activity


These are replies submitted by nm

@Kitonum 

THanks. I was trying permute for 20 minutes. But was typing something like combinat:-permute([1,-1],4); and this returns [].  I did not know the trick 

[1$n,-1$n]

if you are using []  for making nice math notation (subscripts), why not use __ instead? I think __ is better than using index for making subscripts. I myself use indexed variables for making a variable of type table() with numerical intger index. Not for making subscripts.

restart;
eq3__130:= Psi__fd = L__ffd * i__fd + L__f1d * i__1d -L__ad * i__d;

I do not know why maple puts 1.0 there for  the index as I do not use index for notation, I use __ instead.

@Joe Riel 

"Full disclosure, I also rarely use the builtin debugger, instead relying on an Emacs-based version with a better interface."

I use the builtin debugger but the interface us hard to use. I am not sure I understand what you mean by the above. Do you mean if one uses Maple in emacs, the debugger can still be used but the interface is no longer a line based interface as it is with the builtin version? 

Do you have screen shots of how the debugger interface looks like using emacs editor?  In this case I will switch to emacs just to use the debugger from it.  Will this work on windows or does one need to run Maple on Linux?  Is there a web site that explains how to set this up as that would be useful.

@Thomas Richard 

normal(w,expanded) does not always work as expected. Here is an example, where now only the simplify(evalc(w)) give me the desired output. 

Here is an example

w := 4*sqrt(3)*sqrt(2 + 30*I*sqrt(3))/(3*(-1 + sqrt(3)*I)*(sqrt(3)*I - 2*x - 1)) + 4*sqrt(3)*sqrt(2 - 30*I*sqrt(3))/(3*(1 + sqrt(3)*I)*(sqrt(3)*I + 2*x + 1));

(4/3)*3^(1/2)*(2+(30*I)*3^(1/2))^(1/2)/((-1+I*3^(1/2))*(I*3^(1/2)-2*x-1))+(4/3)*3^(1/2)*(2-(30*I)*3^(1/2))^(1/2)/((1+I*3^(1/2))*(I*3^(1/2)+2*x+1))

normal(w,expanded);

((3*I)*(2+(30*I)*3^(1/2))^(1/2)*x-(3*I)*(2-(30*I)*3^(1/2))^(1/2)*x+(3*I)*(2+(30*I)*3^(1/2))^(1/2)-(3*I)*(2-(30*I)*3^(1/2))^(1/2)+3^(1/2)*(2+(30*I)*3^(1/2))^(1/2)*x+3^(1/2)*(2-(30*I)*3^(1/2))^(1/2)*x-3^(1/2)*(2+(30*I)*3^(1/2))^(1/2)-3^(1/2)*(2-(30*I)*3^(1/2))^(1/2))/(6*x^2+6*x+6)

simplify(expand(numer(w))/expand(denom(w)));

(-(3*I)*x*3^(1/2)+I*x*(2+(30*I)*3^(1/2))^(1/2)+x-16)/(2*x^2+2*x+2)

simplify(evalc(w))

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

simplify(w);

(8*x+32)/((I*3^(1/2)-2*x-1)*(I*3^(1/2)+2*x+1))

simplify(w,size);

(4/3)*3^(1/2)*(2+(30*I)*3^(1/2))^(1/2)/((-1+I*3^(1/2))*(I*3^(1/2)-2*x-1))+(4/3)*3^(1/2)*(2-(30*I)*3^(1/2))^(1/2)/((1+I*3^(1/2))*(I*3^(1/2)+2*x+1))

 


For comparison, I wanted to see how Mathematica will handle this. Simplify did not do it this time, but FullSimplify did it.

Download complex_2.mw

It is always tricky figuring the correct command to simplify something each time.

@vv 

If you look at the function step3 in the paper (starting at page 66) where this `@W`(var) is used, you will see there is no procedure `@W` anywhere to be seen. I did not see anywhere in the list a proc with name W.

That is why I asked. Could it be some built-in function that was defined in Maple 3?

@Carl Love 

thanks, that worked. I did not think of trying that, since it says one needs to use static on function objects. But I think it worked here since this function is special case, it overrieds the base class. Same for removing external. 

I would really have expected Maple to give this error, without the need to set 

interface(warnlevel=4);
kernelopts('assertlevel'=2):

@Carl Love 

FYI, I found a problem with your solution. When adding 

interface(warnlevel=4);
kernelopts('assertlevel'=2):

Now Maple gives an error 

Error, (in anonymous module) type `static` does not exist
I could not find a solution around this myself. I need to keep interface(warnlevel=4); and kernelopts('assertlevel'=2): and can't remove these a they help catch problems in the code. 

Without the ability to do extension and overriding behavior of base class, then there is no polymorphism. Without polymorphism there is no OO. So I do not know why Maplesoft calls this OOP in its documenation. Everything else except for polymorphism can be done just as easily using standard modules and structured programming.  

 

interface(version)

`Standard Worksheet Interface, Maple 2021.2, Windows 10, November 23 2021 Build ID 1576349`

Physics:-Version()

`The "Physics Updates" version in the MapleCloud is 1123. The version installed in this computer is 1122 created 2021, December 22, 16:3 hours Pacific Time, found in the directory C:\Users\me\maple\toolbox\2021\Physics Updates\lib\`

restart;

interface(warnlevel=4);
kernelopts('assertlevel'=2):

 animal:= module()
option object;
export
    data1,
    move::static:= proc(_self, $)
        print("In Animal class. moving ....")
    end proc
;
end module;
 
#create class/module which extends the above
dog:= module()
option object(animal);
    move::static:= proc(_self, $)
        print("In dog class. moving ....")
    end proc  
end module;

3

_m2321929286240

Error, (in anonymous module) type `static` does not exist

 

Download OOP_error_12_29_2021.mw

@Preben Alsholm 

That is a good example.

I will try to summarize things to make sure I understood it: in simplify(expr, assume=[...])  the expression is evaluated first, then simplify only now use the assumptions on the evaluated expression to simplify it.  But in  simplify(expr) assuming .... , simplifes sees the assumptions early on before evaluating the expression. This can effect the result of simplify.

I think what I want is the first version above. I have to go change my code and change all the  simplify(expr) assuming ....  to simplify(expr, assume=[...])  and run full tests again and hopefully this will not break anything.

If the expression does not need evaluating (as your example), now both give same output

restart;
simplify(sqrt(a^2), assume=[a<0]);
simplify(sqrt(a^2)) assuming a<0;

both give -a. 

@Preben Alsholm 

I changed my code to avoid the change of variable in Int as I was doing it and the issue went away. I thougth using Inert int freezes the integral while I manipulate its content before changing it back to non Inert. 

But my main point, is, since content of Int is wrong, then why simplify(expr,size) do not give an error while simplify(expr) did?.

One would expect both to give an error in this case. 

@Carl Love 

I don't see any possibility of assume= anything being used as the 3rd argument.

Well, when it says

Is it too much of a jump to the assumption that last agument will be the third one in the case of  using size in simplify as in simplify(eq,size,assume=.....)   ? 

As for assume=positive  vs. assume=x::positive I had no idea this will make a difference. When I saw assume=positive, I assumed one can also write assume=x::positive. This is in case the expression has more than one symbol and want to tell it that only x is positive. 

If there is a subtle difference, may be help should be more clear on this and provide more examples for normal users.  

" even simplify(eq) returns an error"  

True. I just saw that. But then in this case, one would expect that  simplify(eq,size)  to also give an error, but it does not.

@Carl Love 

Yes ofcourse., I know it is timelimit(). I made typo. dsolve hangs without timelimit, so I wrote this quick test and made typo and wrote timeout instead of timelimit.

The main issue is that dsolve hangs. But I can work around it now, since I can add timelimit().

dsolve() typically returns implicit solution on its own when it can't solve for y(x) explicitly. May be it was trying to do this and that is why it hangs on this problem.

@tomleslie 

I know this transformation. This is Liouville Transformation on the dependent variable. I am looking for the transformation on the independent variable. From page 177, Theory of differential equations in engineering and mechanics / by K.T. Chau.

The above can be done by Maple

restart;
ode:= diff(w(z), z$2)+f(z)*diff(w(z),z)+g(z)*w(z)=0;
new_ode:=PDEtools:-dchange({w(z)=W(z)*exp(-1/2*int(f(z),z))},ode,{W}):
simplify(%)

 

Which gives the result in the book and what you show also (after canceling the exponential since not zero).

The transformation I am looking for is different. It is on the independent variable. Not the dependent variable.

@Carl Love 

Thanks Carl. Your method works well also. For checking for isobaric function case. (slight modification makes it also check for homogenous ode).

The bottom line is that the above is for checking if f(x,y) is isobaric. For an ode of the form y'=f(x,y), it is isobaric ode if there exist numerical solution p for f(x,y). 

Now your method and vv's give same result and both are correct results. I can now use both methods. If one fails for some reason, will try the second next. If both do not solve for numerical value of p, then most likely the ode is not isobaric.

restart:
f:= [
    (x,y)->-(y^2+2/x)/(2*y*x),
    (x,y)-> x*sqrt(x^4+4*y)-x^3,
    (x,y)-> (3*x+y^3)*y/(x*(x-y^3))
]:
map(f-> (solve(identity(f(a*x,a^p*y)=a^(p-1)*f(x,y), a), {p}) assuming a>0),f);

 

Q:=proc(F,x,y)   
    local eq,sol,t,p;
    eq:=eval(F,[x=t*x,y=t^p*y]) = t^(p-1)*F; 
    sol:=limit(diff(eq, t), t=1): 
    return simplify(solve(sol, p));     
end proc;
map(F->(Q(F(x,y),x,y)),f)

 

@vv 

I was working now on documenting my code and I just realized I do not know how to proof this result you show for this:

Could you please show how you obtained (2) or a reference to it? I do not see how (1) implies (2) even though it works when there exists such p.

@Joe Riel 

Yes, use Maple standard GUI, worksheet mode. It is very easy to reproduce as you can see above. Were you able to reproduce it on standard worksheet also?  

I ended up losing work on the worksheet, because even though I did SAVE FILE (while it was hanged), many times, and I thought it saved the worksheet, but when I had to terminate Maple and restarted, found that it did not actually save the worksheet as expected.

First 13 14 15 16 17 18 19 Last Page 15 of 71