jonlg

55 Reputation

2 Badges

10 years, 270 days

MaplePrimes Activity


These are replies submitted by jonlg

@Kitonum 

Hi Kitonum,

thanks.

It is true that I typed e^x, and Maple formatted it as printed in my previous mail. Thought that it was a valid way to specify an exponential.

I am curious about the reason why it should be coded as exp(x). Any ideas?

 

On the other hand, I am not sure whether the integrals can be solved only numerically. I will need to double-check. I may have deduced an incorrect expression although I've revised it several times.

Anyway, thanks for the tips.

I'll let you know.

jon

@Markiyan Hirnyk 

Dear Markiyan Hirnyk,

worked like a charm.

Thanks,

jon

@gkokovidis 

Dear Georgios,

many thanks for your answer. Things are clearer now.

Kind regards,

jon

@Preben Alsholm 


Dear Preben Alsholm,
thanks for your your useful explanation and example.

I wonder whether there is some way to get the result of the solve statements directly into the plot statements without needing to manually specify them.

Something like:
hNullCl := solve(eq2, {u(t), v(t)});
hNullclPlt := plot([[hNullCl[1], u = uView], [hNullCl[2], v = vView]], opts):

meaning that (for the posted case)
hNullCl[1]= u,0
hNullCl[2]= 1,v

I grant this may a be alittle bit complicated since hNullCl yields a set, not a list, and the set yielded contains expressions containing the free variable:
{u(t) = u(t), v(t) = 0}, {u(t) = 1, v(t) = v(t)}

Any ideas?


Thanks,
jon

@Preben Alsholm 

Dear Preben Alsholm,
thanks for the answer. Thanks for pointing the 'use' of trange.

For your words, I assume that DEplot does not need the initial conditions that I needed due to the non-autonomous nature of the system as I defined. Is this right?

However, even with DEplot I was only able to plot the vector field by stating the initial conditions, and, as you pointed, having decoupled the piece-wise defined differential equation:

DEplot([de11, de2], [A(t), G(t)], t = 0 .. 20, [[A(0) = 25, G(0) = 0]], A = 0 .. 20, G = 0 .. 20, dirfield = 600, [[0, 0, 4], [0, 1, 0], [0, 2, 4], [0, 2, 3]], linecolor = black, dirfield = 400, color = magnitude, arrows = fish, numsteps = 300, numpoints = 900)


The command
DEplot([de1, de2], [A(t), G(t)], t = 0 .. 20, [[A(0) = 25, G(0) = 0]], A = 0 .. 20, G = 0 .. 20, dirfield = 600, [[0, 0, 4], [0, 1, 0], [0, 2, 4], [0, 2, 3]], linecolor = black, dirfield = 400, color = magnitude, arrows = fish, numsteps = 300, numpoints = 900)

plots just the trajectories.


Thanks,
jon

@Carl Love 


Dear CarlLove,
many thanks for your insights and clarifying instructions. They were extremely helpful.

Thanks fot having written the accompanying worksheet as well.


Kind regards,
jon

@Markiyan Hirnyk 


Dear Markiyan Hirnyk,
thanks for the answer.

Yes, I grant that it may be a common task, but could not find the right answer.

Kind regards,
jon

@Carl Love 

Dear Carl Love, Kitonum and  Dr. Venkat Subramanian,

your solutions all worked like a charm. Thank you !

 

Carlo Love, you may be right; it looked like Maple was ignoring some of my commands. Nevertheless, I checked that reproducing your commands in 2D Input mode also works.

For some unknown reason, I was told that using 2D Input is preferred.

 

BTW, what does the 

assign(%);

command do?

 

Thanks again,

jon

@tomleslie 

Acer, and tomleslie
sorry for the delay in answering.

Thanks for your answers. They indeed helped a lot, although I was apparently not ver clear in my explanations.

It looks like I misunderstood the use of the second and third arguments in the surfdata command:
indexA := 2;
minViewRBC := 0;
maxViewRBC := 3.5;
viewRBC := minViewRBC .. maxViewRBC;
all_fixed_b_plots := [seq(surfdata(M[..,indexA,..,tau], 1..nDays, 1..nB, labels = ["n (days)", "b (steps)", "RBCs produced \n(millions of cells/mcL)"], opts, view = viewRBC, color = COLOR(HUE, tau/nTau), caption = sprintf("Varying production time considered (in days); fixed parameter: a=%a (step)", indexA)), tau = 1 ..nTau)]


I thought that
1..nDays, 1..nB
were the indices for the firts and third terms (in this case) of the M array. But as you pointed, they were the arrays for the axis tickmarks.

So the command that did the trick was:
all_fixed_b_plots := [seq(surfdata(M[..,indexA,..,tau], 1..nDays, bMin..bMax, labels = ["n (days)", "b", "RBCs produced \n(millions of cells/mcL)"], opts, view = viewRBC, color = COLOR(HUE, tau/nTau), caption = sprintf("Varying production time considered (in days); fixed parameter: a=%a", aMin+sensitivityA*(indexA-1))), tau = 1..nTau)]

So this is the result I had previously:
 


And this is the one I was looking for and the one I got thanks to your explanations:
 

 

As always, thank you for having cast light on this.
jon

@tomleslie 

Dear Tom,

thanks for your early reply.

Your solution is working only partially.

My aim is to have my variable points or points where my funcion is evaluated as the tickmarks. However, although Maple effectively prints the tickmarks give by axis[1]=[tickmarks=xvals], it prints them as if the scale or length of the axis were the one specified by default.

That is, my function is evaluated just at [0.5,1,1.5,2]. The default behaviour of surfadata is to plot the [1,2,3,4] axis tickmarks, which I guess are just the indices of the former array. If I use the option you suggested the [0.5,1,1.5,2] tickmarks are effectively displayed, but they just cover the former axis' 1 to 2 stretch.

I would dare to say that the tickmarks should span over the whole axis length, since I have only used those four points to evaluate my function.

I am using Maple 17, and I'd dare to say that the worksheet is running fine on my side (now including an attempt to incorporate the command suggested and the result): MapleSimulation_test11.mw

Thanks,
jon

@acer 

Dear acer,

thanks again. That's exactly what I was looking for.

Kind regards,

jon

@acer 

Dear acer,
first of all, sorry for the delay in answering.

Second, thanks for the time you spent in trying to solve the questions, and the effort you made in explaining the issues that I ignored. It indeed helps a lot.

Yes, in the first file I submitted, the plot command was taking an array M that was meant to be N. Sorry.

Just the same way, n0 was meant to be indexN0. Sorry again.

And yes, sometimes some instances of the variables turn out to have text format instead of Math 2D Input. Sorry for not having cross-checked.

 

OK, understood that what made the trick for surfaces ('surfdata') was the generation of a sequence of surfaces by calling the 'seq' command.

 

Yes, your assumption about the question is right: I was trying to represent N vs its first dimension (time) for each r value. Sorry for not being that
clear.


OK as for the first approach. Looks to me quite an smart solution.

OK as for the explanation about the second approach. It's been quite interesting to know how to generate the tickmarks.

 

So it's been a thoroughly interesting and enlightening lesson, acer.

 

Thank you very much once again.

jon

@Christopher2222 

Hi there,
thanks for your answer Christopher. It works, indeed: 

 

However, I wanted to reproduce, if possible, a strategy that is valid at least for surface data, where for a matrix
A := Array(1..nDays,1..bMax,1..thetaMax,1..pMax,datatype = float[8])

the following single command would plot in the same graph all surfaces for varying theta and b (parameters), for all data points (free variable n), for a fixed p

opts := transparency = .3, style = surface;
all_theta_fixed_m_plots := [seq(surfdata(A[n,..,..,1], 1..nDays,1..thetaMax,labels = ["b", "theta_m", "n"], opts, color = COLOR(HUE, (1/10)*n)),n = 1..nDays)];
display(all_theta_fixed_m_plots);


Or where the following command would individually plot all possible combinations of parameters p and b within the given ranges

all_b_m_plots := [seq([seq(surfdata(A[..,..,b,m], caption = sprintf("b=%a m=%a", b, m)), m = 1..pMax)], b = 1..bMax)];
display(Array(all_b_m_plots));

The working sheet that illustrates the above is this: MapleSimulation_test4.mw

That is, there is a single surfdata command that seems to generate a family of surfaces.


In my case, I do not have surfaces, but curves. However, I guess the principle stays the same.

 

Each curve should be colored with a different color.

 

The starting working sheet for this particular case is: MapleSimulation_test9a.mw

 

Any hint?


Thanks,
JON HAITZ

Anybody, please?

 

Thanks,

jon

Hi there,

sorry, my previous attemps had one more error when it came to displaying the results. This version fixes that issue, but Maple still says that the points are not in the correct format: MapleSimulation_test6.mw

 

BTW, can the legend contain some parameters? Say, if I want to include the value of a variable (one of the value of the parameters a given curve or plot corresponds to), how would I include a variable in the legend?

 

Thanks again,

jon

1 2 3 4 Page 3 of 4