nm

8552 Reputation

19 Badges

12 years, 346 days

MaplePrimes Activity


These are replies submitted by nm

@Ronan 

Thanks. But I tried RealDomain and it did not work for me. The code is still on my screen. Here it is 

35788

restart;

35788

n:=3;m:=2;
eqx:=x^(n/m)=a;
use RealDomain in PDEtools:-Solve(eqx,x); end use;
F:=map(X->eval(eqx,X),[%]);
map(X->evalb(X),F);

3

2

x^(3/2) = a

x = a^(2/3), x = (1/4)*a^(2/3)*(1+I*3^(1/2))^2, x = (1/4)*a^(2/3)*(I*3^(1/2)-1)^2

[a = a, (1/16)*4^(1/2)*(a^(2/3)*(1+I*3^(1/2))^2)^(3/2) = a, (1/16)*4^(1/2)*(a^(2/3)*(I*3^(1/2)-1)^2)^(3/2) = a]

[true, false, false]

 

Download why_real_domain_does_not_work_for_me.mw

What is the difference between what I did above and what you did for it to have worked with you?

The strange thing, is that in Mathematica by default it works in complex domain. Maple should be the same. But Mathematica gave x=a^(2/3) as only solution without saying real domain.

It looks like when I used solve() with real domain, it works. But when using PDEtools:-Solve with real domain, it does not work!  is this a bug?

@vv 

I know about simplify(size) ofcourse but I stopped using it long time ago. I had mixed results from it. Sometimes it gives worst result than just simplify. Here is just one example out of 100's I have

138396

restart;

138396

A:=int(sin(x)^(1/3),x)

-((3/2)*I)*2^(2/3)*(-I*((exp(I*x))^2-1)/exp(I*x))^(1/3)+(1/2)*(int(-2/(-((exp(I*x))^2-1)^2*exp(I*x))^(1/3), x))*2^(2/3)*(-I*((exp(I*x))^2-1)/exp(I*x))^(1/3)*(-((exp(I*x))^2-1)^2*exp(I*x))^(1/3)/((exp(I*x))^2-1)

MmaTranslator:-Mma:-LeafCount(simplify(A))

66

MmaTranslator:-Mma:-LeafCount(simplify(A,size))

114

You see the simplify size gives result almost twice as large are just simplify in this example !

I understand that simplification is not easy in CAS. I think it is one of the hardest things to get right, but also simplification in CAS is one of the most important core functionalities. So important to get it right.

It is 50% science and 50% art and there is no one algorithm to follow each time as what is simpler can by a fuzzy concept.

I am finding the best thing is to reduce as much calling simplify and its friends or always check after calling simplify to see if the result should be used or not using some more tests. 

Download simplify_size.mw

@vv 

It looks like my method is not general and does not work for all cases. May be a iterative solutions as you have is simpler than trying to find short cut.

@Thomas Richard 

I did not see the check to turn off infinite scroll and neither did the OP. May it should be off by default?

But when I turned it off, how does one go to "next page"? I see no next page arrow any where to click on.

So user can only now see the first page.

Is this by design or is there a trick to go to next page while infinite scroll is off?

https://www.maplesoft.com/Applications/TopApplications.aspx

@sursumCorda 

However, Mathematica by default does not use LeafCount to rank the complexity

But in https://reference.wolfram.com/language/ref/ComplexityFunction.html

"With the default setting ComplexityFunction->Automatic, forms are ranked primarily according to their LeafCount"

Any way. my simple implementation uses LeafCount for now to keep things simple. A more advanced version can accept user defined function to use for comparison.

@sursumCorda 

thanks for the workarounds. I ended up adding simplify on each result in my code after each call to  solve(identity,....

I am testing this now as there many of them in my code.

Luckily, it seems adding simplify gives back same solution as Maple 2023.2.1. At least on the ones I noticed so far.

Something internal in solve(identity... seems to have changed to cause this much bigger result to be generated in Maple 2024.  Result is still correct but much larger than before.

 

Upper case first letter is a bad choice for me. I never use upper case for local variables or module names or function names or anything I make in my code.  This is personal choice.   

If you are worried about name clash for some reason, you can can name all your options names starting with the_

So you will have the_basis  and the_point and the_color and so on.

Another thing I do is to always add the package name when referencing name inside that package. For example write LinearAlgebra:-name instead of loading the linearAlgebra package first, then just use name 

If you do not load package, then its names are not visible. Only by explicitly writing package_name:-name will the package names will be visible. So less chance of name clashing.

@ecterrab 

Thanks for the quick fix.

@ecterrab 

Thank you and thank to Austin for the quick fix.

fyi;

I am seeing this alot in Maple 2024. Twice now in one day.

Unfortunately, like in Maple 2023, it is random where it happens. So can't make MWE. Just wanted to let you know it is still there in Maple 2024 and seems more frequent also.

interface(version)

 Standard Worksheet Interface, Maple 2024.0, Windows 10, March  01 2024 Build ID 1794891

Since that is the only message Maple gives, it is impossible for a user to know what caused it.

Hopefully sometime during this decade Maplesoft will be able to figure what causes it.

@sursumCorda 

" If one really need to interact with Python, one may instruct Maple to make use of some available local version of Python from the outset (rather than having to install an additional Python interpreter with numerous extra packages that occupy almost 2 GB!),"

This would not really be a good idea. Same for Java.

The reason is clear.

Maplesoft tested and verified things internally using say version X.n,m of Python.

So it ships Maple with this version of python included in the installation itself. If Maplesoft did not do this, how would it know that the Python you have installed on your PC will work with the Maple being installed?

Even if the installation asks and verifies the python version installed on the system is the same as the one that was used internally by Maplesoft, what guarantees are there that the user will not later change or even remove their own Python installation to some different version that makes Maple no longer work?

I do not know why Maple needs python actually, but you said that it uses it for some things. This is the first time I learn that Maple ships with Python and installs Python as part of its installation.

Python dependency management is also known to be very fragile and a big mess. So a small change can break things.

I did not know that Maple uses python and installs it own python. But if Maple does use Python internally for some things, it makes complete sense for Maplesoft to install its own Python and not use or depend on an external system level one.  

Do you know since which version Maple started using Python? I know Maple uses Java ofcourse but did not know it also needs Python to run.

@Kitonum 

You seem have a bug

            IsSameOrder([7,2,4],[7,4,2,7,2,4])
                           false

but it should be true, since 7,2,4 do show in same order. This is how I understood it. May be your implementation made assumptions different.

@Carl Love 

 it makes no sense to say that x has type integer if x is an unassigned variable. 

Humm. For years I've been writing things like

local n::integer;

in my procs. i.e. define n to be variable of type integer before making assignment.

Isn't the above what it means? 

I do that for all my variables. Try to give them the type that they will have and used for.

Because this way if a wrong type value assigned to it at run time, Maple will catch the error.

``

kernelopts('assertlevel'=2):
foo :=proc(m)
local n::integer;
      n:=m;
end proc;

proc (m) local n::integer; n := m end proc

foo(3)

3

foo(3.0)

Error, (in foo) assertion failed in assignment to n, expected integer, got 3.0

 

 

Did I not just do what you said makes no sense? Is not the code above saying that has type integer before it is assigned?

Download t2.mw

I never really understood this part of Maple well. Why have things called properties and things called types. Do you know?

I think this is a bad design in Maple.

Everything should just be just a type. Having types and properties makes the language confusing to say the least. It is hard enough to learn Maple type system and use it right,. now one has to learn properties also.

But my understanding is that assume facility when it sees "real" it takes it as property and allows ::. But outside of the assume facility  if you use ::real like you did, it is viewed as type and hence the error since there is no type called real in Maple. 

So it all depends on the context being used.

Anything in the assume (is belongs to it) when it sees real it understand it as property and will let you use it with ::.

May be some maple expert could explain why is everything not part of the type system as in https://www.maplesoft.com/support/help/maple/view.aspx?path=type#bkmrk1

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