/** Symbolic Laplace transforms. See: https://byjus.com/maths/laplace-transform/ https://tutorial.math.lamar.edu/Classes/DE/Laplace_Table.aspx https://en.wikipedia.org/wiki/Laplace_transform */ transformations Laplace { // While this whole library allows you to use different variables than "t" // and "s", those are very commonly used. This rule is a magical helper // that turns any single rule LaplaceTransform[_a] where _a contains "t" and // is free of "s" into the expanded more versatile LaplaceTransform[x, t, s] // that all of these transformation rules expect. LaplaceTransform[_a] :: expressionContains[_a, t] and freeOf[_a, s] <-> LaplaceTransform[_a, t, s] // Transform of an expression independent of t LaplaceTransform[_a, _t, _s] :: freeOf[_a,_t] and freeOf[_a,_s] <-> _a / _s InverseLaplaceTransform[_a/_s, _s, _t] :: freeOf[_a,_t] and freeOf[_a,_s]<->_a // Linearity properties LaplaceTransform[_a _b, _t, _s] :: freeOf[_a, _t] and freeOf[_a, _s] <-> _a LaplaceTransform[_b, _t, _s] LaplaceTransform[_a + _b, _t, _s] <-> LaplaceTransform[_a, _t, _s] + LaplaceTransform[_b, _t, _s] // Derivative of function LaplaceTransform[D[_f[_t], _t], _t, _s] <-> _s * LaplaceTransform[_f[_t], _t, _s] - _f[0] // TODO: How to apply the following to an arbitrary expression, especially // the _f[0] part? // LaplaceTransform[D[_a, _t], _t, _s] :: expressionContains[_a, _t] <-> _s * LaplaceTransform[_a, _t, _s] - _f[0] // Integral of function // Note that the usual convention in Laplace transform literature is that the // integration is performed from t=0! LaplaceTransform[Integrate[_f[_t], _t], _t, _s] <-> (LaplaceTransform[_f[_t], _t, _s] - _f[0]) / s // TODO: Integral of ordinary expression and not arbitrary function? // TODO: How to apply it to an arbitrary expression, especially // the _f[0] part? // See implementation of Shift property below // Shift property e^(a t) f[t] <-> F[s-a] LaplaceTransform[e^((_a:1) _t) _b, _t, _s] :: freeOf[_a, _t] and expressionContains[_b, _t] <-> LaplaceTransform[_b, _t, _s-_a] // LaplaceTransform[e^((_a:1) _t) _f[_t], _t, _s] :: freeOf[_a, _t] <-> LaplaceTransform[_f[_t], _t, _s-_a] // Trigonometric functions // sin[a t + b] LaplaceTransform[sin[(_a:1) _t + (_b:0)], _t, _s] :: freeOf[_a, _t] and freeOf[_b, _t] <-> (_s sin[_b] + _a cos[_b]) / (_s^2 + _a^2) // cos[a t + b] LaplaceTransform[cos[(_a:1) _t + (_b:0)], _t, _s] :: freeOf[_a, _t] and freeOf[_b, _t] <-> (_s cos[_b] - _a sin[_b]) / (_s^2 + _a^2) // Hyperbolic functions // sinh[a t] LaplaceTransform[sinh[(_a:1) _t], _t, _s] :: freeOf[_a, _t] <-> _a / (_s^2 - _a^2) // cosh[a t] LaplaceTransform[cosh[(_a:1) _t], _t, _s] :: freeOf[_a, _t] <-> _s / (_s^2 - _a^2) // e^(a t) LaplaceTransform[e^((_a:1) _t), _t, _s] :: freeOf[_a, _t] <-> 1/(_s - _a) // e^(a t) sin[b t] LaplaceTransform[e^((_a:1) _t) sin[(_b:1) _t], _t , _s] :: freeOf[_a, _t] <-> _b / ((_s - _a)^2 + _b^2) // e^(a t) cos[b t] LaplaceTransform[e^((_a:1) _t) cos[(_b:1) _t], _t , _s] :: freeOf[_a, _t] <-> (_s - _a) / ((_s - _a)^2 + _b^2) // t^n expr where n is a positive integer LaplaceTransform[_t^(_n:1) (_a:1), _t, _s] :: freeOf[_n, _t] and (_n >= 1) and isInteger[_n] <-> (-1)^_n D[LaplaceTransform[_a, _t, _s], _s, _n] } //println[transformExpression[noEval[LaplaceTransform[D[g[t], t], t, s]]]] //println[transformExpression[noEval[LaplaceTransform[Integrate[g[t], t], t, s]]]]