Product Tips & Techniques

Tips and Tricks on how to get the most about Maple and MapleSim

A wealth of knowledge is on display in MaplePrimes as our contributors share their expertise and step up to answer others’ queries. This post picks out one such response and further elucidates the answers to the posted question. I hope these explanations appeal to those of our readers who might not be familiar with the techniques embedded in the original responses.

Before I begin, a quick note that the content below was primarily created by one of our summer interns, Pia, with guidance and advice from me.

The Question: Source Code of Math Apps

Eberch, a new Maple user, was interested in learning how to build his own Math Apps by looking at the source code of some of the already existing Math Apps that Maple offers.

Acer helpfully suggested that he look into the Startup Code of a Math App, in order to see definitions of procedures, modules, etc. He also recommended Eberch take a look at the “action code” that most of the Math Apps have which consist of function calls to procedures or modules defined in the Startup Code. The Startup Code can be accessed from the Edit menu. The function calls can be seen by right-clicking on the relevant component and selecting Edit Click Action.

Acer’s answer is correct and helpful. But for those just learning Maple, I wanted to provide some additional explanation.

Let’s talk more about building your own Math Apps

Building your own Math Apps can seem like something that involves complicated code and rare commands, but Daniel Skoog perfectly portrays an easy and straightforward method to do this in his latest webinar. He provides a clear definition of a Math App, a step-by-step approach to creating a Math App using the explore and quiz commands, and ways to share your applications with the Maple community. It is highly recommended that you watch the entire webinar if you would like to learn more about the core concepts of working with Maple, but you can find the Math App information starting at the 33:00 mark.

I hope that you find this useful. If there is a particular question on MaplePrimes that you would like further explained, please let me know. 

The GroupTheory package in Maple includes facilities for working with finitely presented groups - groups defined by finitely many generators and defining relations.  We now have a video tutorial that covers the basics of this aspect of the package.  As always, we appreciate feedback and suggestions regarding this feature, or new features that you would like to see in the GroupTheory package.

Maple's dsolve numeric can solve delay ODEs and DAEs as of Maple 18. However, if I am not wrong, it cannot solve delay equations with a time dependent history. In this post I show two examples.

Example 1:

y1(t) and y2(t) with time dependent history. Use of piecewise helps this problem to be solved efficiently. Hopefully Maple will add history soon in its capability.

Example 2: 

This is a very a complicated stiff problem from immunology. As of now, I believe only Maple can solve this (other than RADAR5 from Prof. Hairer). Details and plots are posted in the attached code.

 

Let me know if any one has a delay problem that needs to be solved. I have tested many delay problems in Maple (they work fine). The attached examples required addtional tweaking, hence the post.

 

I want to take this opportunity to congratulate and thank Maple's dsolve numeric/delay solvers for their fantastic job. Maple is world leader not because of example1, but because of its ability to solve example 2.

 

 

restart;

 This code is written by Dayaram Sonawane and Venkat R. Subramnian, University of Washington. You will need Maple 18 or later for this. For those who are wanting to solve these problems in earlier versions, I can help them by offering a procedure based approach (less efficient).

Example1 The first example solved is a state dependent delay problem (http://www.mathworks.com/help/matlab/math/state-dependent-delay-problem.html).

 

eq1:= diff(y1(t),t)=y2(t);

eq1 := diff(y1(t), t) = y2(t)

(1)

eq2:=diff(y2(t),t)=-y2(exp(1-y2(t)))*y2(t)^2*exp(1-y2(t));

eq2 := diff(y2(t), t) = -y2(exp(1-y2(t)))*y2(t)^2*exp(1-y2(t))

(2)

 Both y1(t) and y2(t) have time dependent history (y1(t)=log(t) and y2(t)=1/t, t<-0.1). If I am not mistaken one cannot solve this directly using Maple's dsolve numeric command. However, a simple trick can be used to redefine the equations for y1(t) and y2(t) as below

eq3:=diff(y1(t),t)=piecewise(t<=0.1,1/t,y2(t));

eq3 := diff(y1(t), t) = piecewise(t <= .1, 1/t, y2(t))

(3)

eq4:=diff(y2(t),t)=piecewise(t<=0.1,-1/t^2,-y2(exp(1-y2(t)))*y2(t)^2*exp(1-y2(t)));

eq4 := diff(y2(t), t) = piecewise(t <= .1, -1/t^2, -y2(exp(1-y2(t)))*y2(t)^2*exp(1-y2(t)))

(4)

 The problem is solved from a small number close to t = 0 (1e-4) to make Maple's dsolve numeric remember the history till t = 0.1

epsilon:=1e-4;

epsilon := 0.1e-3

(5)

sol:=dsolve({eq3,eq4,y1(epsilon)=log(epsilon),y2(epsilon)=1/epsilon},type=numeric,delaymax=5):

with(plots):

odeplot(sol,[t,y1(t)],0.1..5,thickness=3,axes=boxed);

 

odeplot(sol,[t,y2(t)],0.1..5,thickness=3,axes=boxed);

 

sol(5.0);log(5.0);1/5.0;

[t = 5.0, y1(t) = 1.60942323180838, y2(t) = .199998786891688]

1.609437912

.2000000000

(6)

Tweaking the tolerances and epsilon will get the solution even more closer to the expected answers.

 

 

 Example 2

 The next problem discussed is very stiff, complicated and as of today, according Professor Hairer (one of the world's leading authority in numerical solutions of ODEs, DAEs), cannot be solved by any other code other than his RADAR (5th order implicit Runge Kutta modified for delay equations, Guglielmi N. and Hairer E. (2001) Implementing Radau IIa methods for stiff delay differential equations. Computing 67:1-12). This problem requires very stringent tolerances. For more information read, http://www.scholarpedia.org/article/Stiff_delay_equations. I can safely say that Maple can boast that it can solve this delay differential equation by using a switch function (instead of Heaviside/picecewise function). Code is attached below and results are compared with the output from RADAR code.  Note that dsolve/numeric is probably taking more time steps compared to RADAR, but the fact that Maple's dsolve numeric solved this model (which cannot be solved in Mathematica or MATLAB[needs confirmation for MATLAB]) should make Maple's code writers proud. It is very likely that we will be trying to submit an educational/research article on this topic/example soon to a journal. For some weird reasons, stiff=true gives slightly inaccurate results.

restart:

 

radar5data:=readdata("C:\\Users\\Venkat16core-office\\Google Drive\\waltmanproblem\\sol.txt",[string,string,float,string,string,float,float,float,float,float,float]):

nops(radar5data);

1059

(7)

radar5data[1059];

["X", "=", 300.000000, "Y", "=", 0.6154486288e-15, 0.3377120916e-6, 0.4221403310e-6, 0.2142554563e-5, 299.9999999, 299.6430338]

(8)

eq[1]:=diff(y[1](t),t)=-r*y[1](t)*y[2](t)-s*y[1](t)*y[4](t);

eq[1] := diff(y[1](t), t) = -r*y[1](t)*y[2](t)-s*y[1](t)*y[4](t)

(9)

eq[2]:=diff(y[2](t),t)=-r*y[1](t)*y[2](t)+alpha*r*y[1](y[5](t))*y[2](y[5](t))*H1;#Heaviside(t-35);

eq[2] := diff(y[2](t), t) = -r*y[1](t)*y[2](t)+alpha*r*y[1](y[5](t))*y[2](y[5](t))*H1

(10)

eq[3]:=diff(y[3](t),t)=r*y[1](t)*y[2](t);

eq[3] := diff(y[3](t), t) = r*y[1](t)*y[2](t)

(11)

eq[4]:=diff(y[4](t),t)=-s*y[1](t)*y[4](t)-gamma1*y[4](t)+beta*r*y[1](y[6](t))*y[2](y[6](t))*H2;#Heaviside(t-197);

eq[4] := diff(y[4](t), t) = -s*y[1](t)*y[4](t)-gamma1*y[4](t)+beta*r*y[1](y[6](t))*y[2](y[6](t))*H2

(12)

eq[5]:=diff(y[5](t),t)=H1*(y[1](t)*y[2](t)+y[3](t))/(y[1](y[5](t))*y[2](y[5](t))+y[3](y[5](t)));#eq[7]:=y[7](t)=HH(t);

eq[5] := diff(y[5](t), t) = H1*(y[1](t)*y[2](t)+y[3](t))/(y[1](y[5](t))*y[2](y[5](t))+y[3](y[5](t)))

(13)

eq[6]:=diff(y[6](t),t)=H2*(10.^(-12)*0+y[2](t)+y[3](t))/(10.^(-12)*0+y[2](y[6](t))+y[3](y[6](t)));

eq[6] := diff(y[6](t), t) = H2*(y[2](t)+y[3](t))/(y[2](y[6](t))+y[3](y[6](t)))

(14)

H1:=1/2+1/2*tanh(100*(t-35));H2:=1/2+1/2*tanh(100*(t-197));

H1 := 1/2+(1/2)*tanh(100*t-3500)

H2 := 1/2+(1/2)*tanh(100*t-19700)

(15)

alpha:=1.8;beta:=20.;gamma1:=0.002;r:=5.*10^4;s:=10.^5;

alpha := 1.8

beta := 20.

gamma1 := 0.2e-2

r := 50000.

s := 100000.

(16)

seq(eq[i],i=1..6);

diff(y[1](t), t) = -50000.*y[1](t)*y[2](t)-100000.*y[1](t)*y[4](t), diff(y[2](t), t) = -50000.*y[1](t)*y[2](t)+90000.0*y[1](y[5](t))*y[2](y[5](t))*(1/2+(1/2)*tanh(100*t-3500)), diff(y[3](t), t) = 50000.*y[1](t)*y[2](t), diff(y[4](t), t) = -100000.*y[1](t)*y[4](t)-0.2e-2*y[4](t)+1000000.*y[1](y[6](t))*y[2](y[6](t))*(1/2+(1/2)*tanh(100*t-19700)), diff(y[5](t), t) = (1/2+(1/2)*tanh(100*t-3500))*(y[1](t)*y[2](t)+y[3](t))/(y[1](y[5](t))*y[2](y[5](t))+y[3](y[5](t))), diff(y[6](t), t) = (1/2+(1/2)*tanh(100*t-19700))*(y[2](t)+y[3](t))/(y[2](y[6](t))+y[3](y[6](t)))

(17)

ics:=y[1](0)=5.*10^(-6),y[2](0)=10.^(-15),y[3](0)=0,y[4](0)=0,y[5](0)=1e-40,y[6](0)=1e-20;

ics := y[1](0) = 0.5000000000e-5, y[2](0) = 0.1000000000e-14, y[3](0) = 0, y[4](0) = 0, y[5](0) = 0.1e-39, y[6](0) = 0.1e-19

(18)

#infolevel[all]:=10;

sol:=dsolve({seq(eq[i],i=1..6),ics},type=numeric,delaymax=300,initstep=1e-6,abserr=[1e-21,1e-21,1e-21,1e-21,1e-9,1e-9],[y[1](t),y[2](t),y[3](t),y[4](t),y[5](t),y[6](t)],relerr=1e-9,maxstep=10,optimize=false,compile=true,maxfun=0):

 

 

 note that compile = true was used for efficiency

t11:=time():sol(300);time()-t11;

[t = 300., y[1](t) = 0.615611371327094e-15, y[2](t) = 0.337706811581908e-6, y[3](t) = 0.422136411682798e-6, y[4](t) = 0.214253771204037e-5, y[5](t) = 299.999986716780, y[6](t) = 299.643054284209]

.141

(19)

with(plots):

nd:=nops(radar5data);

nd := 1059

(20)

radar5data[nd];

["X", "=", 300.000000, "Y", "=", 0.6154486288e-15, 0.3377120916e-6, 0.4221403310e-6, 0.2142554563e-5, 299.9999999, 299.6430338]

(21)

 Values at t = 300 match with expected results.

pr[1]:=plot([seq([radar5data[i][3],log(radar5data[i][6])/log(10)],i=1..nd)],style=point,color=green):

p[1]:=odeplot(sol,[t,log(y[1](t))/log(10)],0..300,axes=boxed,thickness=3):

display({pr[1],p[1]});

 

pr[2]:=plot([seq([radar5data[i][3],log(radar5data[i][7])/log(10)],i=1..nd)],style=point,color=green):

p[2]:=odeplot(sol,[t,log(y[2](t))/log(10)],0..300,axes=boxed,thickness=3,numpoints=1000):

display({pr[2],p[2]});

 

pr[3]:=plot([seq([radar5data[i][3],log(radar5data[i][8])/log(10)],i=2..nd)],style=point,color=green):

 

p[3]:=odeplot(sol,[t,log(y[3](t))/log(10)],0..300,axes=boxed,thickness=3):

display({pr[3],p[3]});

 

pr[4]:=plot([seq([radar5data[i][3],log(radar5data[i][9])/log(10)],i=496..nd)],style=point,color=green,view=[197..300,-9..-5]):

p[4]:=odeplot(sol,[t,log(y[4](t))/log(10)],197..300,axes=boxed,thickness=3,view=[197..300,-9..-5]):

display({pr[4],p[4]});

 

pr[5]:=plot([seq([radar5data[i][3],radar5data[i][10]],i=1..nd)],style=point,color=green):

p[5]:=odeplot(sol,[t,y[5](t)],0..300,axes=boxed,thickness=3):

display({pr[5],p[5]});

 

pr[6]:=plot([seq([radar5data[i][3],radar5data[i][11]],i=1..nd)],style=point,color=green):

p[6]:=odeplot(sol,[t,y[6](t)],0..300,axes=boxed,thickness=3):

display({pr[6],p[6]});

 


Download delayimmunetopost.mws

Maple 2015 has a new command, dataplot, for plotting datasets. It was designed to be easy to use and it offers several new features that are not available in Maple's other plotting commands. A few months ago, I recorded a video that gives an overview of the command. If you have any questions or comments about dataplot, feel free to post here. I'm also including the worksheet that is shown in the video: DataplotWebinar.mw

Maple’s Code Generation makes it possible to translate your Maple code to various other programming languages including C, Python, and several others. In Maple 2015, we added a new Code Generation target to one of my other personal favourite languages, R. R is a programming language designed for statistical computing and graphics, so no code translation from Maple to R would be complete without attempting to translate as many commands as possible from Maple’s Statistics package. 

Translating code from one language to another is tricky business. Maple 2015 represented the first time that any Code Generation target language added the ability to translate commands from the Statistics package. With R, we found that many common statistics commands had almost a one-to-one mapping, such as Statistics:-Mean = mean, but several others were much more complicated, including several commands for dealing with probability functions that did not have direct mappings due to differences in how the systems handle symbolic probability functions.

A list of statistics commands that can be translated from Maple to R can be found here.

In addition to assisting me recall the correct syntax in R, having worked with CodeGeneration[R] for several months now, I find that one of my most common uses for Maple’s code generation to R is simply to pass data between the systems. A simple example:

 CodeGeneration:-R( LinearAlgebra:-RandomMatrix( 5, 2 ) );

translates to the following in R:

 cg <- matrix(c(-4,27,8,69,99,29,44,92,-31,67),nrow=5,ncol=2)

To see a couple more short examples, here’s a short video that I recorded on Code Generation to R:

A little known fact about Code Generation is that the translation files can be viewed in from the “samples” directory in your Maple install directory. Similar to many of Maple’s packages, you can view all of the source code that Code Generation uses for its translations. For example, you can view the translations for the commands that I mentioned above from the “FunctionTable.mm” file inside of your “%MapleInstallDir%/ samples/CodeGeneration/R” directory.

Should you have any feedback on this translation, or any other, please feel free to contact us. We’re also on the hunt for our next code generation targets, so let us know what other languages you would like to see added as Code Generation targets.

A wealth of knowledge is on display in MaplePrimes as our contributors share their expertise and step up to answer others’ queries. This post picks out one such response and further elucidates the answers to the posted question. I hope these explanations appeal to those of our readers who might not be familiar with the techniques embedded in the original responses.

Before I begin, a quick note that the content below was primarily created by one of our summer interns, Pia, with guidance and advice from me.

MaplePrimes member Thomas Dean wanted 1/2*x^(1/2) + 1/13*x^(1/3) + 1/26*x^(45/37)  to become  0.5*x^0.500000 + 0.07692307692*x^0.333333 + 0.03846153846*x^1.216216216  using the evalf command.

Here you can see the piece of code that Thomas Dean wrote in Maple:

eq:=1/2*x^(1/2) + 1/13*x^(1/3) + 1/26*x^(45/37);
evalf(eq);

Carl Love replied simply and effectively with a piece of code, using the evalindets command instead:

evalindets(eq, fraction, evalf);

As always, Love provided an accurate response, and it is absolutely correct. But for those just learning Maple, I wanted to provide some additional explanation.

The evalindets command, evalindets( expr, atype, transformer, rest ), is a particular combination of calls to eval and indets that allows you to efficiently transform all subexpressions of a given type by some algorithm. It encapsulates a common "pattern" used in expression manipulation and transformation.

Each subexpression of type atype is transformed by the supplied transformer procedure. Then, each subexpression is replaced in the original expression, using eval, with the corresponding transformed expression.

 

Note: the parameter restis an optional expression sequence of extra arguments to be passed to transformer. In this example it was not used.

I hope that you find this useful. If there is a particular question on MaplePrimes that you would like further explained, please let me know. 

Here are some tips and tricks - ranging from keyboard shortcuts to the newest features - that will help you get the most out of MapleSim 2015.

  1. Quickly run your simulation by pressing F5. Similarly, toggle between the Main Window and Visualization Window by press F6.

  2. Maintaining an organized and clean model layout is made easier by using the Reroute Connections tool. Select the connection lines or components and press CTRL+D (or using the Edit menu, Reroute Connections) to have MapleSim automatically reroute the connections.

  3. While creating your MapleSim model, components and connections can be enabled or disabled by selecting the desired item(s) and using the disable/enable button (  ) or the keyboard shortcut CTRL+E.

  4. Use the Model Tree palette in MapleSim to help manage, navigate, and search a model quickly. Items within the model tree include: components, probes, parameters, and attachments. Simply select the desired view using the drop-down menu. The Model Tree palette is found under the Project tab.

  5. Automatically remove any unreferenced subsystems or custom components using the Prune Model tool. Especially useful for large models or models with multiple modifications, this tool will automatically identify and removes unused shared subsystems or custom components that appear within the Definitions tab, Components palette. The Prune Model function can be performed by clicking the Edit menu, and selecting Prune Model.

  6. Set the MapleSim’s Visualization Window to always on top by toggling the anchor button (  ) in the upper left corner of the Visualization Window.

  7. Automatically scale the model diagram to fit in the viewable area by pressing CTRL+T to gain a complete look at the model. Then return to a default zoom by pressing CTRL+0 (zero). This is also accessible using the View menu.

  8. To group components into a subsystem, select the desired components, right-click and select Create Subsystem or press CTRL+G.

  9. For quick access to get help on a particular component, right-click on it and select help. Similarly, selecting a component within the workspace and pressing F2 will bring up the help page for that component.

  10. View the Modelica code behind the visible system/subsystem/component, click Code View (  ) in the Navigation Tool bar. Then, to switch back to Diagram Mode click the icon (  ) in the Navigation Tool bar.

  11. Automatically compare two models by using the compare tool, found under the Tools menu Compare Models.

  12. Attach important files to a MapleSim model to keep content in one place. Attachments can be Maple worksheets or others such as pdfs, Excel, Word, STL files, etc. These files are found under the Project Tab, Attachments palette. Attach a file by, right-clicking the category and selecting Attach File or clicking the Edit menu Attach File.

I hope you find these useful! Do you have any tips that you would add to this list?

The first instalment in the Hollywood Math webinar series will be returning live this September 17th! It will be presented by Daniel Skoog, our Maple Product Manager.

Over its storied and intriguing history, Hollywood has entertained us with many mathematical moments in film. John Nash in “A Beautiful Mind,” the brilliant janitor in “Good Will Hunting,” the number theory genius in “Pi,” and even Abbott and Costello are just a few of the Hollywood “mathematicians” that come to mind.

During this webinar we will present a number of examples of mathematics in film, including those done capably, as well as questionable and downright “creative” treatments. See relevant, exciting examples that you can use to engage your students, or attend this webinar simply for its entertainment value. Have you ever wondered if the bus could really have jumped the gap in “Speed?” We’ve got the answer! Anyone with an interest in mathematics, especially high school and early college math educators, will be both entertained and informed by attending this webinar.

To join us for the live presentation, click here to register.

A wealth of knowledge is on display in MaplePrimes as our contributors share their expertise and step up to answer others’ queries. This post picks out one such response and further elucidates the answers to the posted question. I hope these explanations appeal to those of our readers who might not be familiar with the techniques embedded in the original responses.

Before I begin, a quick note that the content below was primarily created by one of our summer interns, Pia, with guidance and advice from me.

The Question: why is 2*cos(x)^2-1 simpler than 1-2*sin(x)^2

The author, nm, asked why 2*cos(x)^2-1  was simpler than 1-2*sin(x)^2 according to Maple. nm wrote:

I looked at help trying to understand why Maple thinks 2*cos(x)^2-1 is simpler than 1-2*sin(x)^2 but did not see it. I was expecting to see cos(2*x) as a result.

Preben Alsholm answered nm’s question by recommending the use of the combine command to obtain the result he was expecting to see, as well as a further explanation on how the simplify command works. Alsholm wrote:

Use combine to obtain what you want:
combine(1-2*sin(x)^2);

simplify has a general preference for cos over sin. That doesn't mean however, that it turns sin into cos at all costs:

simplify(sin(x));
##Try also
simplify(1-2*sin(x)^2,size);

simplify doesn't necessarily get you the simplest result in the common sense of the word 'simplify'. Try as another example

expand((x+y)^3);
simplify(%);
factor(%);

As always, Alsholm provided an accurate, thoughtful response. But for those just learning Maple, I thought some additional explanation could be helpful.

Let’s talk more about the simplify command and combine function

The simplify command applies simplification rules to an expression. Its parameters can be any expression.

The combine function applies transformations which combine terms in sums, products, and powers into a single term. For many functions, the transformations applied by combine are the inverse of the transformations that are applied by expand. For example, consider the well-known identity:

sin(a + b) = sin(a) cos(b) + cos(a) sin(b)

The combine function applies the identity from right to left, whereas the expand function does the reverse.

 

I hope that you find this useful. If there is a particular question on MaplePrimes that you would like further explained, please feel free to contact me.

 

On this week I asked Maplesoft Customer Service for help. Here is our correspondence
(Only the purchase code and e-mail addresses are censored. PS. Also the last name of Kari was deleted by Bryon Thur on 28.08.2015.).
I think this is of interest for many Maple users. I have got some experience contacting
with Kaspersky Antivirus (They helped me by the use of indices of my comp.) and ABBYYLingvo
(They helped to install an ABBYYLingvo vocabulary on my phone.) so I can compare and
make conclusions.


From:
Sent: August-15-15 4:44 AM
To: Maplesoft Customer Service
Subject: Customer Service Request: (Web) Installation questions

Hello,
After upgrading my Windows 7 HB 32-bit to Windows 10 I cannot uninstall my Maple 16 PE.
 It cannot be uninstalled by neither Start/Parameters/System/Applications nor
Uninstall in C/ProgramFiles/Maple 16.
The Uninstall option is not seen in Maple 16 as application.
Also the overinstallation of Maple 16 does not work.
Waiting for your feedback.
Sincerely,
Markiyan Hirnyk
------------------------------------------------------------------------------------------------------

Dear Markiyan Hirnyk,

Thank you for contacting Maplesoft.

Maple 16 is not officially supported on Windows 10 but I have added an activation to your
existing Maple 16 Personal Edition purchase code: XXXXXXXXXXXXXXXX to see if reactivating
your license fixes the issue.  If reactivating doesn't give you access to Maple 16, please
send me the exact wording of any error messages that you receive so that I can send
 the information to our Technical Support Team so that they can investigate further.

Kind regards,

Kari
Maplesoft
Customer Service
-----------------------------------------------------------------------------------------------------------
Hello Kari,
Unfortunately, neither the  reactivation of my Maple 16 PE by XXXXXXXXXX nor its uninstallation
do not succeed for me. See the error communications in the attached screens (both in one file) screens_1_2.docx.
It should be noticed that Maple V Release 4 works on Windows 10 of my comp without any problems.
Regards,
Markiyan Hirnyk

--------------------------------------------------------------------------------------------------------
Hi Markiyan Hirnyk,

Thanks for your response.
I am forwarding your information to our Technical Support Team.
A representative will contact you soon.
Kind regards, Kari
Maplesoft Customer Service
------------------------------------------------------------------------------------------------------------
Hello Markiyan,

This error is usually caused by a Windows permissions setting. To fix this, please do the following:

1. Ensure that all Maple programs are completely closed.
2. Click on your Start Menu and go to the 'Programs' > 'Maple 16' > 'Tools' folder.
3. Right click the 'Activate Maple' icon and choose 'Run as administrator'.
4. Activate Maple using your purchase code and this should fix your issue.

Please let me know if you continue to experience any troubles.

Regards,

Chris
Technical Support Analyst
--------------------------------------------------------------------------------------------------------
Hello Chris,
Following your directions, I have just reactivated Maple 16, but my problem is not solved.
To shed light on the situation, my Maple 16.02 works properly,
but I cannot uninstall it after upgrading to Windows 10 Home 32bit.
See the screens in the attached file screen.docx .
Regards,
Markiyan Hirnyk
----------------------------------------------------------------------------------------
Hello Markiyan,
If you are seeing error messages about Maple still being open,
 I would suggest you try to restart your PC and then attempt the uninstall again to ensure
that you do not have any lingering Maple programs running. Please let me know
if you still see this message after restarting.

Regards,

Chris
Technical Support Analyst
------------------------------------------------------------------------------------------------------
Hello Chris,
This does not help too. My guess is execution failure when Maple 16 was installing.
Because of that reason the Maple 16 installer did not create Maple uninstaller in my Maple 16.
 See the attached screen of the uninstall folder in C:/ Program Files/ screen_3.docx.
Regards,
Markiyan Hirnyk
--------------------------------------------------------------------------------------------------------
Hello,
If you think that you have a corrupted installation, I recommend that you reinstall Maple
using the new Maple 16.02 installer link provided below.
 This version of the installer was created to get around the Windows 8 installation issues and
 may be of help to you in Windows 10 as well, though again please be aware that
 we do not officially support Windows 10 yet.
Here are the steps to reinstall Maple:
1. Click on the Start Menu > Control Panel > Programs and Features ( or Add/Remove Programs).
 Find ‘Maple 16’ in the list and uninstall it. If this is not possible, move on to the next step and continue.
2. Restart your computer.
3. Click on the Start Menu > Computer > Local Disk C: > Program Files.
If there is a folder here called ‘Maple 16’, please delete it.
4. Download the installer for Maple 16 from the following link:
        http://www.maplesoft.com/downloads/?d=C75DEBEC838C08BB1DCCED0440B49503&pr=Maple16
5. Make sure to download the correct version for your operating system, i.e. Windows version and 32 or 64-bit.
6. Install Maple by right clicking the installation file and choosing ‘Run as administrator’.
I hope that this helps to resolve the issues that you’re having and if it does not,
contact us and we can further investigate for you.

Regards,
Chris
Technical Support Analyst
--------------------------------------------------------------------------------------------------------
 Hi Chris,
My problem with Maple 16 is solved. I completely uninstalled it by Uninstall Tool 3.4, not using brute force. After that I installed Maple 16 by the distributive suggested by you. That's all right.
Regards,
Markiyan Hirnyk
---------------------------------------------------------------------------------------------------------
Alright, that is good to hear. Please let us know if you run into any further issues with your installation.
Regards,
Chris
Technical Support Analyst

In addition to providing access to powerful tools for mathematical computation, Maple has been designed to help you work quickly and efficiently. Here are 10 useful short-cuts when working with Maple:

1. Use F5 to switch between Text and 2D Math input modes in Maple.

2. Use F2 (Control+? for Macintosh) to quickly bring up Maple Help information for anything that you have typed in your document.

3.  Automatic Command Completion can be used when you don't want to type in the full name of a Maple command. To use, begin typing the first few letters of the command name, and press CTRL+Space (Esc or Command+Shift+Space for Macintosh, CTRL+Shift+Space for Linux).  A list of possible completions will display; click the one you want.

 

4. The Shift+Enter key combination lets you continue entering math or commands on a new line without executing that line. 

5. If you want more than a single command to be executed at once, you must separate them with a semi-colon or colon.

6. When you click inside a set of commands in Math mode, the dash line indicates the boundaries of the input region; all commands in this region will execute together in sequence.

7. To increase the size of a piecewise function, add a new row.  Place the cursor on the last row, and press CTRL+Shift+R (Command+Shift+R for Macintosh). These shortcut keys also work to add rows to matrices.

8. An easy way to insert a Greek letter is to first press CTRL+Shift+G (Command+Shift+G for the Macintosh). The next letter typed will appear in Greek.

9. Sometimes you may want to insert symbols above or below another character, for example, to enter a vector arrow. To insert a symbol above (called "overscript"), press CTRL+Shift+["] (Command+Shift+["] for Macintosh) and then type in your symbol (or insert it from a palette).

For example, typing "x" then holding down CTRL+Shift and pressing ["] allows you to insert a symbol above the x, such as 

10. Compute or recompute the entire Maple worksheet when you have changed expressions that affect subsequent Maple commands.  Press Ctrl + Shift + Enter (Command + Shift + Enter in Macintosh) or click the execute worksheet icon. 

Are there any short-cuts that you would add to this list?

As an educator, you surely know that giving students more involved problems in an online assessment tool provides challenges, both for students and instructors. Only marking the final answer doesn’t necessarily provide an understanding of the student’s capabilities, and it penalizes students that make a small mistake in part of their solution.

This webinar will demonstrate how to create separate questions with multiple steps that can be linked or chained together. Question chaining allows instructors to mark subsequent questions based on the correct answer or the answer provided by students in previous parts.

To join us for the live presentation, please click here to register.

Solving DAEs in Maple

As I had mentioned in many posts, Maple cannot solve nonlinear DAEs. As of today (Maple 2015), given a system of index 1 DAE dy/dt = f(y,z); 0 = g(y,z), Maple “extends” g(y,z) to get dz/dt = g1(y,z). So, any given index 1 DAE is converted to a system of ODEs dy/dt = f, dz/dt = g1 with the constraint g = 0, before it solves. This is true for all the solvers in Maple despite the wrong claims in the help files. It is also true for MEBDFI, the FORTRAN implementation of which actually solves index 2 DAEs directly. In addition, the initial condition for the algebraic variable has to be consistent. The problem with using fsolve is that one cannot specify tolerance. Often times one has to solve DAEs at lower tolerances (1e-3 or 1e-4), not 1e-15. In addition, one cannot use compile =true for high efficiency.

The approach in Maple fails for many DAEs of practical interest. In addition, this can give wrong answers. For example, dy/dt = z, y^2+z^2-1=0, with y(0)=0 and z(0)=1 has a meaningful solution only from 0 to Pi/2, Maple’s dsolve/numeric will convert this to dy/dt = z and dz/dt = -y and integrate in time for ever. This is wrong as at t = Pi/2, the system becomes index 2 DAE and there is more than 1 acceptable solution.

We just recently got our paper accepted that helps Maple's dsolve and many ODE solvers in other languages handle DAEs directly. The approach is rather simple, the index 1 DAE is perturbed as dy/dt = f.S ; -mu.diff(g,t) = g. The switch function is a tanh function which is zero till t = tinit (initialization time). Mu is chosen to be a small number. In addition, lhs of the perturbed equation is simplified using approximate initial guesses as Maple cannot handle non-constant Mass matrix. The paper linked below gives below more details.

http://depts.washington.edu/maple/pubs/U_Apprach_FULL_DRAFT.pdf  

Next, I discuss different examples (code attached).

Example 1: Simple DAE (one ODE and one AE), the proposed approach helps solve this system efficiently without knowing the exact initial condition.

Hint: The code is given with a semicolon at the end of the most of the statements for educational purposes for new users. Using semicolon after dsolve numeric in classic worksheet crashes the code (Maplesoft folks couldn’t fix this despite my request).

Example 2:

This is a nickel battery model (one ODE and one AE). This fails with many solvers unless exact IC is given. The proposed approach works well. In particular, stiff=true, implicit=true option is found to be very efficient. The code given in example 1 can be used to solve example 2 or any other DAEs by just entering ODEs, AEs, ICs in proper places.

Example 3:

This is a nonlinear implicit ODE (posted in Mapleprimes earlier by joha, (http://www.mapleprimes.com/questions/203096-Solving-Nonlinear-ODE#answer211682 ). This can be converted to index 1 DAE and solved using the proposed approach.

Example 4:

This example was posted earlier by me in Mapleprimes (http://www.mapleprimes.com/posts/149877-ODEs-PDEs-And-Special-Functions) . Don’t try to solve this in Maple using its dsolve numeric solver for N greater than 5 directly. The proposed approach can handle this well. Tuning the perturbation parameters and using compile =true will help in solving this system more efficiently.

Finally example 1 is solved for different perturbation parameters to show how one can arrive at convergence. Perhaps more sophisticated users and Maplesoft folks can enable this as automatically tuned parameters in dsolve/numeric.

Note:

This post should not be viewed as just being critical on Maple. I have wasted a lot of time assuming that Maple does what it claims in its help file. This post is to bring awareness about the difficulty in dealing with DAEs. It is perfectly fine to not have a DAE solver, but when literature or standard methods are cited/claimed, they should be implemented in proper form. I will forever remain a loyal Maple user as it has enabled me to learn different topics efficiently. Note that Maplesim can solve DAEs, but it is a pain to create a Maplesim model/project just for solving a DAE. Also, events is a pain with Maplesim. The reference to Mapleprimes links are missing in the article, but will be added before the final printing stage. The ability of Maple to find analytical Jacobian helps in developing many robust ODE and DAE solvers and I hope to post my own approaches that will solve more complicated systems.

I strongly encourage testing of the proposed approach and implementation for various educational/research purposes by various users. The proposed approach enables solving lithium-ion and other battery/electrochemical storage models accurately in a robust manner. A disclosure has been filed with the University of Washington to apply for a provisional patent for battery models and Battery Management System for transportation, storage and other applications because of the current commercial interest in this topic (for batteries). In particular, use of this single step avoids intialization issues/(no need to initialize separately) for parameter estimation, state estimation or optimal control of battery models.

 

Appendix A

Maple code for Examples 1-4 from "Extending Explicit and Linealry Implicit ODE Solvers for Index-1 DAEs", M. T. Lawder,

V. Ramadesigan, B. Suthar and V. R. Subramanian, Computers and Chemical Engineering, in press (2015).

Use y1, y2, etc. for all differential variables and z1, z2, etc. for all algebraic variables

 

Example 1

restart;

with(plots):

Enter all ODEs in eqode

eqode:=[diff(y1(t),t)=-y1(t)^2+z1(t)];

eqode := [diff(y1(t), t) = -y1(t)^2+z1(t)]

(1)

Enter all AEs in eqae

eqae:=[cos(y1(t))-z1(t)^0.5=0];

eqae := [cos(y1(t))-z1(t)^.5 = 0]

(2)

Enter all initial conditions for differential variables in icodes

icodes:=[y1(0)=0.25];

icodes := [y1(0) = .25]

(3)

Enter all intial conditions for algebraic variables in icaes

icaes:=[z1(0)=0.8];

icaes := [z1(0) = .8]

(4)

Enter parameters for perturbation value (mu), switch function (q and tint), and runtime (tf)

pars:=[mu=0.1,q=1000,tint=1,tf=5];

pars := [mu = .1, q = 1000, tint = 1, tf = 5]

(5)

Choose solving method (1 for explicit, 2 for implicit)

Xexplicit:=2;

Xexplicit := 2

(6)

Standard solver requires IC z(0)=0.938791 or else it will fail

solx:=dsolve({eqode[1],eqae[1],icodes[1],icaes[1]},numeric):

Error, (in dsolve/numeric/DAE/checkconstraints) the initial conditions do not satisfy the algebraic constraints
  error = .745e-1, tolerance = .559e-6, constraint = cos(y1(t))-z1(t)^.5000000000000000000000

 

ff:=subs(pars,1/2+1/2*tanh(q*(t-tint)));

ff := 1/2+(1/2)*tanh(1000*t-1000)

(7)

NODE:=nops(eqode);NAE:=nops(eqae);

NODE := 1

NAE := 1

(8)

for XX from 1 to NODE do
EQODE||XX:=lhs(eqode[XX])=rhs(eqode[XX])*ff;
end do;

EQODE1 := diff(y1(t), t) = (-y1(t)^2+z1(t))*(1/2+(1/2)*tanh(1000*t-1000))

(9)

for XX from 1 to NAE do
EQAE||XX:=subs(pars,-mu*(diff(rhs(eqae[XX])-lhs(eqae[XX]),t))=rhs(eqae[XX])-lhs(eqae[XX]));
end do;

EQAE1 := -.1*sin(y1(t))*(diff(y1(t), t))-0.5e-1*(diff(z1(t), t))/z1(t)^.5 = -cos(y1(t))+z1(t)^.5

(10)

 

Dvars1:={seq(diff(z||x(t),t)=D||x,x=1..NAE)};

Dvars1 := {diff(z1(t), t) = D1}

(11)

Dvars2:={seq(rhs(Dvars1[x])=lhs(Dvars1[x]),x=1..NAE)};

Dvars2 := {D1 = diff(z1(t), t)}

(12)

icsn:=seq(subs(y||x(0)=y||x(t),icodes[x]),x=1..NODE),seq(subs(z||x(0)=z||x(t),icaes[x]),x=1..NAE);

icsn := y1(t) = .25, z1(t) = .8

(13)

for j from 1 to NAE do

EQAEX||j:=subs(Dvars1,eqode,icsn,Dvars2,lhs(EQAE||j))=rhs(EQAE||j);

end do:

Sys:={seq(EQODE||x,x=1..NODE),seq(EQAEX||x,x=1..NAE),seq(icodes[x],x=1..NODE),seq(icaes[x],x=1..NAE)};

Sys := {-0.1824604200e-1-0.5590169945e-1*(diff(z1(t), t)) = -cos(y1(t))+z1(t)^.5, y1(0) = .25, z1(0) = .8, diff(y1(t), t) = (-y1(t)^2+z1(t))*(1/2+(1/2)*tanh(1000*t-1000))}

(14)

if Xexplicit=1 then

sol:=dsolve(Sys,numeric):

else

sol:=dsolve(Sys,numeric,stiff=true,implicit=true):
end if:

 

for XX from 1 to NODE do
a||XX:=odeplot(sol,[t,y||XX(t)],0..subs(pars,tf),color=red);
end do:

for XX from NODE+1 to NODE+NAE do
a||XX:=odeplot(sol,[t,z||(XX-NODE)(t)],0..subs(pars,tf),color=blue);
end do:

display(seq(a||x,x=1..NODE+NAE),axes=boxed);

 

End Example 1

 

Example 2

restart;

with(plots):

eq1:=diff(y1(t),t)=j1*W/F/rho/V;

eq1 := diff(y1(t), t) = j1*W/(F*rho*V)

(15)

eq2:=j1+j2=iapp;

eq2 := j1+j2 = iapp

(16)

j1:=io1*(2*(1-y1(t))*exp((0.5*F/R/T)*(z1(t)-phi1))-2*y1(t)*exp((-0.5*F/R/T)*(z1(t)-phi1)));

j1 := io1*(2*(1-y1(t))*exp(.5*F*(z1(t)-phi1)/(R*T))-2*y1(t)*exp(-.5*F*(z1(t)-phi1)/(R*T)))

(17)

j2:=io2*(exp((F/R/T)*(z1(t)-phi2))-exp((-F/R/T)*(z1(t)-phi2)));

j2 := io2*(exp(F*(z1(t)-phi2)/(R*T))-exp(-F*(z1(t)-phi2)/(R*T)))

(18)

params:={F=96487,R=8.314,T=298.15,phi1=0.420,phi2=0.303,W=92.7,V=1e-5,io1=1e-4,io2=1e-10,iapp=1e-5,rho=3.4};

params := {F = 96487, R = 8.314, T = 298.15, V = 0.1e-4, W = 92.7, io1 = 0.1e-3, io2 = 0.1e-9, rho = 3.4, iapp = 0.1e-4, phi1 = .420, phi2 = .303}

(19)

eqode:=[subs(params,eq1)];

eqode := [diff(y1(t), t) = 0.5651477584e-2*(1-y1(t))*exp(19.46229155*z1(t)-8.174162450)-0.5651477584e-2*y1(t)*exp(-19.46229155*z1(t)+8.174162450)]

(20)

eqae:=[subs(params,eq2)];

eqae := [0.2e-3*(1-y1(t))*exp(19.46229155*z1(t)-8.174162450)-0.2e-3*y1(t)*exp(-19.46229155*z1(t)+8.174162450)+0.1e-9*exp(38.92458310*z1(t)-11.79414868)-0.1e-9*exp(-38.92458310*z1(t)+11.79414868) = 0.1e-4]

(21)

icodes:=[y1(0)=0.05];

icodes := [y1(0) = 0.5e-1]

(22)

icaes:=[z1(0)=0.7];

icaes := [z1(0) = .7]

(23)

solx:=dsolve({eqode[1],eqae[1],icodes[1],icaes[1]},type=numeric):

Error, (in dsolve/numeric/DAE/checkconstraints) the initial conditions do not satisfy the algebraic constraints
  error = .447e9, tolerance = .880e4, constraint = -2000000*(-1+y1(t))*exp(19.46229155000000000000*z1(t)-8.174162450000000000000)-2000000*y1(t)*exp(-19.46229155000000000000*z1(t)+8.174162450000000000000)+exp(38.92458310000000000000*z1(t)-11.79414868000000000000)-exp(-38.92458310000000000000*z1(t)+11.79414868000000000000)-100000

 

pars:=[mu=0.00001,q=1000,tint=1,tf=5001];

pars := [mu = 0.1e-4, q = 1000, tint = 1, tf = 5001]

(24)

Xexplicit:=2;

Xexplicit := 2

(25)

ff:=subs(pars,1/2+1/2*tanh(q*(t-tint)));

ff := 1/2+(1/2)*tanh(1000*t-1000)

(26)

NODE:=nops(eqode):NAE:=nops(eqae);

NAE := 1

(27)

for XX from 1 to NODE do
EQODE||XX:=lhs(eqode[XX])=rhs(eqode[XX])*ff:
end do;

EQODE1 := diff(y1(t), t) = (0.5651477584e-2*(1-y1(t))*exp(19.46229155*z1(t)-8.174162450)-0.5651477584e-2*y1(t)*exp(-19.46229155*z1(t)+8.174162450))*(1/2+(1/2)*tanh(1000*t-1000))

(28)

for XX from 1 to NAE do
EQAE||XX:=subs(pars,-mu*(diff(rhs(eqae[XX])-lhs(eqae[XX]),t))=rhs(eqae[XX])-lhs(eqae[XX]));
end do;

EQAE1 := -0.2e-8*(diff(y1(t), t))*exp(19.46229155*z1(t)-8.174162450)+0.3892458310e-7*(1-y1(t))*(diff(z1(t), t))*exp(19.46229155*z1(t)-8.174162450)-0.2e-8*(diff(y1(t), t))*exp(-19.46229155*z1(t)+8.174162450)+0.3892458310e-7*y1(t)*(diff(z1(t), t))*exp(-19.46229155*z1(t)+8.174162450)+0.3892458310e-13*(diff(z1(t), t))*exp(38.92458310*z1(t)-11.79414868)+0.3892458310e-13*(diff(z1(t), t))*exp(-38.92458310*z1(t)+11.79414868) = 0.1e-4-0.2e-3*(1-y1(t))*exp(19.46229155*z1(t)-8.174162450)+0.2e-3*y1(t)*exp(-19.46229155*z1(t)+8.174162450)-0.1e-9*exp(38.92458310*z1(t)-11.79414868)+0.1e-9*exp(-38.92458310*z1(t)+11.79414868)

(29)

Dvars1:={seq(diff(z||x(t),t)=D||x,x=1..NAE)};

Dvars1 := {diff(z1(t), t) = D1}

(30)

Dvars2:={seq(rhs(Dvars1[x])=lhs(Dvars1[x]),x=1..NAE)};

Dvars2 := {D1 = diff(z1(t), t)}

(31)

icsn:=seq(subs(y||x(0)=y||x(t),icodes[x]),x=1..NODE),seq(subs(z||x(0)=z||x(t),icaes[x]),x=1..NAE);

icsn := y1(t) = 0.5e-1, z1(t) = .7

(32)

for j from 1 to NAE do

EQAEX||j:=subs(Dvars1,eqode,icsn,Dvars2,lhs(EQAE||j))=rhs(EQAE||j);

end do;

EQAEX1 := -0.2e-8*(0.5368903705e-2*exp(5.449441630)-0.2825738792e-3*exp(-5.449441630))*exp(5.449441630)+0.3697835394e-7*(diff(z1(t), t))*exp(5.449441630)-0.2e-8*(0.5368903705e-2*exp(5.449441630)-0.2825738792e-3*exp(-5.449441630))*exp(-5.449441630)+0.1946229155e-8*(diff(z1(t), t))*exp(-5.449441630)+0.3892458310e-13*(diff(z1(t), t))*exp(15.45305949)+0.3892458310e-13*(diff(z1(t), t))*exp(-15.45305949) = 0.1e-4-0.2e-3*(1-y1(t))*exp(19.46229155*z1(t)-8.174162450)+0.2e-3*y1(t)*exp(-19.46229155*z1(t)+8.174162450)-0.1e-9*exp(38.92458310*z1(t)-11.79414868)+0.1e-9*exp(-38.92458310*z1(t)+11.79414868)

(33)

Sys:={seq(EQODE||x,x=1..NODE),seq(EQAEX||x,x=1..NAE),seq(icodes[x],x=1..NODE),seq(icaes[x],x=1..NAE)};

Sys := {-0.5810962488e-6+0.8802389238e-5*(diff(z1(t), t)) = 0.1e-4-0.2e-3*(1-y1(t))*exp(19.46229155*z1(t)-8.174162450)+0.2e-3*y1(t)*exp(-19.46229155*z1(t)+8.174162450)-0.1e-9*exp(38.92458310*z1(t)-11.79414868)+0.1e-9*exp(-38.92458310*z1(t)+11.79414868), y1(0) = 0.5e-1, z1(0) = .7, diff(y1(t), t) = (0.5651477584e-2*(1-y1(t))*exp(19.46229155*z1(t)-8.174162450)-0.5651477584e-2*y1(t)*exp(-19.46229155*z1(t)+8.174162450))*(1/2+(1/2)*tanh(1000*t-1000))}

(34)

if Xexplicit=1 then

sol:=dsolve(Sys,numeric,maxfun=0):

else

sol:=dsolve(Sys,numeric,stiff=true,implicit=true,maxfun=0):

end if:

 

for XX from 1 to NODE do
a||XX:=odeplot(sol,[t,y||XX(t)],0..subs(pars,tf),color=red);
end do:

for XX from NODE+1 to NODE+NAE do
a||XX:=odeplot(sol,[t,z||(XX-NODE)(t)],0..subs(pars,tf),color=blue);
end do:

b1:=odeplot(sol,[t,y1(t)],0..1,color=red):
b2:=odeplot(sol,[t,z1(t)],0..1,color=blue):

display(b1,b2,axes=boxed);

 

display(seq(a||x,x=1..NODE+NAE),axes=boxed);

 

End Example 2

 

Example 3

restart;

with(plots):

eq1:=diff(y1(t),t)^2+diff(y1(t),t)*(y1(t)+1)+y1(t)=cos(diff(y1(t),t));

eq1 := (diff(y1(t), t))^2+(diff(y1(t), t))*(y1(t)+1)+y1(t) = cos(diff(y1(t), t))

(35)

solx:=dsolve({eq1,y1(0)=0},numeric):

Error, (in dsolve/numeric/make_proc) Could not convert to an explicit first order system due to 'RootOf'

 

eqode:=[diff(y1(t),t)=z1(t)];

eqode := [diff(y1(t), t) = z1(t)]

(36)

eqae:=[subs(eqode,eq1)];

eqae := [z1(t)^2+z1(t)*(y1(t)+1)+y1(t) = cos(z1(t))]

(37)

icodes:=[y1(0)=0.0];

icodes := [y1(0) = 0.]

(38)

icaes:=[z1(0)=0.0];

icaes := [z1(0) = 0.]

(39)

pars:=[mu=0.1,q=1000,tint=1,tf=4];

pars := [mu = .1, q = 1000, tint = 1, tf = 4]

(40)

Xexplicit:=2;

Xexplicit := 2

(41)

ff:=subs(pars,1/2+1/2*tanh(q*(t-tint)));

ff := 1/2+(1/2)*tanh(1000*t-1000)

(42)

NODE:=nops(eqode);NAE:=nops(eqae);

NODE := 1

NAE := 1

(43)

for XX from 1 to NODE do
EQODE||XX:=lhs(eqode[XX])=rhs(eqode[XX])*ff:
end do;

EQODE1 := diff(y1(t), t) = z1(t)*(1/2+(1/2)*tanh(1000*t-1000))

(44)

for XX from 1 to NAE do
EQAE||XX:=subs(pars,-mu*(diff(rhs(eqae[XX])-lhs(eqae[XX]),t))=rhs(eqae[XX])-lhs(eqae[XX]));
end do;

EQAE1 := .1*sin(z1(t))*(diff(z1(t), t))+.2*z1(t)*(diff(z1(t), t))+.1*(diff(z1(t), t))*(y1(t)+1)+.1*z1(t)*(diff(y1(t), t))+.1*(diff(y1(t), t)) = cos(z1(t))-z1(t)^2-z1(t)*(y1(t)+1)-y1(t)

(45)

 

Dvars1:={seq(diff(z||x(t),t)=D||x,x=1..NAE)};

Dvars1 := {diff(z1(t), t) = D1}

(46)

Dvars2:={seq(rhs(Dvars1[x])=lhs(Dvars1[x]),x=1..NAE)};

Dvars2 := {D1 = diff(z1(t), t)}

(47)

icsn:=seq(subs(y||x(0)=y||x(t),icodes[x]),x=1..NODE),seq(subs(z||x(0)=z||x(t),icaes[x]),x=1..NAE);

icsn := y1(t) = 0., z1(t) = 0.

(48)

for j from 1 to NAE do

EQAEX||j:=subs(Dvars1,eqode,icsn,Dvars2,lhs(EQAE||j))=rhs(EQAE||j);

end do;

EQAEX1 := .1*sin(0.)*(diff(z1(t), t))+.1*(diff(z1(t), t)) = cos(z1(t))-z1(t)^2-z1(t)*(y1(t)+1)-y1(t)

(49)

Sys:={seq(EQODE||x,x=1..NODE),seq(EQAEX||x,x=1..NAE),seq(icodes[x],x=1..NODE),seq(icaes[x],x=1..NAE)};

Sys := {.1*(diff(z1(t), t)) = cos(z1(t))-z1(t)^2-z1(t)*(y1(t)+1)-y1(t), y1(0) = 0., z1(0) = 0., diff(y1(t), t) = z1(t)*(1/2+(1/2)*tanh(1000*t-1000))}

(50)

if Xexplicit=1 then

sol:=dsolve(Sys,numeric):

else

sol:=dsolve(Sys,numeric,stiff=true,implicit=true):

end if:

 

for XX from 1 to NODE do
a||XX:=odeplot(sol,[t,y||XX(t)],0..subs(pars,tf),color=red);
end do:

for XX from NODE+1 to NODE+NAE do
a||XX:=odeplot(sol,[t,z||(XX-NODE)(t)],0..subs(pars,tf),color=blue);
end do:

display(seq(a||x,x=1..NODE+NAE),axes=boxed);

 

End Example 3

 

Example 4

restart;

with(plots):

N:=11:h:=1/(N+1):

for i from 2 to N+1 do eq1[i]:=diff(y||i(t),t)=(y||(i+1)(t)-2*y||i(t)+y||(i-1)(t))/h^2-y||i(t)*(1+z||i(t));od:

for i from 2 to N+1 do eq2[i]:=0=(z||(i+1)(t)-2*z||i(t)+z||(i-1)(t))/h^2-(1-y||i(t)^2)*(exp(-z||i(t)));od:

eq1[1]:=(3*y1(t)-4*y2(t)+y3(t))/(2*h)=0: eq1[N+2]:=y||(N+2)(t)-1=0:

eq2[1]:=(3*z1(t)-4*z2(t)+1*z3(t))/(2*h)=0: eq2[N+2]:=z||(N+2)(t)=0:

eq1[1]:=subs(y1(t)=z||(N+3)(t),eq1[1]):

eq1[N+2]:=subs(y||(N+2)(t)=z||(N+4)(t),eq1[N+2]):

eqode:=[seq(subs(y1(t)=z||(N+3)(t),y||(N+2)(t)=z||(N+4)(t),eq1[i]),i=2..N+1)]:

eqae:=[eq1[1],eq1[N+2],seq(eq2[i],i=1..N+2)]:

icodes:=[seq(y||j(0)=1,j=2..N+1)]:

icaes:=[seq(z||j(0)=0,j=1..N+2),z||(N+3)(0)=1,z||(N+4)(0)=1]:

pars:=[mu=0.00001,q=1000,tint=1,tf=2]:

Xexplicit:=2:

ff:=subs(pars,1/2+1/2*tanh(q*(t-tint))):

NODE:=nops(eqode):NAE:=nops(eqae):

for XX from 1 to NODE do

EQODE||XX:=lhs(eqode[XX])=rhs(eqode[XX])*ff: end do:

for XX from 1 to NAE do

EQAE||XX:=subs(pars,-mu*(diff(rhs(eqae[XX])-lhs(eqae[XX]),t))=rhs(eqae[XX])-lhs(eqae[XX])); end do:

Dvars1:={seq(diff(z||x(t),t)=D||x,x=1..NAE)}:

Dvars2:={seq(rhs(Dvars1[x])=lhs(Dvars1[x]),x=1..NAE)}:

icsn:=seq(subs(y||x(0)=y||x(t),icodes[x]),x=1..NODE),seq(subs(z||x(0)=z||x(t),icaes[x]),x=1..NAE):

for j from 1 to NAE do

EQAEX||j:=subs(Dvars1,eqode,icsn,Dvars2,lhs(EQAE||j))=rhs(EQAE||j):

end do:

Sys:={seq(EQODE||x,x=1..NODE),seq(EQAEX||x,x=1..NAE),seq(icodes[x],x=1..NODE),seq(icaes[x],x=1..NAE)}:

if Xexplicit=1 then

sol:=dsolve(Sys,numeric,maxfun=0):

else

sol:=dsolve(Sys,numeric,stiff=true,implicit=true,maxfun=0):

end if:

 

for XX from 1 to NODE do

a||XX:=odeplot(sol,[t,y||(XX+1)(t)],1..subs(pars,tf),color=red): end do:

for XX from NODE+1 to NODE+NAE do

a||XX:=odeplot(sol,[t,z||(XX-NODE)(t)],1..subs(pars,tf),color=blue): end do:

display(seq(a||x,x=1..NODE),a||(NODE+NAE-1),a||(NODE+NAE),axes=boxed);

 

End of Example 4

 

Sometimes the parameters of the switch function and perturbation need to be tuned to obtain propoer convergence. Below is Example 1 shown for several cases using the 'parameters' option in Maple's dsolve to compare how tuning parameters affects the solution

restart:

with(plots):

eqode:=[diff(y1(t),t)=-y1(t)^2+z1(t)]: eqae:=[cos(y1(t))-z1(t)^0.5=0]:

icodes:=[y1(0)=0.25]: icaes:=[z1(0)=0.8]:

pars:=[tf=5]:

Xexplicit:=2;

Xexplicit := 2

(51)

ff:=subs(pars,1/2+1/2*tanh(q*(t-tint))):

NODE:=nops(eqode):NAE:=nops(eqae):

for XX from 1 to NODE do
EQODE||XX:=lhs(eqode[XX])=rhs(eqode[XX])*ff:
end do:

for XX from 1 to NAE do
EQAE||XX:=subs(pars,-mu*(diff(rhs(eqae[XX])-lhs(eqae[XX]),t))=rhs(eqae[XX])-lhs(eqae[XX]));
end do:

 

Dvars1:={seq(diff(z||x(t),t)=D||x,x=1..NAE)}:

Dvars2:={seq(rhs(Dvars1[x])=lhs(Dvars1[x]),x=1..NAE)}:

icsn:=seq(subs(y||x(0)=y||x(t),icodes[x]),x=1..NODE),seq(subs(z||x(0)=z||x(t),icaes[x]),x=1..NAE):

for j from 1 to NAE do

EQAEX||j:=subs(Dvars1,eqode,icsn,Dvars2,lhs(EQAE||j))=rhs(EQAE||j):

end do:

Sys:={seq(EQODE||x,x=1..NODE),seq(EQAEX||x,x=1..NAE),seq(icodes[x],x=1..NODE),seq(icaes[x],x=1..NAE)}:

if Xexplicit=1 then

sol:=dsolve(Sys,numeric,'parameters'=[mu,q,tint],maxfun=0):

else

sol:=dsolve(Sys,numeric,'parameters'=[mu,q,tint],stiff=true,implicit=true):

end if:

 

sol('parameters'=[0.1,1000,1]):

plot1:=odeplot(sol,[t-1,y1(t)],0..4,color=red):
plot2:=odeplot(sol,[t-1,z1(t)],0..4,color=blue):

sol('parameters'=[0.001,10,1]):

plot3:=odeplot(sol,[t-1,y1(t)],0..4,color=red,linestyle=dot):
plot4:=odeplot(sol,[t-1,z1(t)],0..4,color=blue,linestyle=dot):

display(plot1,plot2,plot3,plot4,axes=boxed);

 

In general, one has to decrease mu, and increase q and tint until convergence (example at t=3)

sol('parameters'=[0.001,10,1]):sol(3+1);

[t = 4., y1(t) = .738587929442734, z1(t) = .546472878850096]

(52)

sol('parameters'=[0.0001,100,10]):sol(3+10);

[t = 13., y1(t) = .738684397167344, z1(t) = .546618936273638]

(53)

sol('parameters'=[0.00001,1000,20]):sol(3+20);

[t = 23., y1(t) = .738694113087217, z1(t) = .546633473784526]

(54)

 

The results have converged to 4 digits after the decimal. Of course, absolute and relative tolerances of the solvers can be modified if needed

 

Download SolvingDAEsinMaple.mws

It looks like the Online Help has now been updated for Maple 2015.

Here's the What's New in Maple 2015 Overview, which is similar to the product pages currently available here.

But we can now also link to and view the online versions of full help pages of new or enhanced commands or example worksheets. For example, dataplot.

acer

Here are some tips and tricks that will help you get the most out of Maple 2015, covering from short cuts to how to use the newest features.

    1. Whenever you are asking yourself “..but how do I do it?”, just type ?Portal+Enter, and you will access the Maple Portal, which will give you a complete guide on how to do things.

    2. If you want to implement 1 of the 300 tasks that Maple offers in a syntax-free way, like Completing the Square, just follow this path: Tools≻Tasks≻Browse.

    3. Type Ctrl+F2 or Command+F2 and the Quick Reference window with shortcut keys and other information about working with the Maple interface will pop up.

    4. If you need quick help with a specific mathematical function, click or highlight the function + F2 and a Help box that contains a summary of the basic characteristics of the function will pop up.

    5. If you have installed the Excel Add-in and you want to perform some Maple commands within Excel, make sure to enable the Maple add in by following this path: Excel’s Tool Menu>Add-Ins>Select Maple Excel Add-in Box> OK

    6. Export Maple’s data into Excel by right clicking and choosing ‘Export As’>Excel.

    7. Instead of having to copy-paste your Maple information into a Power Point Presentation, just turn the slideshow mode on by pressing F11. This way you will have an interactive presentation that holds all the live plots and embedded components that Maple offers.

    8. Whenever you want to create interactive mini-applications that can be used to explore the parameters of any arbitrary Maple expression, such as a plot, mathematical equation, or command use the Exploration Assistant. Do this by either right-clicking +Explore from the context-sensitive menus, or by calling the Explore command.

    9. Save time while computing mathematical expressions by calling the equation label instead of having to re-type the equation. Do this by pressing CTRL+L and then input the number that identifies the equation.

    10. Reference mathematical equations or expressions from other documents. First, determine which label is associated with the equation you want. In the main document, select "Insert" > "Reference". From the file dialog, select the file containing the expression. Then select the equation reference number of your equation from the list that appears.

    11. In Maple, the letter "e" entered using the keyboard does not represent the exponential function. The exponential function can be entered using command completion (Ctrl+Space or ESC) or the "exp(a)" item in the Expression Palette (Standard interface only). The exponential can also be entered as:          
      > exp(x)

    12. With Maple 2015 you can now access data sets from various built-in and online data sources. This package is able to access time series data from the data aggregator Quandl, as well as locally installed data from countries and cities. To learn more, click here.

    13. Whenever you assign plots to a variable name, p:=[plot(sin(x)), plot(cos(x))] a thumbnail of the plot will appear instead of the code.

    14. Save time when inputting existing or personalized units. Just click CTRL+SHIFT+U and type the desired units you want.

    15. With Maple 2015 you can now zoom in or out just by pressing CTRL+SCROLL or CTRL+ place two fingers on the pad and move them up to zoom in or down to zoom out.

    16. Convert a Maple Worksheet into Microsoft Word: This can be done using the Export to HTML feature.
      1. Prepare your worksheet as you would like it to appear in the document.
      2. From the "File" menu in Maple, select "Export As ..." > "HTML".
      3. Give the HTML file a name, "output.html" for example.
      4. When the export has completed, start Word, and open the HTML file. If you used "output.html" as the name to save the file as, open the file called "output1.html" into Word.
      5. From the "File" menu in Word, select "Save as Word Document" to save the file. You now have a Word document which contains the content of your Maple worksheet.

        Note: this procedure will work with any Word Processing program that can open an HTML document.

    17. Change Maple’s default input from 2D to 1D:
      1. Open the Tools > Options... menu (Maple > Preferences on a MACINTOSH machine).
      2. Select the Display tab
      3. From "Input Display" menu select Maple Notation
      4. Press the Apply to Session button to make the change take effect for the current Maple session.
      5. Press Apply Globally to have the change take effect permanently. Maple will need to be restarted if you choose Apply Globally for the changes to take effect.

        You may download a set of instruction on how to change your 2D interface to the “Classic” Style here: ftp://public.maplesoft.com/miscellaneous/ChangeToClassicInterface.pdf

We hope that you find this list helpful. Please feel free to add any of your tips or techniques to this post, or to create your own new topic.

First 19 20 21 22 23 24 25 Last Page 21 of 64