apmonitor / apm_python Goto Github PK
View Code? Open in Web Editor NEWAPMonitor Optimization Suite in Python
Home Page: http://apmonitor.com/wiki/index.php/Main/PythonApp
License: Other
APMonitor Optimization Suite in Python
Home Page: http://apmonitor.com/wiki/index.php/Main/PythonApp
License: Other
Hello,
i have this code for turn ode to laplace form, but this work only for ode with derivative,
do you have an idea how to make i work for diffrential equation with integral ?
see example below.
'''
import sympy as sym
from sympy.abc import s,t,x,y,z
from sympy.integrals import laplace_transform
from sympy import diff
from sympy import exp, cos, integrate
sym.init_printing()
def laplace_transform_derivatives(e):
"""
Evaluate the unevaluted laplace transforms of derivatives
of functions
"""
if isinstance(e, sym.LaplaceTransform):
if isinstance(e.args[0], sym.Derivative):
d, t, s = e.args
n = d.args[1][1]
#n = len(d.args) - 1
return ((sn) * sym.LaplaceTransform(d.args[0], t, s) -
sum([s(n-i) * sym.diff(d.args[0], t, i-1).subs(t, 0) for i in range(1, n+1)]))
if isinstance(e, (sym.Add, sym.Mul)):
t = type(e)
return t([laplace_transform_derivatives(arg) for arg in e.args])
return e
t = sym.symbols("t", positive=True)
y = sym.Function("y")
ode = y(t).diff(t) - 2 * y(t) - 5(0.2*(1-y(t))+0.1*integrate(1-y(t)))
sym.Eq(ode)
s, Y = sym.symbols("s, Y", real=True)
L_y = sym.laplace_transform(y(t), t, s)
L_ode = sym.laplace_transform(ode, t, s, noconds=True)
sym.Eq(L_ode)
#print(L)
L_ode_2 = laplace_transform_derivatives(L_ode)
sym.Eq(L_ode_2)
#print(L_2)
L_ode_3 = L_ode_2.subs(L_y, Y)
sym.Eq(L_ode_3)
#print(L_3)
ics = {y(0): 0 }
L_ode_4 = L_ode_3.subs(ics)
sym.Eq(L_ode_4)
Y_sol = sym.solve(L_ode_4, Y)
print(Y_sol)
'''
example: dy/dt-2y(t)=0.2(1-y(t))+0.1โซ(1-y(t))dt
regarsd,
Tomer
Hi,is apmonitor support optimize a matrix?
For I need to optimize a matrix X , and I don't want to rewrite the constrains for each elements of X, whether there is a way to write the constrains and object function in a matrix way?
Hi,is apmonitor support complex number?
I need to optimize a set of vector and obtain complex solves.
hi, I went through this problem after I have installed everything in my mac. I wonder what the problem is ? How should I fix this. Thank you
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.