Mode of #cas

laplace

The Laplace transform of a sum of polynomial, exponential, trigonometric and hyperbolic terms, with a theorem about the integral.

#cas [laplace t s] f
gives the Laplace transform of f, a sum of polynomial, exponential, trigonometric and hyperbolic terms in t, as a rational function of s, and proves it for every s above a bound.

laplace gives the transform of a concrete function, together with a proof that the integral converges and has that value. The theorem is about Mathlib’s integral over Set.Ioi 0, the half-line t>0, with the integrand exactly as you wrote it.

Each term ctneatg(bt) has a transform in closed form, and the transform of a sum is the sum of the transforms. The bound on s is printed as the domain. It is enough for convergence, though not always the smallest such bound. To go back from a rational function of s, use inverseLaplace.

Details and Options

  • For the printed transform F and the bound σ of the domain, the theorem is ∀ s : ℝ, σ < s → IntegrableOn (fun t ↦ Real.exp (-(s * t)) * f) (Set.Ioi 0) ∧ ∫ t in Set.Ioi 0, Real.exp (-(s * t)) * f = F.
  • σ is the largest bound of the terms: a for a term with exp (a * t), cos or sin, and a+|b| for a term with cosh (b * t) or sinh (b * t).
  • f is a sum of at most 8 terms c * t ^ n * exp (a * t) * g (b * t) with g one of cos, sin, cosh and sinh, or without g, with rational a, c and b ≠ 0, and n≤8.
  • Parameters, tanh and other functions are refused, and so is a product of two of the functions g. The command is also refused inside a section with variables.
  • There are no options. In a proof, cas proves an improper integral such as the transform of 1, as under Applications.

Examples (19)#

Basic Examples (2)

The transform of tsin2t, with the theorem for every s>0:

In[1]:=
#cas [laplace t s] (t * sin (2 * t))
Out[1]=

Laplace transform

4s(s2+4)2
4*s/(s^2 + 4)^2
Domain
s > 0
Input (terms c tⁿ e ^ (a t) g (b t), g = 1, cos, sin, cosh, sinh)
(t * sin (2 * t))

Checked by Lean’s kernel: Laplace transform

∀ (s : ℝ),
  0 < s →
    MeasureTheory.IntegrableOn (fun t ↦ Real.exp (-(s * t)) * (t * Real.sin (2 * t))) (Set.Ioi 0)
        MeasureTheory.volume ∧
      ∫ (t : ℝ) in Set.Ioi 0, Real.exp (-(s * t)) * (t * Real.sin (2 * t)) = 4 * s / (s ^ 2 + 4) ^ 2
The certificate: 1 checked step
  1. Laplace transform

    ∀ (s : ℝ),
      0 < s →
        MeasureTheory.IntegrableOn (fun t ↦ Real.exp (-(s * t)) * (t * Real.sin (2 * t))) (Set.Ioi 0)
            MeasureTheory.volume ∧
          ∫ (t : ℝ) in Set.Ioi 0, Real.exp (-(s * t)) * (t * Real.sin (2 * t)) = 4 * s / (s ^ 2 + 4) ^ 2

    Checked by Lean’s kernel


A sum is transformed term by term, and the bound on s is the largest bound of its terms:

In[2]:=
#cas [laplace t s] (3 * t ^ 2 * exp (2 * t) + cos (5 * t))
Out[2]=

Laplace transform

6(s−2)3+ss2+25
6/(s - 2)^3 + s/(s^2 + 25)
Domain
s > 2
Input (terms c tⁿ e ^ (a t) g (b t), g = 1, cos, sin, cosh, sinh)
(3 * t ^ 2 * exp (2 * t) + cos (5 * t))

Checked by Lean’s kernel: Laplace transform

∀ (s : ℝ),
  2 < s →
    MeasureTheory.IntegrableOn (fun t ↦ Real.exp (-(s * t)) * (3 * t ^ 2 * Real.exp (2 * t) + Real.cos (5 * t)))
        (Set.Ioi 0) MeasureTheory.volume ∧
      ∫ (t : ℝ) in Set.Ioi 0, Real.exp (-(s * t)) * (3 * t ^ 2 * Real.exp (2 * t) + Real.cos (5 * t)) =
        6 / (s - 2) ^ 3 + s / (s ^ 2 + 25)
The certificate: 1 checked step
  1. Laplace transform

    ∀ (s : ℝ),
      2 < s →
        MeasureTheory.IntegrableOn (fun t ↦ Real.exp (-(s * t)) * (3 * t ^ 2 * Real.exp (2 * t) + Real.cos (5 * t)))
            (Set.Ioi 0) MeasureTheory.volume ∧
          ∫ (t : ℝ) in Set.Ioi 0, Real.exp (-(s * t)) * (3 * t ^ 2 * Real.exp (2 * t) + Real.cos (5 * t)) =
            6 / (s - 2) ^ 3 + s / (s ^ 2 + 25)

    Checked by Lean’s kernel

Scope (5)

A constant:

In[3]:=
#cas [laplace t s] 1
Out[3]=

Laplace transform

1s
1/s
Domain
s > 0
Input (terms c tⁿ e ^ (a t) g (b t), g = 1, cos, sin, cosh, sinh)
1

Checked by Lean’s kernel: Laplace transform

∀ (s : ℝ),
  0 < s →
    MeasureTheory.IntegrableOn (fun t ↦ Real.exp (-(s * t)) * 1) (Set.Ioi 0) MeasureTheory.volume ∧
      ∫ (t : ℝ) in Set.Ioi 0, Real.exp (-(s * t)) * 1 = 1 / s
The certificate: 1 checked step
  1. Laplace transform

    ∀ (s : ℝ),
      0 < s →
        MeasureTheory.IntegrableOn (fun t ↦ Real.exp (-(s * t)) * 1) (Set.Ioi 0) MeasureTheory.volume ∧
          ∫ (t : ℝ) in Set.Ioi 0, Real.exp (-(s * t)) * 1 = 1 / s

    Checked by Lean’s kernel


A decaying exponential and a power of t:

In[4]:=
#cas [laplace t s] (exp (-t) - 2 * t ^ 3)
Out[4]=

Laplace transform

1s+1−12s4
1/(s + 1) - 12/s^4
Domain
s > 0
Input (terms c tⁿ e ^ (a t) g (b t), g = 1, cos, sin, cosh, sinh)
(exp (-t) - 2 * t ^ 3)

Checked by Lean’s kernel: Laplace transform

∀ (s : ℝ),
  0 < s →
    MeasureTheory.IntegrableOn (fun t ↦ Real.exp (-(s * t)) * (Real.exp (-t) - 2 * t ^ 3)) (Set.Ioi 0)
        MeasureTheory.volume ∧
      ∫ (t : ℝ) in Set.Ioi 0, Real.exp (-(s * t)) * (Real.exp (-t) - 2 * t ^ 3) = 1 / (s + 1) - 12 / s ^ 4
The certificate: 1 checked step
  1. Laplace transform

    ∀ (s : ℝ),
      0 < s →
        MeasureTheory.IntegrableOn (fun t ↦ Real.exp (-(s * t)) * (Real.exp (-t) - 2 * t ^ 3)) (Set.Ioi 0)
            MeasureTheory.volume ∧
          ∫ (t : ℝ) in Set.Ioi 0, Real.exp (-(s * t)) * (Real.exp (-t) - 2 * t ^ 3) = 1 / (s + 1) - 12 / s ^ 4

    Checked by Lean’s kernel


A power, an exponential and a cosine in one term. The factor et/2 shifts the transform to s−1/2:

In[5]:=
#cas [laplace t s] (t ^ 2 * exp (t / 2) * cos (3 * t))
Out[5]=

Laplace transform

2(s−12)3−54(s−12)((s−12)2+9)3
(2*(s - 1/2)^3 - 54*(s - 1/2))/((s - 1/2)^2 + 9)^3
Domain
s > 1/2
Input (terms c tⁿ e ^ (a t) g (b t), g = 1, cos, sin, cosh, sinh)
(t ^ 2 * exp (t / 2) * cos (3 * t))

Checked by Lean’s kernel: Laplace transform

∀ (s : ℝ),
  1 / 2 < s →
    MeasureTheory.IntegrableOn (fun t ↦ Real.exp (-(s * t)) * (t ^ 2 * Real.exp (t / 2) * Real.cos (3 * t)))
        (Set.Ioi 0) MeasureTheory.volume ∧
      ∫ (t : ℝ) in Set.Ioi 0, Real.exp (-(s * t)) * (t ^ 2 * Real.exp (t / 2) * Real.cos (3 * t)) =
        (2 * (s - 1 / 2) ^ 3 - 54 * (s - 1 / 2)) / ((s - 1 / 2) ^ 2 + 9) ^ 3
The certificate: 1 checked step
  1. Laplace transform

    ∀ (s : ℝ),
      1 / 2 < s →
        MeasureTheory.IntegrableOn (fun t ↦ Real.exp (-(s * t)) * (t ^ 2 * Real.exp (t / 2) * Real.cos (3 * t)))
            (Set.Ioi 0) MeasureTheory.volume ∧
          ∫ (t : ℝ) in Set.Ioi 0, Real.exp (-(s * t)) * (t ^ 2 * Real.exp (t / 2) * Real.cos (3 * t)) =
            (2 * (s - 1 / 2) ^ 3 - 54 * (s - 1 / 2)) / ((s - 1 / 2) ^ 2 + 9) ^ 3

    Checked by Lean’s kernel


A negative rate and a negative frequency. The bound on s is −3/2:

In[6]:=
#cas [laplace t s] (exp (-(3 / 2) * t) * sin (-2 * t))
Out[6]=

Laplace transform

−2(s+32)2+4
-(2/((s + 3/2)^2 + 4))
Domain
s > -3/2
Input (terms c tⁿ e ^ (a t) g (b t), g = 1, cos, sin, cosh, sinh)
(exp (-(3 / 2) * t) * sin (-2 * t))

Checked by Lean’s kernel: Laplace transform

∀ (s : ℝ),
  -(3 / 2) < s →
    MeasureTheory.IntegrableOn (fun t ↦ Real.exp (-(s * t)) * (Real.exp (-(3 / 2) * t) * Real.sin (-2 * t)))
        (Set.Ioi 0) MeasureTheory.volume ∧
      ∫ (t : ℝ) in Set.Ioi 0, Real.exp (-(s * t)) * (Real.exp (-(3 / 2) * t) * Real.sin (-2 * t)) =
        -(2 / ((s + 3 / 2) ^ 2 + 4))
The certificate: 1 checked step
  1. Laplace transform

    ∀ (s : ℝ),
      -(3 / 2) < s →
        MeasureTheory.IntegrableOn (fun t ↦ Real.exp (-(s * t)) * (Real.exp (-(3 / 2) * t) * Real.sin (-2 * t)))
            (Set.Ioi 0) MeasureTheory.volume ∧
          ∫ (t : ℝ) in Set.Ioi 0, Real.exp (-(s * t)) * (Real.exp (-(3 / 2) * t) * Real.sin (-2 * t)) =
            -(2 / ((s + 3 / 2) ^ 2 + 4))

    Checked by Lean’s kernel


The hyperbolic functions. For cosh (b * t) and sinh (b * t) the bound is a+|b|:

In[7]:=
#cas [laplace t s] (cosh (3 * t))
Out[7]=

Laplace transform

ss2−9
s/(s^2 - 9)
Domain
s > 3
Input (terms c tⁿ e ^ (a t) g (b t), g = 1, cos, sin, cosh, sinh)
(cosh (3 * t))

Checked by Lean’s kernel: Laplace transform

∀ (s : ℝ),
  3 < s →
    MeasureTheory.IntegrableOn (fun t ↦ Real.exp (-(s * t)) * Real.cosh (3 * t)) (Set.Ioi 0)
        MeasureTheory.volume ∧
      ∫ (t : ℝ) in Set.Ioi 0, Real.exp (-(s * t)) * Real.cosh (3 * t) = s / (s ^ 2 - 9)
The certificate: 1 checked step
  1. Laplace transform

    ∀ (s : ℝ),
      3 < s →
        MeasureTheory.IntegrableOn (fun t ↦ Real.exp (-(s * t)) * Real.cosh (3 * t)) (Set.Ioi 0)
            MeasureTheory.volume ∧
          ∫ (t : ℝ) in Set.Ioi 0, Real.exp (-(s * t)) * Real.cosh (3 * t) = s / (s ^ 2 - 9)

    Checked by Lean’s kernel

In[8]:=
#cas [laplace t s] (exp (2 * t) * sinh t)
Out[8]=

Laplace transform

1(s−2)2−1
1/((s - 2)^2 - 1)
Domain
s > 3
Input (terms c tⁿ e ^ (a t) g (b t), g = 1, cos, sin, cosh, sinh)
(exp (2 * t) * sinh t)

Checked by Lean’s kernel: Laplace transform

∀ (s : ℝ),
  3 < s →
    MeasureTheory.IntegrableOn (fun t ↦ Real.exp (-(s * t)) * (Real.exp (2 * t) * Real.sinh t)) (Set.Ioi 0)
        MeasureTheory.volume ∧
      ∫ (t : ℝ) in Set.Ioi 0, Real.exp (-(s * t)) * (Real.exp (2 * t) * Real.sinh t) = 1 / ((s - 2) ^ 2 - 1)
The certificate: 1 checked step
  1. Laplace transform

    ∀ (s : ℝ),
      3 < s →
        MeasureTheory.IntegrableOn (fun t ↦ Real.exp (-(s * t)) * (Real.exp (2 * t) * Real.sinh t)) (Set.Ioi 0)
            MeasureTheory.volume ∧
          ∫ (t : ℝ) in Set.Ioi 0, Real.exp (-(s * t)) * (Real.exp (2 * t) * Real.sinh t) = 1 / ((s - 2) ^ 2 - 1)

    Checked by Lean’s kernel

Applications (1)

The transform of 1 in a proof. cas proves the integral for s>0, and only the three standard axioms are used:

In[9]:=
theorem laplace_one (s : ℝ) (hs : 0 < s) :
    ∫ t in Set.Ioi (0 : ℝ), Real.exp (-(s * t)) * 1 = 1 / s := by
  cas

#print axioms laplace_one
Out[9]=

laplace_one depends on the axioms propext, Classical.choice, Quot.sound.

Properties and Relations (2)

The transform is linear. Written with exponentials, sinh3t=(e3t−e−3t)/2 has the transform (1s−3−1s+3)/2=3/(s2−9):

In[10]:=
#cas [laplace t s] ((exp (3 * t) - exp (-(3 * t))) / 2)
Out[10]=

Laplace transform

3s2−9
3/(s^2 - 9)
Domain
s > 3
Input (terms c tⁿ e ^ (a t) g (b t), g = 1, cos, sin, cosh, sinh)
((exp (3 * t) - exp (-(3 * t))) / 2)

Checked by Lean’s kernel: Laplace transform

∀ (s : ℝ),
  3 < s →
    MeasureTheory.IntegrableOn (fun t ↦ Real.exp (-(s * t)) * ((Real.exp (3 * t) - Real.exp (-(3 * t))) / 2))
        (Set.Ioi 0) MeasureTheory.volume ∧
      ∫ (t : ℝ) in Set.Ioi 0, Real.exp (-(s * t)) * ((Real.exp (3 * t) - Real.exp (-(3 * t))) / 2) =
        3 / (s ^ 2 - 9)
The certificate: 1 checked step
  1. Laplace transform

    ∀ (s : ℝ),
      3 < s →
        MeasureTheory.IntegrableOn (fun t ↦ Real.exp (-(s * t)) * ((Real.exp (3 * t) - Real.exp (-(3 * t))) / 2))
            (Set.Ioi 0) MeasureTheory.volume ∧
          ∫ (t : ℝ) in Set.Ioi 0, Real.exp (-(s * t)) * ((Real.exp (3 * t) - Real.exp (-(3 * t))) / 2) =
            3 / (s ^ 2 - 9)

    Checked by Lean’s kernel


inverseLaplace goes back. The transform of t2et/2 is 1/(s−1)3:

In[11]:=
#cas [inverseLaplace s t] (1 / (s - 1) ^ 3)
Out[11]=

an inverse Laplace transform (its transform is F for s > σ; uniqueness is not claimed)

12t2et
1/2*t^2*exp(t)
Domain
s > 1
Input (proper rational function of s)
(1 / (s - 1) ^ 3)

Checked by Lean’s kernel: Inverse Laplace transform

∀ (s : ℝ),
  1 < s →
    MeasureTheory.IntegrableOn (fun t ↦ Real.exp (-(s * t)) * (1 / 2 * (t ^ 2 * Real.exp t))) (Set.Ioi 0)
        MeasureTheory.volume ∧
      ∫ (t : ℝ) in Set.Ioi 0, Real.exp (-(s * t)) * (1 / 2 * (t ^ 2 * Real.exp t)) = 1 / (s - 1) ^ 3
The certificate: 1 checked step
  1. Inverse Laplace transform

    ∀ (s : ℝ),
      1 < s →
        MeasureTheory.IntegrableOn (fun t ↦ Real.exp (-(s * t)) * (1 / 2 * (t ^ 2 * Real.exp t))) (Set.Ioi 0)
            MeasureTheory.volume ∧
          ∫ (t : ℝ) in Set.Ioi 0, Real.exp (-(s * t)) * (1 / 2 * (t ^ 2 * Real.exp t)) = 1 / (s - 1) ^ 3

    Checked by Lean’s kernel

Possible Issues (8)

The printed bound is enough for convergence and need not be the smallest one. Here the input is e−t, whose transform 1/(s+1) exists for s>−1, and the bound of the two terms is s>1:

In[12]:=
#cas [laplace t s] (cosh t - sinh t)
Out[12]=

Laplace transform

ss2−1−1s2−1
s/(s^2 - 1) - 1/(s^2 - 1)
Domain
s > 1
Input (terms c tⁿ e ^ (a t) g (b t), g = 1, cos, sin, cosh, sinh)
(cosh t - sinh t)

Checked by Lean’s kernel: Laplace transform

∀ (s : ℝ),
  1 < s →
    MeasureTheory.IntegrableOn (fun t ↦ Real.exp (-(s * t)) * (Real.cosh t - Real.sinh t)) (Set.Ioi 0)
        MeasureTheory.volume ∧
      ∫ (t : ℝ) in Set.Ioi 0, Real.exp (-(s * t)) * (Real.cosh t - Real.sinh t) =
        s / (s ^ 2 - 1) - 1 / (s ^ 2 - 1)
The certificate: 1 checked step
  1. Laplace transform

    ∀ (s : ℝ),
      1 < s →
        MeasureTheory.IntegrableOn (fun t ↦ Real.exp (-(s * t)) * (Real.cosh t - Real.sinh t)) (Set.Ioi 0)
            MeasureTheory.volume ∧
          ∫ (t : ℝ) in Set.Ioi 0, Real.exp (-(s * t)) * (Real.cosh t - Real.sinh t) =
            s / (s ^ 2 - 1) - 1 / (s ^ 2 - 1)

    Checked by Lean’s kernel


A product of two of the functions cos, sin, cosh and sinh is not one term. Write it as a sum first, here (exp t * cos t + exp (-t) * cos t) / 2:

In[13]:=
#cas [laplace t s] (cosh t * cos t)
Out[13]=

Error

laplace: expected a sum of terms c tⁿ e ^ (a t) g (b t) with g one of cos, sin, cosh, sinh, or c tⁿ e ^ (a t), with rational a, b, c and b ≠ 0 (parameters are not supported)

The integral of e−stet2 diverges for every s. The input is not a sum of the terms above, and it is refused:

In[14]:=
#cas [laplace t s] (exp (t ^ 2))
Out[14]=

Error

laplace: expected a sum of terms c tⁿ e ^ (a t) g (b t) with g one of cos, sin, cosh, sinh, or c tⁿ e ^ (a t), with rational a, b, c and b ≠ 0 (parameters are not supported)

Parameters are refused. The rates, frequencies and coefficients are rational numbers:

In[15]:=
#cas [laplace t s] (exp (a * t))
Out[15]=

Error

laplace: expected a sum of terms c tⁿ e ^ (a t) g (b t) with g one of cos, sin, cosh, sinh, or c tⁿ e ^ (a t), with rational a, b, c and b ≠ 0 (parameters are not supported)

tanh is not one of the functions:

In[16]:=
#cas [laplace t s] (tanh t)
Out[16]=

Error

laplace: tanh is not supported

Powers of t go up to 8. The transform of tn is n!/sn+1:

In[17]:=
#cas [laplace t s] (t ^ 9)
Out[17]=

Error

laplace accepts powers t ^ n with n ≤ 8

At most 8 terms:

In[18]:=
#cas [laplace t s] (1 + t + t ^ 2 + t ^ 3 + t ^ 4 + t ^ 5 + t ^ 6 + t ^ 7 + t ^ 8)
Out[18]=

Error

laplace accepts at most 8 terms

The two variables must be different:

In[19]:=
#cas [laplace t t] (exp t)
Out[19]=

Error

laplace: the variables t and s must be different

Neat Examples (1)

Other names for the variables. The bound is p>−1, and at p=0 the integral is Γ(9)=8!=40320:

In[20]:=
#cas [laplace x p] (x ^ 8 * exp (-x))
Out[20]=

Laplace transform

40320(p+1)9
40320/(p + 1)^9
Domain
p > -1
Input (terms c tⁿ e ^ (a t) g (b t), g = 1, cos, sin, cosh, sinh)
(x ^ 8 * exp (-x))

Checked by Lean’s kernel: Laplace transform

∀ (p : ℝ),
  -1 < p →
    MeasureTheory.IntegrableOn (fun x ↦ Real.exp (-(p * x)) * (x ^ 8 * Real.exp (-x))) (Set.Ioi 0)
        MeasureTheory.volume ∧
      ∫ (x : ℝ) in Set.Ioi 0, Real.exp (-(p * x)) * (x ^ 8 * Real.exp (-x)) = 40320 / (p + 1) ^ 9
The certificate: 1 checked step
  1. Laplace transform

    ∀ (p : ℝ),
      -1 < p →
        MeasureTheory.IntegrableOn (fun x ↦ Real.exp (-(p * x)) * (x ^ 8 * Real.exp (-x))) (Set.Ioi 0)
            MeasureTheory.volume ∧
          ∫ (x : ℝ) in Set.Ioi 0, Real.exp (-(p * x)) * (x ^ 8 * Real.exp (-x)) = 40320 / (p + 1) ^ 9

    Checked by Lean’s kernel

See Also

inverseLaplace · dsolve · integrate · fourierTransform · gamma