nm

11353 Reputation

20 Badges

13 years, 8 days

MaplePrimes Activity


These are replies submitted by nm

@janhardo 

Not sure I understand the question. If you mean how to ask Maple for implicit solution to an ode, then the option 'implicit' is used for this.

And to prevent Maple dsolve from evaluating integrals internally while it is solving an ode, the option 'useInt' is used.

@Kitonum 

I understand all that about expand.

The issue is this is done in code. Not looking at screen.

So code has to keep trying different things and then pick the smallest (in leaf count) obtained. That is why I wrote the above full_simplify() command.

My point is that simplify() should just have worked here.  One does not have to use tricks or try 100 different combinations of commands to obtain simpler result.

Simplify is the most important core command in any CAS system. And Maple is supposed to be the most powerful symbolic CAS there is. Yet, I find it is always a struggle to obtain simpler result using just the simplify command.

Maple needs a new full_simplify() command, where it tries much much harder so users do not have to resort to tricks and different options hoping to get simpler result.

@Kitonum 

Ok, will add expand to the list I have to try. 

But any idea why simplify did not do it? Given that B is "simpler" in the sense it is smaller in size. (and also more clear to read).

@Scot Gould 

There seems to be something not setup right on your Maple? I just now did the command and worked fine

@vv 

But if there is no algorithm, how would you suggest the other software did it? (hard to trace what the other software does internally).

@janhardo 

Thanks, but on Maple 2025 I do not get what you show

It looks then this is regression in Maple and you must be using earlier version. Should then this be considered a regression bug?

 

@Scot Gould 

But, 50 years after the arrival of WYSIWYG, I strongly suspect Knuth doesn't believe we should still have to write hieroglyphics to obtain good mathematical symbols. 

Nothing will replace Latex/Tex for another 100  years. Try to submit a paper as a Maple document and see what happens.

Same for Mathematica notebooks. No one will accept these. These have to be converted to Latex.

People have been saying this about Latex for the last 30 years and it is now more in use than ever.

But Maple generates good Latex. So all what one needs to do is simply use that Latex, export it to file, and make Latex document of it at the end. Then compile it to PDF and HTML also if needed.

PDF is the universal document format for exchange between people. Not Maple and not notebooks  and not word documents or anything else. Anyone can open a PDF document, even browsers can read PDF document, but not everyone can open a Maple document as not everyone has Maple. 

One needs to know little Latex but not much. This is what I do. Everything I generate from Maple is Latex. Writing everything to file. I just have to add the surrounding text and all the the math env. to put the latex in (such as align or such). Maple does all the hard work in converting the equations to Latex. 

For manual writing, (For example,  making HW or school report or paper) there are two solutions to avoid writing in Latex and still at same time get Latex as output. There is a program called Lyx   

LyX combines the power and flexibility of TeX/LaTeX with the ease of use of a graphical interface.

 

More screen shots are at the above link. You can then export the document to Latex., compile it to PDF and also to HTML using tex4ht. Many people write their Phd thesis in Lyx. So it must be good. I tried it and it is good. I use SW 5.5 myself only because I am more used to it and been using it for long time.

Another, which is what I use, is scientific word 5.5. Unforuntually this program is no longer available for sale since the original US based company closed few years ago, but there is UK company that still sells it. You get 30 days trial. Make sure to use 5.5 and not 6.0 version. Here is link   Version 5.5 is much better. All GUI, then simply save the document and you have you latex file there.

SW 5.5 is what I use for all my math writing. I use SW 5.5 much more than Maple and Mathematica and any other program combined. Without it, I am lost :). It is the first program I install when I move to new PC. 

I can still write direct Latex if I want, but I agree, GUI is much easier and faster and more fun. There are hard core Latex users at tex stackexchange who say one should not even use a GUI that generates Latex and must write all the Latex by hand. I am not one of those.

It is also much much better than anything word or indesign can provide for math articles, or even without math, since nothing beats Latex for typesetting. I also think Tikz is very good, and you need Latex, but getting good at Tikz takes more time than even Latex.

Try making a 5,000 pages PDF book full of math using Word document or Maple. Good luck with that.

@salim-barzani 

when we solve by Dsolve option he just give us 1 solution and no more

I am not sure I understand what are you asking. dsolve picks a method to solve the ode, and returns the solution(s) found. Ofcourse an ode could be solved by many different methods (depending on the ode). But Maple only solves it using one method. Once it finds a method that can solve it, it does not solve it again using other methods.  If you set infolevel[dsolve]:=5; then you will see what methods it tries until it finds one.

Is this what you mean by one solution and no more? 

 i am looking for generate series solution but i need to watch what exactly they did and how find out 

Do you mean you want to see step by step how the series solution for an ode was found?

 

@Carl Love 

I am not sure I follow what you mean when you say "when the low-order terms are already an exact representation of the function". May be you mean if there is only one term in the solution, then big O are not shown. 

But ok, I take it then this is just a Maple own convention. 

Using sympy, it does give the big O notation in the solution for the same problem.

>python
Python 3.13.2 (main, Feb  5 2025, 08:05:21) [GCC 14.2.1 20250128] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from sympy import * 
... x = symbols("x") 
... y = Function("y") 
... 
>>> ode = Eq(Derivative(y(x), x)+ y(x), 1+ x) 
>>> ics = {y(0):0}
>>> dsolve(ode,func=y(x),ics=ics,hint="1st_power_series",x0=0,n=6)

And it gives

Eq(y(x), x + O(x**6))

Maple solution is ofcourse correct, but I was expecting to see big O at the end of each series solution as always is the case except here and so was surprised when I saw this and thought it was a bug.

@aroche 

I do not know why these recursion error showed up. But I am now running V 15 of support tools, and these no longer show. I can't reproduce these.

So only issue is the integration question I had. You could ignore these errors. I had no idea what caused them now. 

Here is updated worksheet.

Thanks.

interface(version);

`Standard Worksheet Interface, Maple 2025.0, Linux, March 24 2025 Build ID 1909157`

Physics:-Version();

`The "Physics Updates" version in the MapleCloud is 1862 and is the same as the version installed in this computer, created 2025, April 25, 10:33 hours Pacific Time.`

SupportTools:-Version();

`The Customer Support Updates version in the MapleCloud is 15 and is the same as the version installed in this computer, created April 27, 2025, 23:18 hours Eastern Time.`

restart;

integrand_1:=x^2*(-arctan(x) + x)*exp(-arctan(x) + x)/(x^2 + 1);

x^2*(-arctan(x)+x)*exp(-arctan(x)+x)/(x^2+1)

integrand_2:=evala(integrand_1);

-x^2*(arctan(x)-x)*exp(-arctan(x)+x)/(x^2+1)

simplify(integrand_1 - integrand_2)

0

anti_1:=int(integrand_1,x);

(-arctan(x)+x)*exp(-arctan(x)+x)-exp(-arctan(x)+x)

anti_2:=int(integrand_2,x);

-(1-x+((1/2)*I)*ln(1-I*x)-((1/2)*I)*ln(1+I*x))*(1-I*x)^(-(1/2)*I)*(1+I*x)^((1/2)*I)*exp(x)

simplify(diff(anti_1,x)-integrand_1);

0

simplify(diff(anti_2,x)-integrand_2);

-exp(x)*x^2*((I*ln(1-I*x)-I*ln(1+I*x)-2*x)*(1-I*x)^(-(1/2)*I)*(1+I*x)^((1/2)*I)+2*exp(-arctan(x))*(-arctan(x)+x))/(2*x^2+2)

simplify(anti_1 - anti_2)

(1/2)*exp(x)*((1-I*x)^(-(1/2)*I)*(1+I*x)^((1/2)*I)*(I*ln(1-I*x)-I*ln(1+I*x)-2*x+2)+2*(-arctan(x)+x-1)*exp(-arctan(x)))

simplify(anti_2);

-(1/2)*(I*ln(1-I*x)-I*ln(1+I*x)-2*x+2)*(1-I*x)^(-(1/2)*I)*(1+I*x)^((1/2)*I)*exp(x)

simplify(anti_2,ln);

-(1/2)*(I*ln(1-I*x)-I*ln(1+I*x)-2*x+2)*(1-I*x)^(-(1/2)*I)*(1+I*x)^((1/2)*I)*exp(x)

 

 

Download int_strange_result_april_27_2025.mw

@Christopher2222 

oh I think SupportTools:-Version(latest) might work 

yes it does. This is what I do to get latest versions of SupportTools, like with Physics update

fyi, Maplesoft have published similar document in 2015  

HowMapleComparestoMathematica.pdf

I have not seen an update to the above since 2015.  There was some interesting discussions about the above document at understanding-differences-between-maple-and-mathematica-in-examples-picked-by-ma

But discussing Maple at Mathematica forum will be biased towards Mathematica, and similarly,  discussing Mathematica at a Maple forum will be biased towards Maple. 

wrong forum. Try https://tex.stackexchange.com/

@acer 

yes! thanks for this workaround. This saves me lots of time having to scan over messages that A is not declared. Since I use  this all over the place. All my objects I use are defined in the top module and all child modules use A:- to access them. As I said in comment below, it is only when using A:- inside Object(....) does mint issue this message. Using A:- everywhere else, this message do not show up.

Now the message 

These names were used as global names but were not declared:  A

no longer shows. This way I can only see real cases where the name is really not declared.

Good workaround. I will have to test it in my real code. I assume it will still work as before ofcourse. I see no reason why it will not. 

For any future reader. I found that any where, where A:- is used as argument to function, or as argument to if this problem shows in mint. For example

Object(A:-....)
timelimit(A:-time_limit_value,.....)
if A:-flag_set then ....
etc...

When using A:- not inside argument or not as argument to if then mint do not give the message. For example, this does not issue any message   local o::A:-some_name;  or normal use as in A:-foo()

So I just replaced the above  by

Object('A':-....)
timelimit('A':-time_limit_value,.....)
if 'A':-flag_set then ....
etc...

And all these mint message as gone. This make it much easier to now see real issues with using name not declared using mint.

I do not know why mint does this, as it clearly should see that the name A is declared above. But this workaround is easy to do, so issue closed for me.

Here is a MWE showing the problem again using if

A:=module()
    export my_flag::truefalse:=false;

    export B := module()    
       export foo := proc()
            if A:-my_flag then 
                print("flag is on");
            else
                print("flag is off");
            fi;       
       end proc;

    end module;
end module;

Calling mint on the above gives

Nested Procedure foo() on lines 5 to 11
 These names were used as global names but were not declared:  A

Changing A:- to 'A':- the mint message is gone. mint needs to be improved.

Thanks to all the help from everyone.

@Carl Love 

My point is that mint should see that "A" is declared. It is after all the name of the module which B module is inside.

The whole point of mint is to alert the user about issues. I search for "These names were used as global names" to look for variables I forgot to declare. I keep seeing these false ones, which makes finding real ones hard since the output of mint is very long and I waste lost of time skipping over these message to find ones with real problem. i.e. using a name not actually declared, such as a name inside a proc I forgot to declare local.

                     it is up to you to decide whether A has been used appropriately. 

Ok, so you are saying a user has to go over 1,000's of these messages and keep saying, yes, this variable is declared, yes, this variable is declared, ,yes, this variable is declared, ,yes, this variable is declared, ...   and so on.   What is then the point of using mint in this case.

I would expect Maple, which is supposed to be more strongly typed system to see that A is declared in this example.

Note also this hapens ONLY when using Object(A:-the_name);  If I remove this, then mint does not issue such a message at all, even though I am using A:- everywhere else.

A:=module()

    export module foo_type()
       option object;
       export name::string:="";
    end module;

    export B := module()    
       export step := proc()::A:-foo_type;                 
       local o::A:-foo_type;   
          1;
       end proc;

    end module;
end module;

And now mint command gives

>/home/me/maple2025/bin.X86_64_LINUX/mint A.mpl
    |\^/|      Maple 2025 Diagnostic Program
._|\|   |/|_.  Copyright (c) Maplesoft, a division of Waterloo Maple Inc. 2025
 \  MINT   /   All rights reserved. Maple is a trademark of
 <____ ____>   Waterloo Maple Inc.
      |        
Nested Procedure step() on lines 10 to 16
  These local variables were never used:  o::A:-foo_type
Module A() on lines 1 to 19
  These exported variables were never used:  foo_type
>

You see, the message 

These names were used as global names but were not declared:  A

No longer shows even though I am still using A:- in the B module. This makes no sense.

And why is Maplemint not showing this same message? I do not use maplemint, just showed it here to show the difference.

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