# 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
Filter by
Sorted by
Tagged with
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 ...
• 1,467
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,467
1 vote
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 ...
• 31
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 ...
• 1,467
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 (ExperimentalNumericalFunction::nlnum1),...
• 31
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. ...
• 1,005
80 views

### Discrete number does not work well in DSolve

The code below works fine. ...
• 1,005
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 ...
• 1,005
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 ...
• 1,005
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 ...
• 53
1 vote
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: ...
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,065
1 vote
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....
• 21
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 ...
• 349
1 vote
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 ...
• 11
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 ...
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 ...
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'. <...
• 16.6k
1 vote
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: ...
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. ...
97 views

### Using WhenEvent in ParametricNDSolveValue

I want to solve an ODE and find the time the function y(t) vanishes. ...
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 ...
• 2,688
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 ...
• 47.2k
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....
• 373
1 vote
49 views

### WhenEvent to resolve NDSolve Singularity

I'm trying to use NDSolve to solve the following ODE: ...
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 ...
• 373
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 ...
• 165
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 ...
• 165
536 views

...
• 27k
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 ...
• 101
1 vote
337 views

### How to reset an event counter to zero after every nth evaluation while using ExperimentalValueFunction 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 ...
• 2,467
1 vote
48 views

...
1 vote
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 ...
• 55.5k