Samir Khan

2136 Reputation

20 Badges

17 years, 73 days

My role is to help customers better exploit our tools. I’ve worked in selling, supporting and marketing maths and simulation software for all my professional career.

I’m fascinated by the full breadth and range of application of Maple. From financial mathematics and engineering to probability and calculus, I’m always impressed by what our users do with our tools.

However much I strenuously deny it, I’m a geek at heart. My first encounter with Maple was as an undergraduate when I used it to symbolically solve the differential equations that described the heat transfer in a series of stirred tanks. My colleagues brute-forced the problem with a numerical solution in Fortran (but they got the marks because that was the point of the course). I’ve since dramatized the process in a worksheet, and never fail to bore people with the story behind it.

I was born, raised and spent my formative years in England’s second city, Birmingham. I graduated with a degree in Chemical Engineering from The University of Nottingham, and after completing a PhD in Fluid Dynamics at Herriot-Watt University in Edinburgh, I started working for Adept Scientific – Maplesoft’s partner in the UK.

MaplePrimes Activity


These are answers submitted by Samir Khan

Ivar,

One way of doing this is in a Maple document attached to a MapleSim model.

 * Let say that you have a MapleSim model that returns 4 plots

* Attach say the Equations template to the MapleSim model

*Scroll to the bottom and execute the following commands

> with(DocumentTools); with(MapleSim); with(plots);
> theModel := GetProperty(Simulation0, system);
 

the following command returns an array; the first column is time, and the remaing columns are all probe values.
> data := RunSimulation(theModel, output = datapoint, returnTimeData);

Hence to plot the first probe value against time for the whole range (assuming 200 points in total)
> plotdata := [seq([data[i, 1], data[i, 2]], i = 1 .. 200)];
> pointplot(plotdata);
 

To plot all the probes over a specific time range
> plotdata := seq(pointplot([seq([data[i, 1], data[i, j]], i = 150 .. 175)], connect = true), j = 2 .. 5);
> display(Array([plotdata]));
 

Please see the attached MapleSim model for a worked example, and let us know if you have any questions.

Download 8983_ivar.zip
View file details

Add method=branchandbound to the GlobalSolve command, i.e.

GlobalSolve(add(Difference[p]^2,p=1..6), op(VarRanges), method=branchandbound);

It's now insensitive to your search range.  The default method is multistart.

Samir

1 2 3 4 5 Page 5 of 5