Message Boards Message Boards

GROUPS:

Expand double derivative when substituted?

Posted 1 month ago
353 Views
|
3 Replies
|
4 Total Likes
|

I am trying to evaluate:

Expand[D[x[t], {t, 2}] + (x[t])^3 /. x[t] -> A sin[[Omega]t]]

in Mathematica. However, I get the following output:

A^3 sin[[Omega]t]^3 + (x^[Prime][Prime])[t]

whereas I am expecting and output where x''[t] is also differentiated
Could somebody help me figure out what steps to follow to solve this issue?

3 Replies

You could also try the anonymous function (i.e., #&) approach where you replace x[t] with # like so

(D[#, t, t] + #^3) &[A Sin[Omega t]]
(* -(A*Omega^2*Sin[Omega*t]) + A^3*Sin[Omega*t]^3 *)

Try:

 ClearAll["Global`*"]; Remove["Global`*"];
 (x''[t] + (x[t])^3) /. x[t] -> A Sin[Ω[t]] /. x''[t] -> D[A Sin[Ω[t]], {t, 2}]
 (*A^3 Sin[Ω[t]]^3 + A (-Sin[Ω[t]] Derivative[1][Ω][t]^2 + Cos[Ω[t]] (Ω^′′)[t])*)

Or:

ClearAll["Global`*"]; Remove["Global`*"];    
x[t_] := A Sin[Ω[t]];
D[x[t], {t, 2}] + (x[t])^3
(*A^3 Sin[Ω[t]]^3 + A (-Sin[Ω[t]] Derivative[1][Ω][t]^2 + Cos[Ω[t]] (Ω^′′)[t])*)

You have to replace the symbol x with a function:

x''[t] + x[t]^3 /. x -> Function[t, A*Sin[\[Omega]*t]]

The pattern x[t_] does not match anything in x''[t].

Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract