python matrix linear differential equation [closed] - python

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 7 years ago.
Improve this question
I have matrix differential equation diff(x) = A * x, x(0) = C, where:
x is 1 * N
A is N * N, and is a constant matrix.
I want to solve it with python. By the time I have found ways to get only approximate solutions, but I want to get an exact solution. What library can do it for me?

You can use sympy for symbolic mathematics in Python. In particular, look at sympy documentation on ODEs.

Related

How to find steps in a stepwise curve? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 10 months ago.
Improve this question
My goal is to display a non-decreasing stepwise curve F. For each x-axis point, computing the corresponding F(x) is fairly computational, hence discretizing the x-axis and computing every corresponding F(x) point may take a lot of time.
My idea is to compute the curve by dichotomy.
Starting with 0 and the end-point of the x-axis (say 100).
If F(0)=F(100), then F is constant.
Else F is not constant and I compute F(50).
If F(50) = F(0), then F is constant on [0,50] and I compute F(75) and so on.
Else if F(50) = F(100), then F is constant on [50,100] and I compute F(25) and so on.
Else I compute F(25) and F(75) and so on.
Is there any python librairy which would be useful to implement such an algorithm?

Solving an optimization problem with variable powers [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 1 year ago.
Improve this question
Can anyone point me to a tool (preferably in python or c++) to solve an optimization problem where in the objective has power fractions such as :
Maximize x1^0.2 + x2^ 0.3 + x3^0.4
Thanks
I think this should be possible in python with scipy.optimize
Since it allows fractional exponentiation
4**0.5 = 2
4**0.2 = 1.3195079
and the objective function is defined as a plain python function.

Convert xy to x*y? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 2 years ago.
Improve this question
I am working on a project where user enters the input in the form of xy or 2x or 2ab but sympy is not able to understand that, i want to convert them into x * y, 2 * x, 2 * a * b respectively
sympy is actually able to understand that. You need to use parsing to help for it:
from sympy.parsing.sympy_parser import parse_expr
from sympy.parsing.sympy_parser import standard_transformations,\
implicit_multiplication_application
transformations = (standard_transformations +
(implicit_multiplication_application,))
print(parse_expr("xy", transformations=transformations))
Output:
x*y

Where to find Natural neighbor interpolation in python [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 5 years ago.
Improve this question
Does anyone know of any tools to do a natural neighbor interpolation in python? unless i'm being stupid, i can't seem to find it in the scipy.interpolate module
Here is a 3D discrete natural neighbor implementation:
https://github.com/innolitics/natural-neighbor-interpolation
Note that the "discrete" is important here; it is an approximation of the true geometric natural neighbor.

What exactly does numpy.exp() do? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 7 years ago.
Improve this question
I'm very confused as to what np.exp() actually does. In the documentation it says that it: "Calculates the exponential of all elements in the input array." I'm confused as to what exactly this means. Could someone give me more information to what it actually does?
The exponential function is e^x where e is a mathematical constant called Euler's number, approximately 2.718281. This value has a close mathematical relationship with pi and the slope of the curve e^x is equal to its value at every point. np.exp() calculates e^x for each value of x in your input array.
It calculates ex for each x in your list where e is Euler's number (approximately 2.718). In other words, np.exp(range(5)) is similar to [math.e**x for x in range(5)].
exp(x) = e^x where e= 2.718281(approx)
In Python we can use the exp function from numpy (docs):
import numpy as np
ar=np.array([1,2,3])
ar=np.exp(ar)
print ar
outputs:
[ 2.71828183 7.3890561 20.08553692]

Categories