Venkat Subramanian

386 Reputation

13 Badges

15 years, 242 days

MaplePrimes Activity


These are replies submitted by

@ Robert Israel 

If I unassign sol after saving it to .m file and then call the .m file and use sol without using restart command, this works.

But this beats the purpose. This means that one cannot save the solution for future use when compile=true is used. I have a feeling that module, moduleapply or package or something similar which will store all the local variables, procedures,files during the compiling process might help.

restart;eq1:=diff(y(t),t)=-k1*y(t)-z(t)^2;

                         d                        2
                  eq1 := -- y(t) = -k1 y(t) - z(t)
                         dt

> eq2:=diff(z(t),t)=y(t)*k1+z(t)^2-k2*z(t);

                     d                       2
              eq2 := -- z(t) = k1 y(t) + z(t)  - k2 z(t)
                     dt

> sol:=dsolve({eq1,eq2,y(0)=1,z(0)=0},type=numeric,compile=true,'parameters'=[k1,k2],stop_cond=[y(t)-0.5],stiff=true,implicit=true):

> save sol, "dsolvesol.m";
> sol:='sol':
> #restart;
> sol(1);

                                sol(1)

> read("dsolvesol.m");
> sol('parameters'=[1,1]):
> sol(1);
Warning, cannot evaluate the solution further right of .63313380, event #1 triggered a halt


  [t = 0.633133804626753, y(t) = 0.500000000000000,

        z(t) = 0.361834982920762]
 

@Robert Israel 

This is a great strategy for parameters (as opposed to using savelib).

compile=true is still not working. 

@Robert Israel 

Robert, Thanks. If you hard code k1 =1 and k 2= 1. Create sol with compile =true, and proceed. It still won't work and will likely crash the maple code.

 

@Robert Israel 

Sorry for bringing this discussion back again. The command given does not work with compile=true and with unknown parameters. 

Anyone up for a challenge to fix this? If not, SCR should be submitted? Note that savelib route enables the use of parameters (not stable), but not compile=true.

 

Thanks

Dr. Venkat Subramanian


 

restart;

eq1:=diff(y(t),t)=-k1*y(t)-z(t)^2;

eq1 := diff(y(t), t) = -k1*y(t)-z(t)^2

(1)

eq2:=diff(z(t),t)=k1*y(t)+z(t)^2-k2*z(t);

eq2 := diff(z(t), t) = k1*y(t)+z(t)^2-k2*z(t)

(2)

sol:=dsolve({eq1,eq2,y(0)=1,z(0)=0},type=numeric,'stop_cond'=[y(t)-0.5],'parameters'=[k1,k2],compile=true,stiff=true,implicit=true):

save sol, "dsolvesol.mpl";

restart;

read("dsolvesol.mpl"):

sol('parameters'=[1,1]);

[k1 = 1., k2 = 1.]

(3)

sol(1);

Error, (in sol) parameters must be initialized before solution can be computed

 

 


 

Download Savedsolvecompileandpars.mws

@MapleMathMatt 

Does this work in classic worksheet mode for you? I have had no luck to make this work in lenova yoga windows 10 (unfortunately the laptop won't work with windows 7).

 

 

@Thomas Richard 

Thomas, Regular version of Maple (mw) works for me in windows 10, but classic worksheet cannot be used (any version). When I open it, it either disappears immediately or whenever I try to save it anywhere. Is it possible to fix this? I will be willing to call and work with any of your staff and explain the process over webex of a video conference using a different computer.

 

Thanks

Dr. Venkat Subramanian

Dr. Pepper,

I look forward to getting the book.

Few questions.

Does the book discuss and provide algebraic equations for weak form of FEM for any arbitrary PDE or set of PDEs in more than 1D using Maple?

Does the book include nonlinear problems? If so, are you using Maple's fsolve ?

Does the book deal with convection (for example steadystate NS in 2D in primitive form) and comparison of methods for the same?

Thanks

Venkat Subramanian

PS., I can see the outline of the chapters online, but my questions relate to the codes provided in Maple for the topics mentioned in this reply. Thanks.

 

I haven't used the new formats of Maple. I still use *.mws and for running RAM intensive codes run the same in 64 bit mw format.

I agree with Preben. Maple is sometimes unstable, in particular in mws format. 

For Tom and Chris, if you don't believe the stability issue solve more than 2 nonlinear ODEs and store the solution as

sol:=dsolve({sys}.....,numeric);

end it with a semicolon. Run this any mws format from Maple 14 onwards and let me know if it doesn't crash. Stability has become a serious issue for mws format after Maple 13.

Preben's suggestion is good. Another suggestion I have is to use older versions of Maple if you prefer the classic worksheet (mws mode).

 

(For example, I use Maple 8 or 13 or 14). There have been improvements in Linear Solver (although Maple 14 sparseDirect seems to be more robust compared to Maple 2017. But Maple2017 is much faster for most linear systems). But most commands are the same. I prefer using a semicolon after every line to make sure I am not making a mistake. In addition, older versions of mws are very efficient for typing and editing (very fast just like typing in a text file). Once the code is ready and it works, then I run in Maple 2017 or newer versions. It is really sad and inefficient. But to me, this is faster than trying to type or edit in mw formats.

PS, in my experience when mws format crashes, the file size will be reduced.

 

I will test and update. Do you know if the new version of Maplesim enables easy use of Maplesim's DAE solver from Maple without having to create a dummy object in maplesim?

thanks

 

@ChrisRackauckas.

Typically, when I am wrong, I accept and correct the mistake.  

Despite my confirmative proof on RADAU, "you are only inclined to agree with me", perhaps this is a generation gap, and the younger genration is trained to always sound positive and confident despite making errors. RADAU should be ranked higher for implicit DAEs and ODEs as proved by me. If you refuse to do that, I may just be wasting time. Unlike your blog's title, most of the analysis and research outcomes for non-stochastic differential equations are deterministic, it is a simple yes or no.

You are very knowledgable in what you do in Julia/linearalgebra and you perhaps know much more than what I knew as a graduate student. Your skillsets are awesome and you are and will be in huge demand, but I have to still conclude that your current ranking is arbitrary.

If you want me to add to this, post an editable chart or document, I will add my rebuttal and ranking for each entry in the table for MATLAB, desolve, Hairer, Maple and Mathematica with detailed input and examples, and we can continue this interesting discussion.

 

@ChrisRackauckas 

I still see some factual errors in the table and the discussion/claims you make, but I will stop now. It may be more efficient for me to wait till you revise the table based on your analysis and feedback from others and then summarize everything in one thread/post. I will do so when time permits.

 

Cheers!

 

@ChrisRackauckas 

Hope I am not being overly critical and obnoxious. I admire your efforts in Julia. Your blog got my attention thanks to my research scientist Chintan Pathak. I am not a Maple developer, just a long-time user with my own long list of complaints about the same.  My aim as a professor is to insist on accuracy and make sure people are not misguided. For example, I have lost a lot of my time trying to use algorithms on different platforms. If the methods don't work, then fine. But if they are poorly implemented, it is not the algorithm's fault.

PS, if you have time and bandwidth, it will be super cool to collaborate on a research/educational article on this topic with detailed examples that I can provide.

@ChrisRackauckas 

For your ODE model use y1' = z1 and y2'=z2 now you have a system of DAEs with 2 ODEs and 2 AEs trivially solved using RADAU.

This adds to my concern! 

Also, you gave FAIR for Mathematica's ODE solver efficiency. I am not very knowledgeable in Mathematica, but I have used its numeric differential equation solver where it calls IDA and it works just fine and perhaps better than MATLAB

 

@ChrisRackauckas 

Please see the paper by Hairer.

Stiff differential equations solved by Radau methods

 

 

Any implicit ODE/DAE of the form F(y',y) = 0 can be converted to the form used by RADAU.

Show me an example of where this doesn't apply. May be I am missing something.

 

@Preben Alsholm 

Another reason dsolve/numeric ends up taking a lot of RAM may be due to the fact that it does a single or a small number of Newton iterations? I am just guessing based on the implemention for LSODE, etc for IVP solvers. Folks who are more knowledgable can confirm.

As opposed to IVPs, for BVPs, this may not be a bad a strategy in particular when used with a continuation strategy.

4 5 6 7 8 9 10 Last Page 6 of 17