2
$\begingroup$

Is there a way to use DSolve or some other mathematica function to show the first integration before getting to the final output. For example;

DSolve[f''[x] == 0, f[x],x]

Has an output of f[x]-> C[1] + x C[2]

But what if I want to get the first order as well f'[x], mathematica skips past this and shows the final answer. Is there anyway to get both f'[x] and f[x]

$\endgroup$
  • $\begingroup$ What would you want Mathematica to show for a different equation, like f''[x] == - f[x]? If all you're interested in is the final value of f'[x], then @ChipHurst's answer is what you need. But if you want a "intermediate step" that would be part of a solution, that's going to be a lot harder; there are many different techniques used to solve ODEs by hand, and not all of them even yield a value for f'[x] as an intermediate step. $\endgroup$ – Michael Seifert Sep 23 '16 at 15:34
  • $\begingroup$ @MichaelSeifert and Wolfram|Alpha can show the steps to solving an ODE. $\endgroup$ – Chip Hurst Sep 23 '16 at 15:42
  • $\begingroup$ I would be interested in f'[x] for problems where I have certain boundary conditions. for example f'[0] = 0 and f'[t1]=f[t2]. I would need f'[x] to find out what the constant C[1} equals at f'[x]. $\endgroup$ – IAQ Sep 23 '16 at 16:43
  • $\begingroup$ In case you're not aware, Mathematica can handle boundary conditions. For example, your problem with the given boundary conditions would be solved by the command DSolve[{f''[x] == 0, f'[0] == 0, f'[t1] == f[t2]}, f[x], x]. (The only answer is f[x] -> 0 in that particular case, but a more general value for f'[0] gives more interesting results.) $\endgroup$ – Michael Seifert Sep 23 '16 at 17:18
3
$\begingroup$

You can find f'[x] after the fact:

{f'[x], f[x]} /. DSolve[f''[x] == 0, f, x]
{{C[2], C[1] + x C[2]}}
$\endgroup$
2
$\begingroup$

The solution by Chip is the simplest, but just to show different approach

DSolve[{f''[x] == 0, f'[x] == g[x]}, {f[x], g[x]}, x]

Mathematica graphics

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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