Consider the IVP:

$$x'=\frac92-\frac{x}{300+2t},\quad x(0)=0$$

Working the solution by hand, the answer is:


Entering code and then attempting to simplify, I tried Simplify and Expand.

In[214]:= sol = 
 DSolveValue[{x'[t] == 9/2 - x[t]/(300 + 2 t), x[0] == 0}, x[t], t]

Out[214]= -((
 3 (750 Sqrt[6] - 150 Sqrt[150 + t] - t Sqrt[150 + t]))/Sqrt[150 + t])

In[215]:= Simplify[%]

Out[215]= 3 (150 - 750/Sqrt[25 + t/6] + t)

In[216]:= Expand[%]

Out[216]= 450 - 2250/Sqrt[25 + t/6] + 3 t

Is there a better way to simplify the answer so it looks more like my hand calculated answer, or if not, is there some way of getting clearing fractions from the radical in the denominator?


In this case, you can simply call Apart:


$$450+3 t-\frac{2250 \sqrt{6}}{\sqrt{t+150}}$$

This is almost identical to your hand-written version. Is this good enough?

  • $\begingroup$ It is very good with a very easy command. Nice job. Let me ask one more question: How can I multiply both numerator and denominator of the fractional part by sort(3)? $\endgroup$ – David Jan 31 '15 at 22:25
  • $\begingroup$ @David: Doing that wouldn't be easy, as it would probably try to simplify back to its original condition during evaluation. In general, manipulating how Mathematica chooses to simplify expressions is a nontrivial task. You could probably do it with some silly tricks, but it's probably easier to avoid. $\endgroup$ – DumpsterDoofus Jan 31 '15 at 23:07

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.