[julia-users] Re: Differential equations system with SymPy function dsolve?

2015-07-09 Thread CasUpg
Thank you very much!

El miércoles, 8 de julio de 2015, 19:49:33 (UTC-5), j verzani escribió:

 The answer is 

 dsolve(exs::Vector{Sym};kwargs...) = sympy_meth(:dsolve, exs; kwargs...)

 I just added this to the master version and will push to METADATA soon.



[julia-users] Differential equations system with SymPy function dsolve?

2015-07-08 Thread CasUpg
Hi,
I'm trying SymPy to solve differential equations system but it does not 
work in Julia. In Python it does. If I write the following in Python:

from sympy import *
t = symbols('t')
x = Function('x')
y = Function('y')
eq = (Eq(diff(x(t),t), 12*t*x(t) + 8*y(t)), Eq(diff(y(t),t), 21*x(t) + 7*t*y
(t)))
dsolve(eq)

it returns:

[x(t) == C1*x0 + C2*x0*Integral(8*exp(Integral(7*t, t))*exp(Integral(12*t, t
))/x0**2, t),
 y(t) == C1*y0 + C2(y0*Integral(8*exp(Integral(7*t, t))*exp(Integral(12*t, t
))/x0**2, t) + exp(Integral(7*t, t))*exp(Integral(12*t, t))/x0)]


But if I type the following in Julia:

julia versioninfo()
Julia Version 0.3.10
Commit c8ceeef (2015-06-24 13:54 UTC)
Platform Info:
  System: Linux (i686-linux-gnu)
  CPU: Intel(R) Celeron(R) CPU B815 @ 1.60GHz
  WORD_SIZE: 32
  BLAS: libopenblas (NO_LAPACK NO_LAPACKE DYNAMIC_ARCH NO_AFFINITY Nehalem)
  LAPACK: liblapack.so.3
  LIBM: libopenlibm
  LLVM: libLLVM-3.3


using SymPy
t, = @syms t
x, y = symbols(x, y, cls=SymFunction)
eq = [Eq(diff(x(t),t), 12*t*x(t) + 8*y(t)), Eq(diff(y(t),t), 21*x(t) + 7*t*y
(t))]
dsolve(eq)

it returns:

ERROR: `dsolve` has no method matching dsolve(::Array{Sym,1})


In the SymPy file math.jl, there is only the following definition for 
dsolve:

dsolve(ex::Sym, fx::Sym) = sympy_meth(:dsolve, ex, fx)



How can I extend it in order to solve differential equations systems?

A try can be found in:

https://gist.github.com/Ismael-VC/2f39cd8cf30d19a78349

but it returns a wrong answer.