Solving a system of coupled integro-differential with idesolver in Python - python

I want to solve the coupled integro-differential system in the paper: "A model for capillary exchange" (1 and 2).(cf pitcure)](https://i.stack.imgur.com/0b6NM.png)
C=f(x,t)
Ct=g(t)
I think that the idesolver from Python is not efficient in my case, and I' like to get new suggestions to solve these equations.
Thank you
I want to obtain the evolution of Ct as a function of the time.

Related

Is there a way to solve any linear equation and system of linear equations all in one?

Note: I made this a while ago and have learned a lot more since then, enough to understand why what I was asking for was unrealistic. I also should have done more research into sympy before asking this question.
I want to create a program where you enter a linear equation or system of linear equations as a string and in return you get the value of the variable(s) you entered, like so:
equation = input('Expression: ')
# Code to solve your linear equation here
print(answer)
Just to be clear, I want to be able to solve things like x+5=10, or things like 2x+3y=29, and get an output that looks something like "5", or "4, 7" respectively.
I've tried searching multiple websites and some stack overflow questions, but all I've come up with are ways to solve systems of linear equations like 2x+3y=29 using numpy or ways to solve normal linear equations like x+5=10 but none that can do both.
Here's a list of 3 answers I found and why they didn't help:
https://www.mybluelinux.com/how-solve-any-linear-equation-in-python/
Offers a solution to solve normal linear equations, but cannot solve systems of linear equations
https://stackabuse.com/solving-systems-of-linear-equations-with-pythons-numpy/
Solves systems of linear equations, but can't solve linear equations like x+5=10
Is there a python module to solve linear equations?
Same reason as 2, most answers suggested NumPy, and the other answers there didn't solve my problem either.
I also searched some other websites and stack overflow questions, but they didn't work either for the same reasons as the 3 examples I listed.
There are plenty of existing packages to solve linear equations. However, they won't do your normalization work. You have to first transform your existing equations into standard form: an augmented matrix.
If you want to accept arbitrary linear equations, then you have to write code to do the preprocessing, such as turning
3*x + 10 = y - 5
into the standard form
v1 v2 c
(3, -1, -15)
Once you have every equation in canonical form, you pass the coefficients and constants to the existing package.

Kalman filter state equation with respect to dt (evolution of time)

I am implementing a kalman filter based on a paper. The state-space vector has 6 variables, as the state variable changes with the evaluation of time, and the paper also provides the differential equations of the variables with the evaluation of time (dt).
My question is that when implementing this concept in python, how I should use the differential equation with the dt. I was wondering to simply multiply the equation with dt but I think that this is not the solution as it is a differential equation. Kindly guide me in this respect. Also, I want to ask that as these equations will estimate the new states, so they should be added in the update step? Thanks!
There are two different useful functions for solving ODEs in scipy.integrate - scipy.integrate.odeint() and scipy.integrate.solve_ivp() for initial value problems. I don't know enough about your system to answer your last question.

Solving first-order ODE, which contains another ODE (odeint / solve_ivp in Python)

I'm trying to set up a fast numerical solver in Python for a differential problem of the form:
where r is some constant.
I want to integrate A over some time period, t of interest. However, this is complicated by the fact that the dA/dt equation includes another variable B, which itself is described by an ODE dB/dt. B is actually a vector, but I've simplified the expression to try and highlight my problems more clearly.
I currently have a solution using a manual Euler method: ie compute dB/dt (then use B = B_previous + dB/dt * dt) and manually step along using a fixed time step size dt. However, this is slow and unreliable. I imagine it would be far better to use the built-in ODE solvers in Numpy, but I'm not sure this is possible given the coupled nature of the problem I'm trying to solve?
Is this possible using Numpy odeint or solve_ivp please? And if so, can anyone suggest any pointers please! Thanks.
What you have is a coupled differential equation which are standard to solve using Runge kutta, Eulers, and many other methods. You can use this example to guide you in writting your python code:
https://scipy-cookbook.readthedocs.io/items/CoupledSpringMassSystem.html
Keep in mind that that not all equations can be solved with ODEINT. If your ODE is a "stiff" ODE then you will have to choose your algorithm precisely. The definition of a stiff ODE is not completely defined but usually they arise if you have large or non-integral powers of your dependent variable in your ODE.
The first step in solving a coupled ODE though is to use standard methods. If they don't work then look into something else.

multivariate optimization in python

anyone please let me know how to solve multivariate problems in python. The objective function is given in picture 1 and few constraints in picture 2
Objective function
Constraints
You are asking how to solve a linear integer programming problem in python. You could use Pyomo, PuLP or python-MIP to model your optimization problem and solve it with a suitable solver of your choice. Gurobi and Cplex are common commercial solvers (both offering a free academic-licence) while GLPK, SCIP or CBC are common used non-commercial ones.

Multilateration Algorithm

I'm trying to call upon the famous multilateration algorithm in order to pinpoint a radiation emission source given a set of arrival times for various detectors. I have the necessary data, but I'm still having trouble implementing this calculation; I am relatively new with Python.
I know that, if I were to do this by hand, I would use matrices and carry out elementary row operations in order to find my 3 unknowns (x,y,z), but I'm not sure how to code this. Is there a way to have Python implement ERO, or is there a better way to carry out my computation?
Depending on your needs, you could try:
NumPy if your interested in numerical solutions. As far as I remember, it could solve linear equations. Don't know how it deals with non-linear resolution.
SymPy for symbolic math. It solves symbolically linear equations ... according to their main page.
The two above are "generic" math packages. I doubt you will find (easily) any dedicated (and maintained) library for your specific need. Their was already a question on that topic here: Multilateration of GPS Coordinates

Categories