# Getting Integrate::ilim error while plotting [closed]

I am a beginner in Mathematica. I want to plot for

t = 5

f[x_] = Integrate[Sqrt[ Tanh[x]], x]

r[x_] = Integrate[Cos[f[x]], x]

Plot[r[x], {x, -t, t},
AxesLabel -> {"x"},
PlotLabel -> "y",
PlotRange -> All,
PlotPoints -> 500]


but I'm getting error messages:

Integrate::ilim: Invalid integration variable or limit(s) in -4.99998. >>
Integrate::ilim: Invalid integration variable or limit(s) in -4.97994. >>
Integrate::ilim: Invalid integration variable or limit(s) in -4.9599. >>

Anyone knows a solution?

## closed as off-topic by m_goldberg, MarcoB, happy fish, garej, rhermansMay 22 '17 at 9:33

This question appears to be off-topic. The users who voted to close gave this specific reason:

• "This question arises due to a simple mistake such as a trivial syntax error, incorrect capitalization, spelling mistake, or other typographical error and is unlikely to help any future visitors, or else it is easily found in the documentation." – m_goldberg, happy fish, garej, rhermans
If this question can be reworded to fit the rules in the help center, please edit the question.

• 1) You should do Clear[x] before this code. 2) A more general tip is to learn the difference between = and :=, especially for function definitions like f and r. 3) And finally, the RHS of r[x] is asking Mathematica to compute an antiderivative for Cos[-ArcTan[Sqrt[Tanh[x]]] - 1/2 Log[1 - Sqrt[Tanh[x]]] + 1/2 Log[1 + Sqrt[Tanh[x]]] (which is what I get for Cos[f[x]]), and this is probably too much to ask. So look into NIntegrate instead. – Marius Ladegård Meyer May 21 '17 at 21:00
• Related: (75786), (124706), (135855) – Michael E2 May 22 '17 at 2:19

r[x_] = Integrate[Cos[f[x]], x]

you would have seen that Mathematica returned the integral unevaluated because it couldn't find a closed-form solution. One way to proceed with solving your problem is to numerically integrate to make a table of points along r[x] in the interval of interest.
f[x_] = Integrate[Sqrt[Tanh[x]], x]