nm

11413 Reputation

20 Badges

13 years, 71 days

MaplePrimes Activity


These are replies submitted by nm

@epostma 

"Unfortunately, this is a known limitation in the current versions of Maple. "

Here we are, 4 years later and this limitation is still there.

This is sad.

Maplesoft is busy making lots of clickable GUI apps that runs on the cloud for high school students but have no time to fix such a basic fundamental  limitation in its product?

Can not put an object module inside another module? This is not important enough to fix?

Clearly Maplesoft is not serious about OOP.  The documentation on OOP is terrible in the help pages and missing so many examples. I guess no time to make examples. 

Will check again in 4 years. And I bet that this problem will still be there.

@Joe Riel 

What were you intending? 

Just trying things. Wanted to see if I can make a copy of the object that way instead of using Object() onb it. When I was dealing with this problem:

https://mapleprimes.com/questions/234356-Passing--The-Object-Itself-To-One-Of

@Joe Riel 

Thanks. That worked. May be future version of Maple will allow one to use overload directly with _self as it is more convenient than having to make separate named proc for each constructor with an extra call for each which might cause an error if one calls the wrong proc when there are many different constructors. But this works for now.

Here is a full example

restart;

person:=module()
    option object;
    local name::string:="";
    local age::integer:=99;

    local constructor_1::static:=proc( _self, proto::person, the_name::string, $ )         
         name:= the_name;
    end proc;

    local constructor_2::static:=proc( _self,proto::person,the_name::string,the_age::integer,$ )
         name:= the_name;
         age:= the_age;
    end proc;

    export ModuleCopy::static:= overload( 
    [
       proc(_self,proto::person,the_name::string,$) option overload;
            constructor_1(_passed);
       end proc,

       proc(_self,proto::person,the_name::string, age::integer,$) option overload;
            constructor_2(_passed);
       end proc
    ]);

end module;


p:=Object(person,"me");
p:=Object(person,"me",20);

                  p := Object<<2950173059488>>
                  p := Object<<2950173046176>>


About what you said:

I assume this occurs because the procedures in the list passed to overload are not exports of the module

But I thought that since the ModuleCopy itself is export, and it overloads the procs, then the procs will be automatically exported? That would be the logical effect. 

Otherwise how does it work in this case (also using overload) if the procs inside overload are not also exported?

restart;
person:=module()
    option object;
    local name::string:="";
    local age::integer:=99;    

    export ModuleCopy::static:= overload( 
    [
       proc(_self,proto::person,the_name::string,$) option overload;
            _self:-name := the_name;
       end proc,

       proc(_self,proto::person,the_name::string, the_age::integer,$) option overload;
            _self:-name := the_name;
            _self:-age := the_age;
       end proc
    ]);

end module;
               person := Object<<2950170753120>>

p:=Object(person,"me");
p:=Object(person,"me",20);

The above works. Only difference is using _self:-name vs. just name

I think the sematics of when to use  _self and when one does not have to use it are still not clear in Maple. At least to me. Documenation are almost non existent on this. Only mention in all the official Maple documentation about _self is just one line. That is all I could find. 

@Joe Riel 

I think I found new bug. Your solution works OK, but it does not work in different setup I tried, different from the one I show above.

Do you prefer I ask new question on it (since it is new setup) or should I ask it here?

@mmcdara 

Obtaining the exact solution, then trying series on it does not always work. It depends on the solution. Here is just one example. I have many more where Maple can't solve since the expansion is around irregular singlular point. 

Order:=6; 
ode:=t*(t-2)^2*diff(diff(y(t),t),t)+t*diff(y(t),t)+y(t) = 0;
expansion_point:=2;
sol:=dsolve(ode,y(t),type='series',t=expansion_point);

No solution. Using series on the exact solution does not work, since Maple can't compute series expansion at singular point t=2

sol:=dsolve(ode,y(t));
series(rhs(sol), t=2)

This needs to be solved directly using asymptotic methods. Maple does not support this now for dsolve.

 

@tomleslie 

You did not read the question carefully. 

I do not have 2 examples. I only have one.

And I have posted the worksheet and a plain text version of it. The link is at the bottom of my post. So I have no idea why you say that I should post the worksheet when it is there.

The first ode you see is a screen shot of the maple help page to show that the syntax using series worked. That was not an example of mine. It is just screen shot of the help page to show that the syntax in help page worked but gives error when I used it.

@C_R 

Thanks for checking. I did not do "import of 2021 preferences" when installing. I prefer to explictly set the preference each time I install new Maple, so I know each time what I am doing and what I did set. 

But I do not see why this should affect things?.

After maple comes up I set the option to use separate engine. Exit Maple. When I start maple again, this setting is gone and now it is back to share the engine. I am sure I am not the only one who see this problem. I am on windows 10. May be Maple is saving the setting to some location different than where it reads it again next time it starts?

Does your windows 10 start menu show "maple 2022 shared server" for the icon like I show in the screen shot? I wonder if this has anything to do with it.

Currently to solve this, I put a big yellow sticky note on the corner of my computer monitor which says to change this setting each time I start Maple so I do not forget.

@acer 

I noticed when I started Maple again, and load one worksheet and start some long computation, then I started a new work sheet, that I am not able to execute any command inside the second worksheet.

i.e. if I do "restart" in the new worksheet, it just sits there. It does not complete and go to next line as normally it would.  

This is becuase the second worksheet is sharing the engine with the first worksheet which is busy running.

So now I have to remember each time I start Maple to set the enginer NOT to be shared. In Maple 2021 I did not have to do this. It remained separate engine each time I start Maple.

@Ronan 

I installed Maple on windows the same way I do it every year. Using the normal user account. That always worked, and this is how I did every year. 

I did not know one needs to install as Admin as it worked without doing this all the time.

Should I uninstall Maple 2022 then and install it again but as admin?

@vv 

no problem. May be someone will have a workaround. 

I just find that a function returning different output/result depending on the order it is called is just the wrong design.

I can understand a function doing something internally to be more efficient using a remember table and or anything else it wants, so that it is runs faster second time, but the final output of any function for the same input should not change depending on the order or when the function was called.

This is what we all learned at school. Maple breaks this rule in this example.

@vv 

OK. So how to make it give the shorter output first time it is called/used? do I need to clear something before calling it? I used infolevel=2 to get the shorter output. The program can't call dsolve twice each time in order to make sure it gets the smaller infolevel output. That will be too inefficient.

@acer 

Thanks but I still get that extra line Typesetting:-mprintslash in my ouput using your updated version.

It is no problem. Since the output now are on each line separated OK by CR, I can read the file back and delete out the lines that has  Typesetting:-mprintslash in them.

This looks like a bug to me but may be specific to windows.

@acer 

I tried your code. I see the newlines are now inserted OK in the file which is good. But there is still that duplicate entry of the solution in the file which does not show in the worksheet.  Here is screen shot of the textfile output_of_dsolve.txt after I open it in a text editor

 

I typed exactly the code you show without any changes and without any typesetting changes. 

@dharr 

On my system (maple 2021.2 windows 10) setting interface(typesetting=standard): shows 

 

   `Typesetting:-mprintslash([sol := y(x) = -cos(x)+_C1], [y(x) = -cos(x)+_C1])

in the text file. So there is still something else that needs to be set to get rid of this Typesetting:-mprintslash ?

 

Do you know when the new version of Maple will be released? 

I hope not before Maple finally fixes its timelimit() command so that it terminates as expected and not hang (or take much longer than expected)

First 32 33 34 35 36 37 38 Last Page 34 of 91