Message Boards Message Boards

0
|
4909 Views
|
3 Replies
|
4 Total Likes
View groups...
Share
Share this post:

Expand double derivative when substituted?

Posted 5 years ago

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?

POSTED BY: Aakash Gupta
3 Replies

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])*)
POSTED BY: Mariusz Iwaniuk

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 *)
POSTED BY: Tim Laska

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].

POSTED BY: Gianluca Gorni
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