How to get around Meijerg???

42 views
Skip to first unread message

Javier Pérez

unread,
Jul 13, 2020, 2:46:17 PM7/13/20
to sympy
Hello all,

I am trying to move several sympy equations from the Laplace domain to the Time domain but the output of some of the equations are contains calls to the Meijerg method.

How can I get around that issue, please???

Thank you in advance for your help...

Aaron Meurer

unread,
Jul 13, 2020, 2:49:08 PM7/13/20
to sympy
The hyperexpand() function will try to convert meijerg functions into
simpler functions. However, if this is the result of an integral, it
generally calls hyperexpand() automatically, so likely the issue is
that hyperexpand() does not presently know how to convert it. Or it is
possible that the function in question does not have a closed form
simpler than a Meijerg G-function. If you post the expression you are
getting, we might be able to give more advice for it.

Aaron Meurer
> --
> You received this message because you are subscribed to the Google Groups "sympy" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to sympy+un...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/sympy/a5638599-6dac-4dd0-a91d-4778ee11214do%40googlegroups.com.
Message has been deleted

Javier Pérez

unread,
Jul 14, 2020, 8:17:27 AM7/14/20
to sympy
Hello Aaron,

First of all, thanks for your answer. As you suggested, here I bring a piece of code with one of the problematic equations (see Section PIECE OF CODE). As a result of certain computation, I get "equ_laplace" in the Laplace domain, then, when I try to move it to the Time domain the output is not a conventional equation (see Section OUTPUT). I have try either force " sym.inverse_laplace_transform()" not to use Meijerg to compute the solution or, reshape the Meijerg output to a conventional equation but with not success yet, unfortunately.

##### PIECE OF CODE ############
import sympy as sym

s = sym.Symbol('s')
t = sym.Symbol('t', positive=True)

# Equation in the Laplace domain
equ_laplace = 470.0*s**2/(1.0*s**4 + 18.7*s**3 + 17.9*s**2 + 4.68*s + 0.131)

# Moving to the Time domain
equ_time = sym.inverse_laplace_transform(equ_laplace, s, t)

print("equ_time =", equ_time)
##############################

#### OUTPUT #################
equ_time = 470.0*meijerg(((-16.7038273656911, 0, 0, 0.968289766789687, 0.517768799450727 - 0.0283089619304889*I, 0.517768799450727 + 0.0283089619304889*I), ()), ((), (-17.7038273656911, -0.031710233210313, 1, 1, -0.482231200549273 - 0.0283089619304889*I, -0.482231200549273 + 0.0283089619304889*I)), exp(t))
##############################

Thank you for your time,
Javier

David Bailey

unread,
Jul 14, 2020, 9:21:37 AM7/14/20
to sy...@googlegroups.com
On 14/07/2020 11:49, Javier Perez Rodriguez wrote:
Hello Aaron,

First of all, thanks for your answer. As you suggested, here I bring a piece of code with one of the problematic equations (see Section PIECE OF CODE). As a result of certain computation, I get "equ_laplace" in the Laplace domain, then, when I try to move it to the Time domain the output is not a conventional equation (see Section OUTPUT). I have try either force " sym.inverse_laplace_transform()" not to use Meijerg to compute the solution or, reshape the Meijerg output to a conventional equation but with not success yet, unfortunately.

Javier,

meijerg is a special function - like sin or cos or besselj! So it is a conventional equation, it is just that meijerg isn't that well known:

https://en.wikipedia.org/wiki/Meijer_G-function

You can evaluate it for specific numerical arguments, or manipulate expressions using it just as you can manipulate expressions using sin or cos, or whatever.

David



Aaron Meurer

unread,
Jul 14, 2020, 4:28:41 PM7/14/20
to sympy
Laplace transforms are something that SymPy doesn't do as well with as
it should. I tried to get a closed form version with exponentials by
using apart(full=True) and finding the transform of the individual
terms, but I ran into a bug
https://github.com/sympy/sympy/issues/19773.

I was able to workaround the bugs to get an answer with

>>> Add(*[inverse_laplace_transform(nsimplify(i), s, t) for i in Add.make_args(apart((equ_laplace), s, full=True).doit())])
(1398726960911182419102898085651241253403000977950623455914670 -
24878179654951949422367214210629217423593456535413826921554823*I)*exp(-482231200549273*t/1000000000000000
- 283089619304889*I*t/10000000000000000)/100000000000000000000000000000000000000000000000000000000000
+ (1398726960911182419102898085651241253403000977950623455914670 +
24878179654951949422367214210629217423593456535413826921554823*I)*exp(-482231200549273*t/1000000000000000
+ 283089619304889*I*t/10000000000000000)/100000000000000000000000000000000000000000000000000000000000
- 281057785843441*exp(-177038273656911*t/10000000000000)/10000000000000
+ 65620080368859*exp(-317102332103131*t/10000000000000000)/500000000000000

Aaron Meurer

On Tue, Jul 14, 2020 at 5:37 AM Javier Perez Rodriguez
<jprgu...@gmail.com> wrote:
>
> Hello Aaron,
>
> First of all, thanks for your answer. As you suggested, here I bring a piece of code with one of the problematic equations (see Section PIECE OF CODE). As a result of certain computation, I get "equ_laplace" in the Laplace domain, then, when I try to move it to the Time domain the output is not a conventional equation (see Section OUTPUT). I have try either force " sym.inverse_laplace_transform()" not to use Meijerg to compute the solution or, reshape the Meijerg output to a conventional equation but with not success yet, unfortunately.
>
> ##### PIECE OF CODE ############
> import sympy as sym
>
> s = sym.Symbol('s')
> t = sym.Symbol('t', positive=True)
>
> # Equation in the Laplace domain
> equ_laplace = 470.0*s**2/(1.0*s**4 + 18.7*s**3 + 17.9*s**2 + 4.68*s + 0.131)
>
> # Moving to the Time domain
> equ_time = sym.inverse_laplace_transform(equ_laplace, s, t)
>
> print("equ_time =", equ_time)
> ##############################
>
> #### OUTPUT #################
> equ_time = 470.0*meijerg(((-16.7038273656911, 0, 0, 0.968289766789687, 0.517768799450727 - 0.0283089619304889*I, 0.517768799450727 + 0.0283089619304889*I), ()), ((), (-17.7038273656911, -0.031710233210313, 1, 1, -0.482231200549273 - 0.0283089619304889*I, -0.482231200549273 + 0.0283089619304889*I)), exp(t))
> ##############################
>
> Thank you for your time,
> Javier
>
> --
> You received this message because you are subscribed to the Google Groups "sympy" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to sympy+un...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/sympy/9f0eee0b-4fb6-4303-ba04-17266719fd13o%40googlegroups.com.

Javier Pérez

unread,
Jul 15, 2020, 11:02:14 AM7/15/20
to sy...@googlegroups.com
Hello Aaron,

I posted new comments in the git hub you opened.

Thank you in advance,
Javier

Reply all
Reply to author
Forward
0 new messages