1

I am trying to isolate $X(s)$ in the following expression:

e1 = LaplaceTransform[m x''[t] + c x'[t] + k x[t] == HeavisideTheta[t], t, s]
e1 /. LaplaceTransform[x[t], t, s] -> X[s]
Solve[e1, X[s]]

But Solve returns an empty array. What is wrong here?

Johnver
  • 121
  • 1
  • Because you didn't replace anything in e1, you did the replacement and displayed its result, but e1 is unchanged - you didn't name the output of the replacement, so to say. Do e2 = e1 /. LaplaceTransform[x[t], t, s] -> X[s] and then Solve[e2, X[s]]. – corey979 Sep 28 '16 at 21:26
  • Interesting. Thank you. – Johnver Sep 28 '16 at 21:28
  • Relevant: http://mathematica.stackexchange.com/a/19804/29734. – march Sep 28 '16 at 21:30

1 Answers1

1

Doing e1 /. LaplaceTransform[x[t], t, s] -> X[s] doesn't replace anything in the expression e1. It makes a substitution/replacement according to some rule and displays the result, but e1 remains unchanged. This might be a bit confusing due to the replacing name of the function. But consider its operator form:

`ReplaceAll[rule][expression]`

ReplaceAll[rule] is an operand acting on expression. It has the same structure like every other MMA command, e.g. Det: Det[mat] computes the determinant of mat and displays the result; it does not change mat into its determinant, mat is unchanged. The same reasoning applies to ReplaceAll.

So, if one does

e2 = e1 /. LaplaceTransform[x[t], t, s] -> X[s]
Solve[e2, X[s]]

the result will be

enter image description here

NOTE: In the above I made some general statements for the sake of illustration. However, it's important to emphasize that there are commands that actually change the expression they act on, e.g. AppendTo. See this post for a discussion.

corey979
  • 23,947
  • 7
  • 58
  • 101