Rk4 Definition and 25 Threads

  1. harryharns

    C/C++ Perform RK4 between 2 Clusters in Magnetic Field

    I have a simulated data of charged particles in a magnetic field. I have selected clusters, each cluster contains a set of points(x,z) and I want to perform RK4 between the first and second clusters and fill the positions in a histogram. I have selected the clusters with the initial...
  2. D

    I RK4 with adaptative step versus fourth order leapfrog integrator

    Summary: I am trying to solve the trajectory of particle in a time independent field and I'm looking for the most efficient way, ie smallest error on the energy for a given calculation's time. I thought 4th order leapfrog integrator was better than RK4 but quick try does not seems to agree...
  3. M

    A Efficient Computation of k2 in RK4 for Numerical RHS | PF Discussion

    Hi PF! I am trying to compute ##d_t y = d_x u^2##. Following standard RK4 procedure outlined by wikipedia as https://en.wikipedia.org/wiki/Runge–Kutta_methods I am forced to compute ##k_2##. If the RHS is analytic, the fractional stepping is direct. However, the RHS gradient is finite...
  4. chastiell

    About chua circuit numerical solutions

    hi all ! i'm trying to solve numerically the chua circuit set of differential equations , I am using the equations showed in this pdf: http://nonlinear.eecs.berkeley.edu/chaos/RobustOpAmpRealizationOfChuaCircuit.pdf i have the real circuit mounted and I'm using its parameters for the numerical...
  5. B

    Solving Spring System with RK4: Step-by-Step Guide

    I'm not sure if this is the appropriate place, but I've just been searching, with no luck, on how to solve a spring system with RK4 (hence the math section, since it's a Runge Kutta question). How would you set it up to change position based on spring properties? I haven't really found any...
  6. T

    System of ODEs with RK4 & step doubling in Fortran : damping

    Hello, I'm recently trying to code a solver for a system of differential equations u'(t) = F(t,u), using a Runge Kutta 4 method with an adaptative stepsize. For this, I'm using the 'step doubling' method, which is the following : suppose that we now the solution u(i) at time t(i). Then, the...
  7. mlouky

    Fortran I to solve ODE with rk4 y" + 2y =0 in fortran

    How can i solve y" + 2y =0 with RK4 and their program fortran please I néed your helpe
  8. MrOmar

    Need help solving a differential equation numerically

    Hello all, I am currently trying to solve a differential equation numerically. The equation is as follows: dv/dt = (u*q)/(m0-q*t) - g - (cd*ρ*A*0.5)*v2 If you haven't already guessed, it's the rocket equation with added gravity and drag. Now, I'm not even sure if that's what it's supposed to...
  9. R

    MHB Help with motions of a double pendulum using RK4

    Hello everyone, :)I hope you consider this the right place for this question. I have been working way to long on making a model of a double pendulum using the RK4 method with excel. I have these four equations that I should be able plug into RK4 I know that the first two equations for...
  10. DivergentSpectrum

    How do I apply rk4 to a second order pde?

    Im writing a program that calculates the trajectory of a particle in an arbitrary force field. the force field is a vector function of position (x, y, z) AND velocity (x', y', z'). Rk4= runge kutta forth order method Please help. Thanks!
  11. R

    Solving Non-Linear ODEs with RK4 Method: Time Step Considerations

    Hi, I am having a problem implementing 4th Order Runge Kutta (RK4) to solve a non linear ODE. dy/dt = B(t) - A(t)*y(t)^2 where the coefficients A(t) and B(t) are specific to the problem I am working on. For the test case I am running I specify a sinusoidal signal and from this signal...
  12. L

    How can I overcome errors in RK4 due to linearly interpolated data?

    I am simulating an ODE where the differential function is a function of sampled data points and are having trouble obtaining data in between sampled points (for the step computations of RK4). The first thing that I tried was to linearly interpolate the data, but that introduced large...
  13. D

    MHB Pseudo-spectral with RK4 integration

    I using the pseudo-spectral method with RK4 integration to solve the nonlinear KdV equation. My code works for both the linear KdV and the NLS equation; however, it nots working right for \(u_t + u_{xxx} + 6uu_x = u_t + u_{xxx} + 3(u^2)_x = 0\). I want to view from \(0\leq t\leq 10\) and...
  14. A

    Practical Examples of RK4 Method for Second Order Differential Equations

    Hello, I need some examples of practical second order differential equation that can be solved by Runge kutta method. I tried searching on net but couldn't find a satisfying answer. Please help.. Thanks in advance
  15. H

    Runge-Kutta 4th order method (RK4) for second order Diff Eq

    Homework Statement Hello, maybe this is due to my lack of understand of RK4, but I have an equation: x'' + b^2*x=0 (derivatives with respect to variable t) and I need to use RK4 to find the solution on an interval. I can readily find solutions analytically, but my understanding of RK4...
  16. A

    RK4 for a system of 2 second order DEs

    1. For this problem, we are asked to design a MatLab/Octave code that will calculate and plot the orbit of a sattelite 2. We are given the following 2nd order equations x''= \frac{-x}{( \sqrt{x^{2}+y^{2}})^{3}} y''= \frac{-y}{( \sqrt{x^{2}+y^{2}})^{3}} We can convert this into the...
  17. A

    C/C++ Two Body problem with RK4 in C++

    I want to output an excel file with the results of the trajectories of a two body problem, with initial position and velocity. But my program is not compiling. Any suggestions/problems that you can see? #include <iostream> #include <vector> #include <fstream> using namespace std...
  18. J

    Python Two Body problem in python using RK4

    So I am writing a program in python to do RK4 for the two body problem. I want it to display a sphere moving around another. It currently displays one sphere for a split second and then it goes blank. Any suggestions? from __future__ import division from visual import * from visual.graph import...
  19. S

    MATLAB Solving RK4 Integration with Matlab for Paths

    Hi, I am trying to apply the fourth order Runge-Kutta integration method to a problem but I'm not sure exactly how to do it. I have a matrix which represents a coordinate system (x, y) with varying degrees of height at each point. Using Matlab, I made a matrix with a gradient (u and v...
  20. M

    Exploring the Errors of RK4 Method for y' = -2y + x, y(0) = 1

    Homework Statement Consider the initial value problem y' = -2y + x, y(0) = 1 The analytical solution is y(x) = (1/2)x2-(1/4) + (5/4)e-2x a. Approximate y(0.1) using one step and the RK4 method. b. Find a bound for the local truncation error in y1. c. Compare the error in y1 with the...
  21. I

    RK4 Solver Issue: Shoot the Moon with C Program

    Hey Folks, So I've been making an 4th order Runge-Kutta program for finding a way to shoot the moon with a spacecraft . However for some reason the RK4 part of the program does not work and I cannot figure it out. I've written it in C and attached the file. If someone who is more well...
  22. P

    How Do I Implement the RK4 Method for an N-Body Problem?

    Homework Statement Implementing the 4th order Runge-Kutta method for an n-body problem Homework Equations The RK4 method for the IVP y' = f(t,y), y(t0) = y0, is given by y_(n+1) = y_n + (1/6)(k1 + 2 k2 +2 k3 + k4) t_(n+1) = t_n + h where k1 = h f(t_n,y_n) k2 = h f(t_n+ h/2, y_n + k1/2) k3...
  23. G

    Python Help with Python RK4: Solving Error Plotting 1st Order ODE

    i have been attempting to plot a first order ODE with pyhton's rk4 i can't display the graph and i have been having this error: Traceback (most recent call last): File "C:\Documents and Settings\AP155user38\Desktop\gladys python codes\differential equations and runge-kutta\1ODE.py"...
  24. L

    RK4 in solar system simulation (n-body problem)

    [SOLVED] RK4 in solar system simulation (n-body problem) Hi, I'm making a simulation of the solar system and have so far been using euler's method to integrate my equations of motion - and i'd like to upgrade to a 4th order runge-kutta method. I'm having a lot of trouble understanding the...
  25. S

    How Can Momentum Improve RK4 Integration in Vehicle Physics?

    I'm writing a vehicle physics engine and am using an RK4 integrator which I wrote. But I am having huge problems with angular motion. Long story short I thing it might be to do with the fact that I'm integrating from accelerations. So I'm re-writing the integrator using momentum. However I'm...
Back
Top