# Solving for the limits of an integral

I am trying to get Mathematica to solve for the symmetric limits of an integral of a Square Wave.

Solve[{Integrate[SquareWave[{0.2, 0}, ((x - 2.5)/10)], {x, 0 + a,
10 - a}] == 0.95, 0 <= a <= 1}, a, Reals]


I already know that the only solution for $a$ is 0.125. I am just trying to improve my Mathematica knowledge here. When I run the above, it simply returns unevaluated. I have also tried NSolve, and NIntegrate, but neither of those appears to work either.

Any ideas?

Best,

Ben

Solve[{Integrate[ SquareWave[{2/10, 0}, ((x - 25/10)/10)], {x, a, 10 - a},
Assumptions -> 0 < a < 1] == 95/100,
0 <= a <= 1}, a, Reals]

(* {{a -> 1/8}} *)

• Thanks for that. Much appreciated. Why was it that I needed to tell Integrate my assumptions though? I thought that would be handled (and passed down to Integrate) by the 0 <= a <= 1 condition in Solve. Thanks again! Best, Ben Mar 24, 2015 at 0:51
• @ben18785 Because the integral behaves differently in different ranges. Try Plot[Integrate[ SquareWave[{2/10, 0}, ((x - 25/10)/10)], {x, a, 10 - a}], {a, -10,10}] Mar 24, 2015 at 0:54
• Ok - great. I understand it. Thanks again! Best, Ben Mar 24, 2015 at 0:55

Alternatively, use FindRoot

FindRoot[Integrate[
SquareWave[{0.2, 0}, ((x - 2.5)/10)], {x, 0 + a, 10 - a}] == 0.95, {a, .5}]


{a -> 0.125}

• Thanks for your answer. Much appreciated. Best, Ben Mar 24, 2015 at 0:56