I am trying solve an ordinary differential equation numerically, $\,dy/dt=10e^{-(t-2)^2/2(0.075)^2}-0.6y\,\,$ with an initial value and initial step size between $t=0\, and\, t=4$. In my code I implement an embedded Runge-Kutta formulation: Calculating two tentative estimates using RK2 and RK3 formulae with the same step size and the difference between them is the error for RK2. Then I compare this difference (will simply called 'error') with a value (an acceptable error) which actually is not a set number but is obtained through $10^{-3}*\lvert y_{current}\rvert$ or $10^{-6}$ whichever is larger ($y_{current}$ is the present estimate) If the error is greater than the acceptable error I update step size with $h_{new}=h_{old}(\frac{acceptable\, error}{error})^{\frac{1}{3}} $ and if the error is less than or equal to the acceptable error, the latest step size $h_{old}\,$is used to estimate the function value and the independent variable t is increased by that amount. The issue starts after that: I want to increase the step size and do not want to proceed with $h_{old}\,$ for the next set of RK calculations after establishing $y$. What are convenient ways of increasing my step size? Would using the formula $h_{new}=h_{old}(\frac{acceptable\, error}{error})^{\frac{1}{3}} $in reverse help?
2026-03-27 18:18:03.1774635483
An adaptive step size solver for an ODE
322 Views Asked by Bumbble Comm https://math.techqa.club/user/bumbble-comm/detail At
1
There are 1 best solutions below
Related Questions in ORDINARY-DIFFERENTIAL-EQUATIONS
- The Runge-Kutta method for a system of equations
- Analytical solution of a nonlinear ordinary differential equation
- Stability of system of ordinary nonlinear differential equations
- Maximal interval of existence of the IVP
- Power series solution of $y''+e^xy' - y=0$
- Change of variables in a differential equation
- Dimension of solution space of homogeneous differential equation, proof
- Solve the initial value problem $x^2y'+y(x-y)=0$
- Stability of system of parameters $\kappa, \lambda$ when there is a zero eigenvalue
- Derive an equation with Faraday's law
Related Questions in NUMERICAL-METHODS
- The Runge-Kutta method for a system of equations
- How to solve the exponential equation $e^{a+bx}+e^{c+dx}=1$?
- Is the calculated solution, if it exists, unique?
- Modified conjugate gradient method to minimise quadratic functional restricted to positive solutions
- Minimum of the 2-norm
- Is method of exhaustion the same as numerical integration?
- Prove that Newton's Method is invariant under invertible linear transformations
- Initial Value Problem into Euler and Runge-Kutta scheme
- What are the possible ways to write an equation in $x=\phi(x)$ form for Iteration method?
- Numerical solution for a two dimensional third order nonlinear differential equation
Related Questions in SIMULATION
- planar Poisson line process & angles of inclination
- How to convert an approximation of CCDF for a standard normal to an approximation with a different mean and variance?
- Can I have a state as a input signal at a state space model?
- How to generate a large PSD matrix $A \in \mathbb{R}^{n \times n}$, where $\mathcal{O}(n) \sim 10^3$
- Finite-volume method applied to a particular advection equation
- Give two algorithms for generating a random variable.
- How do I tune an IMC(Internal Model Control) - controller?
- Simulating a divide area random variable
- How do I apply prediction to LQR controller?
- Distribution real case
Related Questions in RUNGE-KUTTA-METHODS
- Sensitivity (gradient) of function solved using RK4
- Solve fourth order ODE using fourth order Runge-Kutta method
- Prove that Runge Kutta Method (RK4) is of Order 4
- Applying second-order differential operator vs applying first-order differential operator twice?
- Adaptive step size Runge Kutta: getting a specific value
- PYTHON RK2 (Midpoint Method)
- Runge-Kutta Order Question
- fourth-order Runge-Kutta method producing values for $f(x)=\int_0^x e^{-t^2}$ (confusing answer key)
- Adaptive Step Size in RK45 for Second-Order ODE
- Runge kutta method for order 4 for ODE x'=f(t)
Trending Questions
- Induction on the number of equations
- How to convince a math teacher of this simple and obvious fact?
- Find $E[XY|Y+Z=1 ]$
- Refuting the Anti-Cantor Cranks
- What are imaginary numbers?
- Determine the adjoint of $\tilde Q(x)$ for $\tilde Q(x)u:=(Qu)(x)$ where $Q:U→L^2(Ω,ℝ^d$ is a Hilbert-Schmidt operator and $U$ is a Hilbert space
- Why does this innovative method of subtraction from a third grader always work?
- How do we know that the number $1$ is not equal to the number $-1$?
- What are the Implications of having VΩ as a model for a theory?
- Defining a Galois Field based on primitive element versus polynomial?
- Can't find the relationship between two columns of numbers. Please Help
- Is computer science a branch of mathematics?
- Is there a bijection of $\mathbb{R}^n$ with itself such that the forward map is connected but the inverse is not?
- Identification of a quadrilateral as a trapezoid, rectangle, or square
- Generator of inertia group in function field extension
Popular # Hahtags
second-order-logic
numerical-methods
puzzle
logic
probability
number-theory
winding-number
real-analysis
integration
calculus
complex-analysis
sequences-and-series
proof-writing
set-theory
functions
homotopy-theory
elementary-number-theory
ordinary-differential-equations
circles
derivatives
game-theory
definite-integrals
elementary-set-theory
limits
multivariable-calculus
geometry
algebraic-number-theory
proof-verification
partial-derivative
algebra-precalculus
Popular Questions
- What is the integral of 1/x?
- How many squares actually ARE in this picture? Is this a trick question with no right answer?
- Is a matrix multiplied with its transpose something special?
- What is the difference between independent and mutually exclusive events?
- Visually stunning math concepts which are easy to explain
- taylor series of $\ln(1+x)$?
- How to tell if a set of vectors spans a space?
- Calculus question taking derivative to find horizontal tangent line
- How to determine if a function is one-to-one?
- Determine if vectors are linearly independent
- What does it mean to have a determinant equal to zero?
- Is this Batman equation for real?
- How to find perpendicular vector to another vector?
- How to find mean and median from histogram
- How many sides does a circle have?
Assume that you compute the step update resulting in $v_2,v_3,err$ so that $y_{k+1}=y_k+hv_2$ is the second order RK2 step, $\tilde y_{k+1}=y_k+hv_3$ is the third order RK3 step, and $y_{k+1}-\tilde y_{k+1}=h(v_2-v_3)=h\cdot err$ is the estimated error of the second order step.
Then $err=v_2-v_3$ is the error per unit step, or the error density. For consistent results this is the quantity to compare against the error tolerance. The optimal step size for the next step in the second-order method or a repetition of the current step is then $$ h_{opt}=\left(\frac{\max(atol,|y_k|\cdot rtol)}{|err|}\right)^{\frac12}\cdot h. $$ This is a best guess, one may reduce this slightly to increase the probability that the actual error growth remains below the level set by the tolerances.
One can use the 3rd order step with the step sizes for the 2nd order method, this will in general reduce the actual error to the level $(tol)^{\frac32}$. In the case of stiff equations there may be stability issues with this approach.
One can try to guess an optimal step size for the 3rd order method using $h\cdot err$ as proxy of its unit step error. This gives the formula $$ h_{opt}=\left(\frac{\max(atol,|y_k|\cdot rtol)}{|h\cdot err|}\right)^{\frac13}\cdot h. $$ This seems to be the formula that you are using. To repeat, this only works when using the RK3 step for the next value.
There is nothing to do in the case that a step is accepted, as if the error is smaller than the tolerance the first factor in the formula is larger than 1, so the step size increases.
There is of course a lot of uncertainty in this extrapolation approach, the error is not entirely correct for the method, the step size is only optimal for the last step. This might lead to chaotic oscillations in the sequence of the step sizes. Some kind of running average on the step sizes or the error quotients, or some other kind of dampening can improve the integration performance.