ode

Modelling a quantum harmonic oscillator/SHM

旧城冷巷雨未停 提交于 2020-06-25 21:41:30
问题 I need help to figure out why my ground state graph for b) looks wrong, here's the question in full: (I thought posting it in full would give context to the method I'm trying to use) (a) Consider a square potential well with 𝑉(𝑥)=0 in between two infinitely high walls separated by a distance 𝐿 equal to the Bohr radius, i.e. for all x in the interval [0,𝐿] . Write a function solve(energy, func) which takes the parameter energy and a python function 𝑓𝑢𝑛𝑐 . This function should solve the

Modelling a quantum harmonic oscillator/SHM

我怕爱的太早我们不能终老 提交于 2020-06-25 21:41:16
问题 I need help to figure out why my ground state graph for b) looks wrong, here's the question in full: (I thought posting it in full would give context to the method I'm trying to use) (a) Consider a square potential well with 𝑉(𝑥)=0 in between two infinitely high walls separated by a distance 𝐿 equal to the Bohr radius, i.e. for all x in the interval [0,𝐿] . Write a function solve(energy, func) which takes the parameter energy and a python function 𝑓𝑢𝑛𝑐 . This function should solve the

Python odeint with array in differential equation

淺唱寂寞╮ 提交于 2020-06-23 13:37:29
问题 I have next first order differential equation (example): dn/dt=A*n; n(0)=28 When A is constant, it is perfectly solved with python odeint. But i have an array of different values of A from .txt file [not function,just an array of values] A = [0.1,0.2,0.3,-0.4,0.7,...,0.0028] And i want that in each iteration (or in each moment of time t ) of solving ode A is a new value from array. I mean that: First iteration (or t=0) - A=0.1 Second iteration (or t=1) - A=0.2 and etc from array. How can i do

Non Negative ODE Solutions with functools in R?

南楼画角 提交于 2020-05-28 10:19:20
问题 I am trying to implement an R algortihm dealing with non-negative ODE Systems. I need something like ode45 in MATLAB to define states which have to be none-negative. I discussed about that already 3 years ago but with no real solution. deSolve is still not the way to go. I found some python code which looks very promising. Maybe this is possible in R as well. In the end I have to define a function wraper, as functools in python. What it does is pretty simple. Here is the code the of the

Non Negative ODE Solutions with functools in R?

给你一囗甜甜゛ 提交于 2020-05-28 10:15:46
问题 I am trying to implement an R algortihm dealing with non-negative ODE Systems. I need something like ode45 in MATLAB to define states which have to be none-negative. I discussed about that already 3 years ago but with no real solution. deSolve is still not the way to go. I found some python code which looks very promising. Maybe this is possible in R as well. In the end I have to define a function wraper, as functools in python. What it does is pretty simple. Here is the code the of the

Solving a BVP with scipy's solve_bvp

冷暖自知 提交于 2020-05-11 16:55:43
问题 I have a system of 3 differential equations (will be obvious from the code I believe) with 3 boundary conditions. I managed to solve it in MATLAB with a loop to change the initial guess bit by bit without terminating the program if it is about to return an error. However, on scipy 's solve_bvp , I always get some answer, although it is wrong. So I kept changing my guesses (which kept changing the answer) and am giving pretty close numbers to what I have from the actual solution and it's still

SIR model using fsolve and Euler 3BDF

可紊 提交于 2020-04-30 05:44:46
问题 Hi i've been asked to solve SIR model using fsolve command in MATLAB, and Euler 3 point backward. I'm really confused on how to proceed, please help. This is what i have so far. I created a function for 3BDF scheme but i'm not sure how to proceed with fsolve and solve the system of nonlinear ODEs. The SIR model is shown as and 3BDF scheme is formulated as clc clear all gamma=1/7; beta=1/3; ode1= @(R,S,I) -(beta*I*S)/(S+I+R); ode2= @(R,S,I) (beta*I*S)/(S+I+R)-I*gamma; ode3= @(I) gamma*I; f(t,