DSolve[ {f'[t] + \[Omega][t] f[t] == 0, f[t0] == 1}, f[t], t]


f[t] -> E^(Inactive[Integrate][-\[Omega][K[1]], {K[1], 1, t}] - 
Inactive[Integrate][-\[Omega][K[1]], {K[1], 1, t0}])

$$ f(t)\to \exp \left(\int _1^t-\omega (K[1])dK[1]-\int _1^{\text{t0}}-\omega (K[1])dK[1]\right) $$

Whereas the obvious more compact answer is

f[t] -> E^(Inactive[Integrate][-\[Omega][K[1]], {K[1], t0, t}]  )

$$ f(t)\to \exp \left(\int _{\text{t0}}^t-\omega (K[1])dK[1]\right) $$

The unity ("1") as initial value is totally unnecessary. How do I ensure that it is not seen in the answer. FullSimplify does not work either.

  • $\begingroup$ Please make your question explicit. $\endgroup$
    – Szabolcs
    Commented Jun 21, 2021 at 11:05

2 Answers 2


Here's a way that works (see NumericQ::set for the use of NumericQ below — not sure if there are better refs for it):

NumericQ[t0] = True; (* make t0 seem numeric *)
DSolve[{f'[t] + ω[t] f[t] == 0, f[t0] == 1}, f, t]
NumericQ[t0] =.      (* unset the numeric setting *)

DSolve insists that base points for the integration be numeric. The developers must have had some use-case in mind where this is advantageous, but I cannot think of one.

Exploratory analysis:

DSolve gives a single integral when the initial condition is numeric:

DSolve[{f'[t] + ω[t] f[t] == 0, f[2] == 7}, f, t]

However, DSolve does this by looking for a function of the form g[a] with a numeric. So for instance, the following changes the base point from 1 to 17:

DSolve[{f'[t] + ω[t] f[t] == 0, f[t0] == Cos[17]}, f, t]

If DSolve finds exactly one numeric argument to a function, then it uses that value as the base point for the integration, whether or not it is the starting time for the initial condition. Then solves the general solution for the constant. If the base point and the initial condition coincide, then the constant will be the function value at the initial condition; otherwise, the constant will involve an integral from the base point to the initial condition. This should be considered sloppy parsing and probably a bug. However, this is a different issue than the one the OP raises.

If DSolve find no numeric arguments (the OP's case) or more than one (see next example), it defaults to 1 as the base point:

DSolve[{f'[t] + ω[t] f[t] == 0, f[0] == Cos[17]}, f, t]

DSolve checks at least twice to see if the initial condition is at a numeric value and resets the base point to 1 if it's not. I don't see a way around it except by defining NumericQ[t0] to be True as above.

  • $\begingroup$ I hate manually changing the answer before copying it into a LaTeX file. This is especially troublesome when the expressions are lengthy. Mathematica should fix this issue. It is really sloppy.. $\endgroup$ Commented Jul 21, 2021 at 4:19

You can use ReplaceAll /. taking care to notice that the output from DSolve is the inactive form of the integral.

solMap = DSolve[{f'[t] + \[Omega][t] f[t] == 0, f[t0] == 1}, f[t], t]
solMap /. Inactivate[
           Integrate[g_, {x_, 1, t}] - Integrate[g_, {x_, 1, t0}], 
           Integrate] -> Inactivate[Integrate[g, {x, t0, t}], Integrate]

which should output $$f(t)\to \exp \left(\int _{\text{t0}}^t-\omega (K[1])dK[1]\right)$$ as desired.

If just the solution is wanted, we can get rid of the mapping first and do the same replacement with

sol = f[t] /. First@DSolve[{f'[t] + \[Omega][t] f[t] == 0, f[t0] == 1}, f[t], t]
sol /. Inactivate[
        Integrate[g_, {x_, 1, t}] - Integrate[g_, {x_, 1, t0}],
        Integrate] -> Inactivate[Integrate[g, {x, t0, t}], Integrate]

giving just $$\exp \left(\int _{\text{t0}}^t-\omega (K[1])dK[1]\right).$$

If we try the same thing without the Inactivate[#,Integrate] part it doesn't work. E.g.

sol /. Integrate[g_, {x_, 1, t}] - Integrate[g_, {x_, 1, t0}] -> Integrate[g, {x, t0, t}]

gives the undesired $$ \exp \left(\int _1^t-\omega (K[1])dK[1]-\int _1^{\text{t0}}-\omega (K[1])dK[1]\right).$$

  • $\begingroup$ Although this works for the question asked, this is just a specific example. I want a generic command that gives what I want without having to write specific code for each example.. $\endgroup$ Commented Jul 21, 2021 at 4:14
  • $\begingroup$ The answer I provided is generic way to combine $\int_a^b f(x)dx + \int_b^c f(x)dx$ into $\int_a^c f(x)dx$. The provided answer specifically uses $b=1$, $a=t_0$, and $c=t$, but these can easily be changed to be more general. You explicitly mentioned "1", $t_0$, and $t$ as bounds in your question though. $\endgroup$
    – Derek H
    Commented Jul 21, 2021 at 12:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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