Questions tagged [event-detection]
Questions on events in differential equations, which may arise from WhenEvent or discontinuous coefficients in the commands NDSolve and DSolve.
144
questions
4
votes
1
answer
140
views
How can I use WhenEvent to make one object (follower) follow another obect (mover) with a gap between them?
My problem
I'm trying to implement a program in Mathematica where a "follower" moves with a "mover." Both the mover and the follower move up and down. Specifically:
1. There is a ...
8
votes
1
answer
234
views
Why can't I use logic operator Or to specify multiple events with WhenEvent?
I want to use logic operator Or to specify multiple events.
After reading these very helpful posts here and here, it seems to be better to use a function to inlude ...
1
vote
0
answers
69
views
Why does WhenEvent not work with DiscontinuitySignature and the Brent location method?
Why is it not possible to use "LocationMethod" -> "Brent" to locate an event when the action is ...
2
votes
1
answer
95
views
Why doesn't the action in my code using WhenEvent option of NDSolve work?
I'm trying to solve two ODEs, and I want to restrict the variables y1[t] and y2[t] from being less than the constant ...
2
votes
0
answers
80
views
NDSolve with integrated event, discrete variable and arbitrary-precision arithmetic gives error
I'm trying to solve an ODE numerically with NDSolve but get an unexpected error message (Experimental`NumericalFunction::nlnum1),...
0
votes
0
answers
97
views
Mod[] does not work correctly in WhenEvent
From the expression we know Mod[t,1]==0 and Sin[2 [Pi] t] > 0 are equivalent in WhenEvent. This can be seen from the results below.
...
2
votes
1
answer
80
views
Discrete number does not work well in DSolve
The code below works fine.
...
2
votes
1
answer
148
views
Which condition is better for WhenEvent?
I'm solving a non-linear system with NDSolve. See my previous post
In the WhenEvent, which one is better for ODE solving
...
3
votes
2
answers
250
views
Is there a way to improve the speed of the NDSolve in my code?
I want to tell the background before raising the question of details.
My boss and I are designing synthersizer in a millimeter-wave chip. He analyzes the transient behavior with Julia. His code is ...
2
votes
1
answer
66
views
Event control in delay differential equations
A delay-differential system for variables {y[t],z[t]} is defined by time-lag w
{y'[t] == (r (1 - y[t] - z[t]) - 1) y[t],
z'[t] == (y[t] - y[t - w])};
The ...
1
vote
1
answer
84
views
Dynamically generate system to use with NDSolve
I have a d-dimensional differential equation that I want to solve that takes the following form:
When d = 1:
...
0
votes
0
answers
40
views
How can I resolve the error in using WhenEvent to solve the cooling of liquid, where the cooling coefficient changes for some time?
I am trying to solve the cooling of liquid in which the cooling coefficient changes for some time. I attempted to solve it using WhenEvent, but it is showing an error.
...
1
vote
0
answers
69
views
Multiple function definition inside a whenevent [closed]
I am trying to implement a whenevent inside a NdSolve such that when a particle reaches within earths radius its position becomes a constant <0,0,0>. When I set one function x[t]-> 0 it works....
5
votes
4
answers
254
views
Detecting existence of period orbit
I wish to detect the existence of a periodic orbit (limit cycle). For example, the test should return FALSE (i.e. it should fail) for the left (m = 0.35) and ...
1
vote
1
answer
96
views
Code involves WhenEvent and DiscreteVariables no longer works [duplicate]
Bug introduced after 10.0, in or before 10.3, persisting through 13.2.1
The exact problem I am dealing with has already been asked and answered here.
Unfortunately the solution no longer seems to ...
2
votes
0
answers
39
views
Why doesn't ParametricNDSolve execute the action of WhenEvent, except the first occurrence?
I'm trying to create a ParametricFunction object using ParametricNDSolve targeting a system of equations that involves WhenEvent and DiscreteVariables. For some reason I fail to discover, the ...
2
votes
1
answer
174
views
How to change NDSolve equations at every Event detection?
According to this tutorial on Event Actions for NDSolve, if $x'[t]=f(t,x(t))$:
it is not possible to set the derivatives x'[t], since those are determined explicitly from the function.
In my case, I ...
3
votes
1
answer
200
views
WhenEvent with multiple actions
I have a 'WhenEvent' where I want two actions to be performed. I thought the actions should be in a list but this does not seem to work. Here is an example there are two actions in the 'WhenEvent'.
<...
1
vote
1
answer
66
views
Nminimize output of ParametricNDSolveValue
I want to minimize the time a family of ODEs vanishes.
To do so, I'm using WhenEvent to extract the vanishing time and put the result inside Nminimize:
...
4
votes
1
answer
108
views
Discontinuous ODE results in NDSolve::ndinid warning, initial condition is not in the range specified by the discrete variable (internal variable)
The equations and code are below.
The short version is:
I know the error is because NDSolve is doing something in the background to handle the discontinuous ODE. ...
3
votes
1
answer
97
views
Using WhenEvent in ParametricNDSolveValue
I want to solve an ODE and find the time the function y(t) vanishes.
...
4
votes
1
answer
548
views
Bifurcation diagram for Lorenz attractor
As I was following a similar question I came across a beautiful answer here. However, in that code, he used InternalBag[] which heavily depends on ram that I can't ...
8
votes
2
answers
288
views
Detect an event in NDSolve that is initially true
I want to check at what time the derivative of a function converges to zero. If the function starts far from equilibrium, the event is detected correctly at ...
0
votes
1
answer
228
views
Sticky Collisions (perfectly inelastic)
There is an awesome simulation https://mathematica.stackexchange.com/a/124926/87086 which shows N particles bouncing in a box (with elastic collisions), made by @Feyre https://mathematica....
1
vote
0
answers
49
views
WhenEvent to resolve NDSolve Singularity
I'm trying to use NDSolve to solve the following ODE:
...
3
votes
1
answer
86
views
Using WhenEvent to stop N objects at a boundary
I am attempting to implement an event into my simulation which makes any moving particle in an electric field completely stop at the instant they pass some specified threshold.
I was trying to utilize ...
3
votes
0
answers
157
views
Problem with a DAE and DiscreteVariables (II)
I continue with a DAE problem similar to another one posted here some days ago. @bbgodfrey offered a solution for the DiscreteVariables problem but now I have a ...
8
votes
2
answers
253
views
Problem with a DAE and DiscreteVariables
Cross-posted in Wolfram Community.
I am solving an DAE problem with NDSolve. It is a physical problem related to friction forces: one mass on the X axis and ...
9
votes
3
answers
536
views
2
votes
1
answer
88
views
WhenEvent for equation defined outside NDSolve
Say i want to use WhenEvent to specify a value of R[s] when my function Dsonic[s]==-3.
For some reason i get an error message. Seems that mathematica cannot read my function.
Here is my code.
Thank ...
1
vote
2
answers
337
views
How to reset an event counter to zero after every nth evaluation while using Experimental`ValueFunction to observe for value changes in counter
Synopsis
Below serves as a skeleton for a function that will track number of occurrences of a particular notebook event. The nth event will trigger a function call. After which the counter symbol must ...
1
vote
0
answers
48
views
1
vote
0
answers
89
views
Driving along a Beziercurve with given velocity
In this model I try to describe the kinematics of a point moving along a beziercurve b[u] (bezier parameter 0<u<1) with prescribed velocity ...
0
votes
2
answers
145
views
Using NDsolve with WhenEvent is not working
I am trying to use WhenEvent in this nonlinear equation system:
$\ddot r-\dot\phi^2r+9.8(\sin\phi-0.7\cos\phi)=0$
$1.2(1+20(r^2+2^2+4r\sin\phi)^2)\ddot\phi+\dot\phi+...
6
votes
1
answer
173
views
Plot3D + WhenEvent + NDSolve
Given:
$\begin{cases} \dot{x}=-x-By^2 \\ \dot{y}=Ax-y^3 \end{cases}$
where $x,y$ - variables;
$A=[2;4],B=[0.2;2]$ - positive parameters;
My task is to find the time $t_n$ of the first intersection of ...
0
votes
0
answers
96
views
How to use WhenEvent?
I am trying to locate the time when $R=1,T=0,P=0$ in my system of equations, but I get the following errors:
here is the code:
...
1
vote
1
answer
202
views
WhenEvent how to handle events at the same time and detection order
I need to use WhenEvent inside NDSolve in which events happen simultaneously.
I show simple code to better explain my question:
...
1
vote
1
answer
197
views
WhenEvent disabled in NDsolve
I try to simulate particle motion in electric field. Ex and Ey is the intensity of electric field in X axis and y axis resepectively, which is related to the position of particle.
...
4
votes
1
answer
326
views
problem when using WhenEvent "StopIntegration" in NDSolve
I am trying to solve some system of nonlinear differential equations by using NDSolve. I am looking for a particular shape of the solution which definitely excludes ...
1
vote
1
answer
193
views
Solving the Stefan Problem with WhenEvent
The formulation of the problem:
I tried to solve it with MOL and the method of V.R. Voller:
The script:
...
0
votes
0
answers
76
views
Using WhenEvent to change initial conditions of a system of Ode
i want to solve a system of two differential equations and apply two conditions.
The first one is to stop the integration when the first condition (D1[s]==0,N1[s]==0) (in my code) is met.Lets say this ...
2
votes
2
answers
183
views
ParametricNDSolve for a system of two differentia equations
Is there a way to plot the system of the code below?
How can I get the value of s for WhenEvent happens for each parameter?
<...
1
vote
0
answers
336
views
If condition in differential equation
I need to plot the Integrate the Fire model of neuron. The differential equation is $\frac{dV}{dt} + \frac{V}{\tau} = \frac{I}{C}$. The initial condition is $V(0) = 0$. And there is this condition if ...
1
vote
1
answer
160
views
Problem with ParametricNDSolveValue & WhenEvent
I have a set of coupled differential equations, which I am trying to integrate parametrically. Rast is the parameter that is being varied. My code is as follows:
<...
0
votes
2
answers
203
views
Finding the solution for argument of interpolating function for known functional value
Suppose I want to numerically determine the location of an object falling vertically in a gravitational field from an arbitrary height h. I know that I can use <...
1
vote
0
answers
92
views
"If" not working when solving piecewise differential equation
This is a part 2 to my previous question:
Solving Piecewise Differential Equation
I am embarking on a physics project and this is the simulation that I would like to do. More information is included ...
1
vote
1
answer
106
views
Doing something when a condition is met
I am attempting to solve a set of coupled differential equations using ParametricDSolveValue. I want a point, where a condition is met, to be marked on the corresponding plot.
The condition I want the ...
1
vote
0
answers
106
views
`NDSolve & WhenEvent` return interpolation function with duplicate points ! How to avoid?
In a simple example I switch the ode depending on two events.
...
0
votes
1
answer
164
views
WhenEvent doesn't work as expected when the condition is satisfied in the first step
I have noticed strange behavior of WhenEvent in the case where the body of WhenEvent is satisfied in the first step. For example,
...
9
votes
3
answers
317
views
Solving a Nonlinear Complementary Problem (plasticity)
I would like to solve the following: given $t\mapsto\sigma(t)$ and $E>0$, $\sigma_y>0$, find $\epsilon$ such that:
$$\left\lbrace\begin{array}{l}g(t,\epsilon)\geq 0,\\ \phi(t,\epsilon,\epsilon')\...