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

classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

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

billyandriam
I had no intention to torture test Gnu Octave. I had this  Exercise from my
Circuit Analysis Textbook
<https://electronics.stackexchange.com/questions/474650/solving-a-linear-system-of-equations-from-a-mesh-analysis-in-the-s-domain/>  
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:
<https://octave.1599824.n4.nabble.com/file/t373596/Annotation_2020-01-06_110927.png>

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


Reply | Threaded
Open this post in threaded view
|

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

Colin Macdonald-2
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
> <https://electronics.stackexchange.com/questions/474650/solving-a-linear-system-of-equations-from-a-mesh-analysis-in-the-s-domain/>
> 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:
> <https://octave.1599824.n4.nabble.com/file/t373596/Annotation_2020-01-06_110927.png>
>
> 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


Reply | Threaded
Open this post in threaded view
|

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

Doug Stewart-4
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
<https://electronics.stackexchange.com/questions/474650/solving-a-linear-system-of-equations-from-a-mesh-analysis-in-the-s-domain/

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:
<https://octave.1599824.n4.nabble.com/file/t373596/Annotation_2020-01-06_110927.png>

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




--
DASCertificate for 206392



Reply | Threaded
Open this post in threaded view
|

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

billyandriam
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).

<https://octave.1599824.n4.nabble.com/file/t373596/Untitled.png>



--
Sent from: https://octave.1599824.n4.nabble.com/Octave-General-f1599825.html


Reply | Threaded
Open this post in threaded view
|

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

billyandriam
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


Reply | Threaded
Open this post in threaded view
|

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

Doug Stewart-4


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 work
First 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.



--
DASCertificate for 206392



Reply | Threaded
Open this post in threaded view
|

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

nrjank

For comparison, I was able to get the result instantly while using MATLAB
from my University's Computer Lab.


I got it to work
First 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?

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?



Reply | Threaded
Open this post in threaded view
|

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

Doug Stewart-4


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 work
First 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?



--
DASCertificate for 206392