4
$\begingroup$

I am trying to make a repeated differentiation of the differential equation and replacing the result with the previous answer. But I do not know how to substitute answer into another. I tried Merge, Join, Union, Replace and it does not work. Below is the example code,

 ClearAll; x[0]=1; x'[0]=2; equation = x''[t]==x'[t]-x[t]; answer = D[equation,t] newanswer = Join[answer, equation] 

The answer is $x'''[t]==x''[t]-x'[t]$. I want to substitute equation in the answer or replace $x''[t]$ in the answer with $x'[t]-x[t] $ as defined in the equation so that I should get a newanswer $ x'''[t]==x'[t]-x[t]-x'[t]$. Furthermore, I should later on substitute with $ x[0]=1$ and $x'[0]=2$. What are the functions that will allow me to do operations like that? Am I defining equation and differentiating it incorrectly?

$\endgroup$

2 Answers 2

4
$\begingroup$

Perhaps this:

newanswer = Eliminate[{answer, equation}, x''[t]] (* -x'''[t]] == x[t] *) 

Or this:

newanswer = Reduce[{answer, equation}, x'''[t], {x''[t]}] (* x'''[t]] == -x[t] *) 

As for what to do "later on," perhaps this:

Reduce[{answer, equation, x[0] == 1, x'[0] == 2} /. t -> 0] (* x'''[0] == -1 && x''[0] == 1 && x'[0] == 2 && x[0] == 1 *) 

Or this:

Solve[{answer, equation, x[0] == 1, x'[0] == 2} /. t -> 0] (* {{x[0] -> 1, x'[0] -> 2, x''[0] -> 1, x'''[0] -> -1}} *) 
$\endgroup$
4
$\begingroup$

You could define:

x[0] = 1; x'[0] = 2; Derivative[n_?(GreaterEqualThan[2])][x] = Derivative[n-1][x][#] - Derivative[n-2][x][#]&; 

Then:

x'''[t] x'''[0] x''''''[0] 

-x[t]

-1

1

$\endgroup$

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.