0
$\begingroup$

I am wanting to algebraically manipulate expressions resulting from LaplaceTransform applied to time domain expressions. Unknown variables are left unevaluated by the transform as they should be. I wish to replace unevaluated transform expressions with the traditional forms.

For example: LaplaceTransform[x[t],t,s] -> x[s]

Here is my naïve attempt which doesn't work:

eqs = -((k1 + k2)  LaplaceTransform[x1[t], t, s]) + 
    k2  LaplaceTransform[x2[t], t, s] - 
    m1  (s^2  LaplaceTransform[x1[t], t, s] - s  x1[0] - 
       Derivative[1][x1][0]) == 
   dmp1  (s  LaplaceTransform[x1[t], t, s] - x1[0]);

eqs /. Unevaluated[LaplaceTransform[v_[t], t, s]] -> v[s]

(*-((k1+k2) LaplaceTransform[x1[t],t,s])+k2 \
LaplaceTransform[x2[t],t,s]-m1 (s^2 LaplaceTransform[x1[t],t,s]-s \
x1[0]-(x1^\[Prime])[0])\[Equal]dmp1 (s \
LaplaceTransform[x1[t],t,s]-x1[0])*)

Could someone please suggest an approach that works?

Thank you

$\endgroup$

1 Answer 1

2
$\begingroup$

Perhaps something like the following will work for you?

Unprotect[LaplaceTransform];

LaplaceTransform/:MakeBoxes[LaplaceTransform[x_Symbol[t_], t_, s_], StandardForm] := RowBox[{toCap[x], "[",MakeBoxes@s,"]"}]

Protect[LaplaceTransform];

toCap[x_Symbol] := With[{s=SymbolName[x]},
    If[LowerCaseQ @ s, ToUpperCase[s], OverscriptBox[s, "^"]]
]

Example:

LaplaceTransform[f'[t],t,s]

-f[0] + s F[s]

$\endgroup$
3
  • $\begingroup$ Thanks, Carl. That is close to working. But it results in symbols enclosed in OverHat which appear to interfere with the use of Solve. Can it be modified to keep symbols in lower case so they don't conflict with reserved symbols, and to eliminate the OverHat? $\endgroup$ Jan 30 at 22:18
  • $\begingroup$ I don't see why the OverHat interferes with Solve, since it is just a formatting construct, the underlying expression is still just a LaplaceTransform object. Perhaps you are using Solve[..., F[s]] when you should be using Solve[..., LaplaceTransform[f[t], t, s]]? I used OverHat/uppercase since I assumed you wouldn't want to use both f[0] and f[s] in your outputs, where the f[0] is in the t domain, and the f[s] is in the s domain. $\endgroup$
    – Carl Woll
    Jan 31 at 15:01
  • $\begingroup$ Thank you, Carl. That was the problem. I’ve been using Mathematica for a very long time. I consider myself a sophisticated user. But your incantations are a mystery to me. 😀 thanks again! $\endgroup$ Feb 1 at 0:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.