diffeq | Basic Ordinary Differential Equation solvers
kandi X-RAY | diffeq Summary
kandi X-RAY | diffeq Summary
Basic Ordinary Differential Equation solvers
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of diffeq
diffeq Key Features
diffeq Examples and Code Snippets
Community Discussions
Trending Discussions on diffeq
QUESTION
I am fairly inexperienced when it comes to coding & I need help plotting multiple lines on one graph. I am using a diffeq solver and need to input different values for a constant that feeds into other equations and plot the solution for each value of the constant (in this case I will be looking at Ha from 6x10^3-6x10^8, changing by x10 each time). I will paste some of my code below, & would greatly appreciate any help!
...ANSWER
Answered 2022-Mar-01 at 08:00You put the integration and plotting in a loop.
QUESTION
I am trying to solve a Differential Equation with 4th Order Runge - Kutta method in Python3. The function is deliberately made so that the solution goes to infinity.
My issue is that I have been asked to plot the iterative solutions, but cant seem to understand how to handle the infinity, when storing the iterator and the respective solution values in a list inside the for
loop, and when I call that list outside the loop. Below is the entire code and result pane with the error message.
ANSWER
Answered 2022-Feb-02 at 10:49You can use numpy's np.exp
instead of math.exp
to handle infinity:
QUESTION
I am making an separable differential equation solver. In order to make an expression that separated by x and y variables I have to divide expression on the right by every variable that belong to s such as sin(y), e**y, y**2, ...
I am using Sympy
ANSWER
Answered 2022-Jan-19 at 16:15Since you are using SymPy, why not use its solver for such equations?
QUESTION
I am learning sympy
and first order linear difference equations.
The solution is y(n) = n^{2}*.25 + n*.625 + 0.28125*(1-(-3)^{n})
for the equation y(n) = x(n)-3y(n-1)
with initial conditions y(-1)=0
and x(n) = n^{2}+n
.
I am stuck at solving, this is what I have:
...ANSWER
Answered 2021-Nov-20 at 14:03You are using dsolve
but dsolve
is for ordinary differential equations. Your equation is a difference equation or more precisely a linear recurrence. The rsolve
function is for solving recurrence relations:
QUESTION
I'm trying to simulate a reflecting boundary. Based on the suggestions found here: Stochastic differential equation with callback in Julia I tried
...ANSWER
Answered 2021-Sep-04 at 10:07It's really just saving. The way you had it would save every step, which means it would "save, reflect, save". What you really want are just the post-reflection saves:
QUESTION
I'm trying to write an integrator which uses long doubles for very high precision. I know that my system architecture has long double support, but for some reason, the precision of my integrator maxes out at 16 significant digits. Here's some code which recreates what I'm seeing. The integrator for this example was adapted from this source. In this test case, I am using it to calculate Euler's number (I apologize for the length of the code block but I can't recreate the behavior any other way):
...ANSWER
Answered 2021-May-20 at 04:04but for some reason, the precision of my integrator maxes out at 16 significant digits.
At a minimum, use more correct values of long double
initialization with long double
quotients rather than double
quotients.
QUESTION
Let's suppose the example 1 of the bouncing ball with multiple walls in the page:
https://diffeq.sciml.ai/stable/features/callback_functions/
And consider the condition:
...ANSWER
Answered 2021-Feb-08 at 08:30Consider the code later on on the same page you listed:
QUESTION
I want to implement the adjoint sensitivity analysis in python, in order to determine the gradient of my objective function with respect to some parameters. In specific the objective function depends on the solution of a differential equation which in turn depends on said parameters which I am looking to find the optimum of.
To perform this there are numerous good packages both in Julia (see here), as well as CVODES from SUNDIALS, however the latter which does apparently have a wrapper made for python, does not include sensitivity analysis capabilities according to this link. Furthermore, I have looked into SALib for sensitivity analysis, but as far as I understand this refers to some other type of 'sensitivity analysis' and therefore adjoint or even forward sensitivity analysis is not included (correct me if I am wrong on this one).
Thus my question is, does a version of CVODES exist in python with sensitivity analysis capabilities, or is there there any other package where one can use in order to perform adjoint sensitivity analys?
...ANSWER
Answered 2020-Dec-15 at 12:08You can easily call Julia code / packages from Python with pyjulia. https://github.com/JuliaPy/pyjulia
QUESTION
I am trying to get the differential equation y'=sin(x) however my differential equation will not run any further as I get the error "can't convert expression to float". If I use numpy with np.sin(x), I get another error "loop of ufunc does not support argument 0 of type Symbol which has no callable sin method". Here is the code:
...ANSWER
Answered 2020-Sep-30 at 21:01You are calling sin()
with an argument that it doesn't support. math.sin()
must take a numerical value as its only argument.
I think to fix the problem, you just need to pass the function's name instead of calling it:
QUESTION
I want to solve the matrix-form time-dependent Schrodinger equation on 3d lattice with DifferentialEquations.jl,
i.e., (∂/∂t)ψ = -iHψ ,where ψ is a vector and H is a (time-independent) matrix.
I tried to write the code like this.
ANSWER
Answered 2020-Aug-30 at 15:31ψ0 = [] # Initial conditions
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install diffeq
Rust is installed and managed by the rustup tool. Rust has a 6-week rapid release process and supports a great number of platforms, so there are many builds of Rust available at any time. Please refer rust-lang.org for more information.
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page