# It is very difficult for Octave to calculate the inverse Laplace transform of some functions Classic List Threaded 8 messages Open this post in threaded view
|

## It is very difficult for Octave to calculate the inverse Laplace transform of some functions

 I had no intention to torture test Gnu Octave. I had this  Exercise from my Circuit Analysis Textbook   which I was trying to solve. It is about circuit Analysis and one has to find Mesh currents from a planar circuit.   In the last step, one has to find the inverse Laplace transform of the two functions. I only found out that Gnu Octave takes a huge amount of time to calculate the inverse Laplace transform of some functions. Yesterday night, I was going to bed and started the calculation only to find out in the morning that it was not yet done calculating. Here is a screenshot: I got the job done using Wolfram Alpha but, that leaves me a big concern. I don't know if I can rely on Octave's symbolic calculation abilities if I happen to encounter a comparable question in my exam and if Octave stalls. -- Sent from: https://octave.1599824.n4.nabble.com/Octave-General-f1599825.html
Open this post in threaded view
|

## Re: It is very difficult for Octave to calculate the inverse Laplace transform of some functions

 On 2020-01-06 12:28 a.m., billyandriam wrote: > I had no intention to torture test Gnu Octave. I had this  Exercise from my > Circuit Analysis Textbook > > which I was trying to solve. It is about circuit Analysis and one has to > find Mesh currents from a planar circuit. > In the last step, one has to find the inverse Laplace transform of the two > functions. > I only found out that Gnu Octave takes a huge amount of time to calculate > the inverse Laplace transform of some functions. Yesterday night, I was > going to bed and started the calculation only to find out in the morning > that it was not yet done calculating. > > Here is a screenshot: > > > I got the job done using Wolfram Alpha but, that leaves me a big concern. I > don't know if I can rely on Octave's symbolic calculation abilities if I > happen to encounter a comparable question in my exam and if Octave stalls. Octave's Symbolic package relies on Sympy.  While it can do transforms, its perhaps not its strongest feature. Some things you could try: 1.  Make sure you're running a recent version of Sympy (1.4 or 1.5) 2.  Try to isolate the simplest problem for which it fails, then you or I can report it upstream at https://github.com/sympy/sympy/issues(For example, there are very large integers in the screenshot you provided: does it also fail for rational expressions of quadrics with smaller coefficients?) best, Colin
Open this post in threaded view
|

## Re: It is very difficult for Octave to calculate the inverse Laplace transform of some functions

 In reply to this post by billyandriam On Mon, Jan 6, 2020 at 3:28 AM billyandriam <[hidden email]> wrote:I had no intention to torture test Gnu Octave. I had this  Exercise from my Circuit Analysis Textbook   Why is there an extra voltage source( of -10^-3 V) in the second diagram?  which I was trying to solve. It is about circuit Analysis and one has to find Mesh currents from a planar circuit.  In the last step, one has to find the inverse Laplace transform of the two functions. I only found out that Gnu Octave takes a huge amount of time to calculate the inverse Laplace transform of some functions. Yesterday night, I was going to bed and started the calculation only to find out in the morning that it was not yet done calculating. Here is a screenshot: I got the job done using Wolfram Alpha but, that leaves me a big concern. I don't know if I can rely on Octave's symbolic calculation abilities if I happen to encounter a comparable question in my exam and if Octave stalls. -- Sent from: https://octave.1599824.n4.nabble.com/Octave-General-f1599825.html -- DAS Open this post in threaded view
|

## Re: It is very difficult for Octave to calculate the inverse Laplace transform of some functions

 It comes from the equivalent circuit of an inductor in the frequency domain. There is an initial current flowing through it at t=0, so it can be modeled as an impedance sL in series with a voltage source -Li(0). -- Sent from: https://octave.1599824.n4.nabble.com/Octave-General-f1599825.html
Open this post in threaded view
|

## Re: It is very difficult for Octave to calculate the inverse Laplace transform of some functions

 In reply to this post by Colin Macdonald-2 For the advises which you have given: 1- I am running sympy 1.5.1 so I guess it is a recent version. 2- I will try to report it on its github project once I find some free time. For comparison, I was able to get the result instantly while using MATLAB from my University's Computer Lab. -- Sent from: https://octave.1599824.n4.nabble.com/Octave-General-f1599825.html
Open this post in threaded view
|

## Re: It is very difficult for Octave to calculate the inverse Laplace transform of some functions

 On Mon, Jan 6, 2020 at 10:42 AM billyandriam <[hidden email]> wrote:For the advises which you have given: 1- I am running sympy 1.5.1 so I guess it is a recent version. 2- I will try to report it on its github project once I find some free time. For comparison, I was able to get the result instantly while using MATLAB from my University's Computer Lab. -- Sent from: https://octave.1599824.n4.nabble.com/Octave-General-f1599825.html I got it to workFirst let me say that it ran here for more that 10 hrs. as you presented it. But no error.If you do    ilaplace(partfrac(aux.i2))then you will get the answer within 1 minute.What this does is help the solver by doing the partial fraction expansion first.-- DAS On Mon, Jan 6, 2020 at 9:02 PM Nicholas Jankowski <[hidden email]> wrote: For comparison, I was able to get the result instantly while using MATLAB from my University's Computer Lab.I got it to workFirst let me say that it ran here for more that 10 hrs. as you presented it. But no error.If you do    ilaplace(partfrac(aux.i2))then you will get the answer within 1 minute.What this does is help the solver by doing the partial fraction expansion first.Based on this is it safe to assume that this is a sympy issue and not something octave does before sympy takes over?Yes Octave is not doing anything wrong.  ilaplace should automatically do a partial fraction expansion. I know on the gnu maxima forums this is something they would pick apart (well, if maxima has a decent ilt implementation that is). Is the sympy community amenable you looking into such a “competitor” performance difference and how their lookup/decision/whatever processes contribute to that? -- DAS 