PatrickT

Dr. Patrick T

2108 Reputation

18 Badges

16 years, 303 days

MaplePrimes Activity


These are replies submitted by PatrickT

@Alejandro Jakubi 

interesting, but I'm not sure I follow. The help page states:

In Document mode, toggling between Text and Math modes switches between entering text and entering 2-D mathematical expressions
                              / 2\
                              |x |
                              |--|
                              \y /
In Worksheet mode, toggling between Math and Text modes switches between 2-D and 1-D Math commands.

I think what that is referring to is toggling the input mode, right? In other words, you can input 1-D and 2-D input within the same worksheet. What I meant to say was, the ability to toggle back and forth between 1-D and 2-D display of the same mathematical expression, is that possible? I have a feeling it is indeed feasible, because when you copy-paste a 2-D expression you can paste it as 1-D. (Not sure about the other way around though).

@Alejandro Jakubi 

interesting, but I'm not sure I follow. The help page states:

In Document mode, toggling between Text and Math modes switches between entering text and entering 2-D mathematical expressions
                              / 2\
                              |x |
                              |--|
                              \y /
In Worksheet mode, toggling between Math and Text modes switches between 2-D and 1-D Math commands.

I think what that is referring to is toggling the input mode, right? In other words, you can input 1-D and 2-D input within the same worksheet. What I meant to say was, the ability to toggle back and forth between 1-D and 2-D display of the same mathematical expression, is that possible? I have a feeling it is indeed feasible, because when you copy-paste a 2-D expression you can paste it as 1-D. (Not sure about the other way around though).

@Allan Wittkopf 

Thanks Allan, I hadn't paid enough attention to 'eventfired,' it is detailed in the Interactive Features section, which I hadn't read properly, as I didn't expect that it would apply to my problem (I had misunderstood the meaning of interactive).

In the end, I opted to run the same simulation several times, each time with different events and a different purpose, rather than having all the events listed at once. It may be unnecessarily redundant and not terribly efficient, I confess, but I found it easier this way to keep track of which events has fired. Indeed I found that with several events in action, the numbering of the events is not always transparent. For instance, with something like 'events' = [[a],[b],[c]], I ended up with as many as 7 events. I didn't try to find out why, but perhaps it is because an event of the form y(t) = 0 .. 1 counts as 2 events depending on the way in which it is triggered? or perhaps it is because some of the other options like maxfun were counted as events. I'm not entirely sure, but the bottom line is that I would get a message like "event 5 triggered a halt" and had to experiment for a while before I could figure out which one was "event 5". It was easier, in my case, to  deal with events one at a time in separate execution groups.

Thanks again Allan, your help has saved me a lot of time.

Patrick.

@Allan Wittkopf 

Thanks Allan, I hadn't paid enough attention to 'eventfired,' it is detailed in the Interactive Features section, which I hadn't read properly, as I didn't expect that it would apply to my problem (I had misunderstood the meaning of interactive).

In the end, I opted to run the same simulation several times, each time with different events and a different purpose, rather than having all the events listed at once. It may be unnecessarily redundant and not terribly efficient, I confess, but I found it easier this way to keep track of which events has fired. Indeed I found that with several events in action, the numbering of the events is not always transparent. For instance, with something like 'events' = [[a],[b],[c]], I ended up with as many as 7 events. I didn't try to find out why, but perhaps it is because an event of the form y(t) = 0 .. 1 counts as 2 events depending on the way in which it is triggered? or perhaps it is because some of the other options like maxfun were counted as events. I'm not entirely sure, but the bottom line is that I would get a message like "event 5 triggered a halt" and had to experiment for a while before I could figure out which one was "event 5". It was easier, in my case, to  deal with events one at a time in separate execution groups.

Thanks again Allan, your help has saved me a lot of time.

Patrick.

Hi John, any luck with the dll issue?

 

... and I wondered, do you have / know of a worked example of plottools:-getdata involving the different types of plot structure that Maple produces?

For instance, how to deal with a list of several "curves" and "points."  I just don't know how to get started here. Would you deconstruct the plot structure or would you keep them as one?

An example with minecraft or any other soft would be welcome, if you can point me to one without too much sweat!

Thanks a lot,

Here is the kind of structure I have in mind:

http://www.mapleprimes.com/questions/123177-Exporting-3D-Plots-In-Maple-15#comment123286

@Allan Wittkopf 

> The part that follows the trigger is a list of assignments that are to be performed when the trigger fires.

that's the crucial part I'd missed, I was looking for a conditioning which wasn't there!

So the syntax is something like this:

events = [[a,b]] --> trigger a only if b is true

events = [[a],[b]] --> trigger a and do b

correct me if I'm wrong.

thanks Allan, thanks a lot.

P.S.  looking at the help page on events, there really is an awful lot that can be done there to solve complicated differential equations problem, if one knows how to. This help page REALLY deserves to be exemplified, it seems rather unused as it is (google turns up very little work done using the full capabilities of events), unused potential there.

@Allan Wittkopf 

> The part that follows the trigger is a list of assignments that are to be performed when the trigger fires.

that's the crucial part I'd missed, I was looking for a conditioning which wasn't there!

So the syntax is something like this:

events = [[a,b]] --> trigger a only if b is true

events = [[a],[b]] --> trigger a and do b

correct me if I'm wrong.

thanks Allan, thanks a lot.

P.S.  looking at the help page on events, there really is an awful lot that can be done there to solve complicated differential equations problem, if one knows how to. This help page REALLY deserves to be exemplified, it seems rather unused as it is (google turns up very little work done using the full capabilities of events), unused potential there.

intriguing! also as Alejandro said, these tools are also known in France as "pistolet" or "perroquet." I remember hearing the name "perroquet" in primary school but don't remember hearing "courbe française" ...

intriguing! also as Alejandro said, these tools are also known in France as "pistolet" or "perroquet." I remember hearing the name "perroquet" in primary school but don't remember hearing "courbe française" ...

@Allan Wittkopf 

Thanks Allan, very kind of you to reply. How shall I put it... I'm missing the plot completely.

Would you mind explaining in words what this example is intended to do? How does it answer the question: how do I subsequently "examine" the value of y(t) at the trigger time?

I understand that s1(t) and s2(t) are discrete variables that are used as a sort of counter. I understand that y(t) is the value "after" while "pre(y(t))" is the value "before." But what does the following line mean?

'events' = [ [ y(t), [ y(t) = 1, s1(t) = s1(t) + y(t), s2(t) = s2(t) + pre(y(t)) ] ]

The first part says, "trigger when y(t)=0", but what about the second part?

Why does this event affect the solution of the problem itself?

dsn(5.5);
[t = 5.5, y(t) = HFloat(0.4999999999999998), s1(t) = HFloat(5.0),

  s2(t) = HFloat(1.6067876196235176e-16)]

why is y(5.5) equal to 0.5 instead of -4.5?

ysol := dsolve( {diff(y(t),t) = -1, y(0) = 1}):
eval(ysol,t=5.5);
                         y(5.5) = -4.5

Is there anything special about t=5.5? Is that the date at which the event triggered, and if so why?

Thanks a lot for your help. As you can see, I am quite clueless.

@Allan Wittkopf 

Thanks Allan, very kind of you to reply. How shall I put it... I'm missing the plot completely.

Would you mind explaining in words what this example is intended to do? How does it answer the question: how do I subsequently "examine" the value of y(t) at the trigger time?

I understand that s1(t) and s2(t) are discrete variables that are used as a sort of counter. I understand that y(t) is the value "after" while "pre(y(t))" is the value "before." But what does the following line mean?

'events' = [ [ y(t), [ y(t) = 1, s1(t) = s1(t) + y(t), s2(t) = s2(t) + pre(y(t)) ] ]

The first part says, "trigger when y(t)=0", but what about the second part?

Why does this event affect the solution of the problem itself?

dsn(5.5);
[t = 5.5, y(t) = HFloat(0.4999999999999998), s1(t) = HFloat(5.0),

  s2(t) = HFloat(1.6067876196235176e-16)]

why is y(5.5) equal to 0.5 instead of -4.5?

ysol := dsolve( {diff(y(t),t) = -1, y(0) = 1}):
eval(ysol,t=5.5);
                         y(5.5) = -4.5

Is there anything special about t=5.5? Is that the date at which the event triggered, and if so why?

Thanks a lot for your help. As you can see, I am quite clueless.

I know how to find the time at which an event has triggered a halt. I also know how to query the value of a variable at the time that the event has triggered a halt. Here's how I do it. Denote by sol the solution of dsolve, and taking a large value of time, e.g. t=100:

using procedurelist:

subs(sol(100),t); # 'output' = procedurelist

using listprocedure:

rhs(sol(100)[1]); # 'output' = listprocedure

Thus if I'm interested in the value of the SECOND variable in my 3-VARIABLE system, I would use listprocedure and do:

rhs(sol(100)[3]); # 'output' = listprocedure

because the independent variable t takes up the first spot and therefore the SECOND variable is in the THIRD position of the output with listprocedure.

Now, this works when the event triggers a halt, e.g. event = [[rhs(SYS[3]), 'halt']]. But what if I don't want to trigger a halt but merely a "toend" or "tobegin" action? How do I query the time at which the "toend" action was triggered?

Say I have:

event = [[rhs(SYS[3]), 'toend'], [y(t) = 100 .. 10^10, 'halt']]

where the second event will trigger when the variable y(t) gets too large. With the method outlined above, I can only query an event that actually halted. I thought eventstop might be of use here, but couldn't work out how to use it.

Thanks!

I know how to find the time at which an event has triggered a halt. I also know how to query the value of a variable at the time that the event has triggered a halt. Here's how I do it. Denote by sol the solution of dsolve, and taking a large value of time, e.g. t=100:

using procedurelist:

subs(sol(100),t); # 'output' = procedurelist

using listprocedure:

rhs(sol(100)[1]); # 'output' = listprocedure

Thus if I'm interested in the value of the SECOND variable in my 3-VARIABLE system, I would use listprocedure and do:

rhs(sol(100)[3]); # 'output' = listprocedure

because the independent variable t takes up the first spot and therefore the SECOND variable is in the THIRD position of the output with listprocedure.

Now, this works when the event triggers a halt, e.g. event = [[rhs(SYS[3]), 'halt']]. But what if I don't want to trigger a halt but merely a "toend" or "tobegin" action? How do I query the time at which the "toend" action was triggered?

Say I have:

event = [[rhs(SYS[3]), 'toend'], [y(t) = 100 .. 10^10, 'halt']]

where the second event will trigger when the variable y(t) gets too large. With the method outlined above, I can only query an event that actually halted. I thought eventstop might be of use here, but couldn't work out how to use it.

Thanks!

@Allan Wittkopf 

I thank you for your help with setting up a condition on one of the derivatives of the ode system.

There are other parts of the help page that confuse me. One feature of dsolve,events I was interested in is related to pre(). I would very much like to "examine a prior value of a variable." I am probably interested in etiher of these:

– 

iteration (default): pre(u(t)) refers to the value of u(t) at the start of the current iteration.

– 

initial: pre(u(t)) refers to the value of u(t) at the start of the events at the current point (this value will never change during event iteration).

I don't fully understand the difference between them, but either one should be useful. How do I set up the call to events to examine the value of interest, say y(t), in the following?

dsolve({D(y)(t)=sin(t),y(0)=-1},numeric, events=[[sin(t),'halt']]):

where do the "initial" and "pre(y(t))" bits fit in the call to events? and how do I subsequently "examine" the value of y(t) at the trigger time?

thanks a lot!

 

@Allan Wittkopf 

I thank you for your help with setting up a condition on one of the derivatives of the ode system.

There are other parts of the help page that confuse me. One feature of dsolve,events I was interested in is related to pre(). I would very much like to "examine a prior value of a variable." I am probably interested in etiher of these:

– 

iteration (default): pre(u(t)) refers to the value of u(t) at the start of the current iteration.

– 

initial: pre(u(t)) refers to the value of u(t) at the start of the events at the current point (this value will never change during event iteration).

I don't fully understand the difference between them, but either one should be useful. How do I set up the call to events to examine the value of interest, say y(t), in the following?

dsolve({D(y)(t)=sin(t),y(0)=-1},numeric, events=[[sin(t),'halt']]):

where do the "initial" and "pre(y(t))" bits fit in the call to events? and how do I subsequently "examine" the value of y(t) at the trigger time?

thanks a lot!

 

First 40 41 42 43 44 45 46 Last Page 42 of 93