I set up a symbolic integral, to be evaluated only when some of the symbols have been replaced by numbers. The evaluation after assigning numbers to the symbols is still symbolic for some reason. The code is (after clearing all)
$Assumptions=0 < r < 1 && 0 < ah < al && 0 < s && t \[Element] Reals && llow < lhi
rev[t_] := Exp[t]/(1 + Exp[t])
yh1[t_] := \[ExponentialE]^(1/2 t (-1 - Sqrt[1 + 8 r s^2]))
yh2[t_] := \[ExponentialE]^(1/2 t (-1 + Sqrt[1 + 8 r s^2]))
(* Wronskians *)
wrh[t_] := yh1[t]*yh2'[t] - yh1'[t]*yh2[t]
(* Particular solutions of the inhomogeneous equations *)
uh[t_] := rev[t] - ah
inth1[t_, llow_?NumericQ, r_?NumericQ, s_?NumericQ, ah_?NumericQ] :=
Integrate[yh2[z]*uh[z]/wrh[z], {z, llow, t}]
inth2[t_, llow_?NumericQ, r_?NumericQ, s_?NumericQ, ah_?NumericQ] :=
Integrate[yh1[z]*uh[z]/wrh[z], {z, llow, t}]
yhp[t_, llow_, r_, s_, ah_] := -yh1[t]*inth1[t, llow, r, s, ah] +
yh2[t]*inth2[t, llow, r, s, ah]
yhp[t, llow, r, s, ah]
% /. {llow -> -2, lhi -> 2, ah -> 0.1, r -> 1, s -> 1}
The output of yhp[t, llow, r, s, ah]
is
-\[ExponentialE]^(1/2 t (-1 - Sqrt[1 + 8 r s^2])) inth1[t, llow, r, s,ah] +
\[ExponentialE]^(1/2 t (-1 + Sqrt[1 + 8 r s^2])) inth2[t, llow, r, s, ah]
like it's supposed to be. But the output of % /. {llow -> -2, lhi -> 2, ah -> 0.1, r -> 1, s -> 1}
has r
,s
etc still in it.
I tried to reproduce the problem in a simple example, but the example works fine. It is
Clear[x, k, int, f]
$Assumptions = {x, k} \[Element] Reals
int[x_, k_?NumericQ] :=
Integrate[Exp[z]/((1 + Exp[z])*Exp[k*z]), {z, 0, x}]
f[x_, k_] := x*int[x, k]
f[x, k]
% /. {k -> 2}
and the final output is
x (1 - \[ExponentialE]^-x - Log[2] + Log[1 + \[ExponentialE]^-x])
as it's supposed to be.
yh1
andyh2
should be functions ofr
ands
, but they are not. $\endgroup$