Opened 4 years ago

Last modified 4 years ago

#22422 closed enhancement

Laplace transform involving time-shifts — at Version 3

Reported by: mforets Owned by:
Priority: major Milestone: sage-8.0
Component: calculus Keywords: laplace, transform, symbolics, giac, heaviside
Cc: kcrisman, paulmasson, ​frederichan, rws Merged in:
Authors: Marcelo Forets Reviewers:
Report Upstream: N/A Work issues:
Branch: u/mforets/laplace_transform_involving_time_shifts (Commits, GitHub, GitLab) Commit: 20963880dfbc18035cea6159eb13d5c71b0fda59
Dependencies: Stopgaps:

Status badges

Description (last modified by mforets)

Sage allows to compute the inverse Laplace transform through Maxima's ilt function,

    sage: var('s t')
    sage: inverse_laplace(1/s, s, t)
    1

An unevaluated expression is returned when no explicit inverse Laplace transform is computed, as in

    sage: inverse_laplace(exp(-s)/s, s, t)
    ilt(e^(-s)/s, s, t)

The result in this case is h(t-1), where h is the Heaviside step function. In Sage it is available as heaviside.

The problem in this ticket is to extend the current behavior of inverse_laplace to provide explicit expressions for proper real-rational functions with any number of real exponentials linear in the transform variable s (time-shifts) in the numerator. For consistency, the direct Laplace transform with a heaviside should also work as well.

These are some approaches:

(1) Implement an in-house solution, possibly in the lines of this answer.

(2) Add an algorithm flag that allows to choose sympy (similar to integration).

(3) Interface with Giac/XCAS. With this package installed, it is possible to do:

sage: giac('invlaplace(exp(-s)/s, s, t)')
Heaviside(t-1)

IMHO, a combination of (2)-(3) is the more robust approach. A small set of experiments show that (3) is, at the time of writing, more convenient than inverse_laplace_transform of SymPy? in terms of quality of solution and execution time. Unfortunately, the giac interface does not currently support automatic translation back to the symbolic ring, as it does with SymPy? objects via SR(..).

Any recommendations?

See also:

Change History (3)

comment:1 Changed 4 years ago by paulmasson

  • Cc rws added

comment:2 Changed 4 years ago by mforets

  • Branch set to u/mforets/laplace_transform_involving_time_shifts

comment:3 Changed 4 years ago by mforets

  • Authors set to Marcelo Forets
  • Commit set to 20963880dfbc18035cea6159eb13d5c71b0fda59
  • Description modified (diff)
  • Status changed from new to needs_info

Needs info (please see commit message) to transform heaviside via _giac_(). Example:

    sage: f = heaviside(x); f, type(f)
    (heaviside(x), <type 'sage.symbolic.expression.Expression'>)
    sage: fg = f._giac_(); fg,  type(fg)
    (heaviside(x), <class 'sage.interfaces.giac.GiacElement'>)

But heaviside(x) doesn't seem to be understood by giac.


New commits:

2096388Added algorithm='sympy' (needs work) and algorithm='giac' (needs info).
Note: See TracTickets for help on using tickets.