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?
Clear[x]
before this code. 2) A more general tip is to learn the difference between=
and:=
, especially for function definitions likef
andr
. 3) And finally, the RHS ofr[x]
is asking Mathematica to compute an antiderivative forCos[-ArcTan[Sqrt[Tanh[x]]] - 1/2 Log[1 - Sqrt[Tanh[x]]] + 1/2 Log[1 + Sqrt[Tanh[x]]]
(which is what I get forCos[f[x]]
), and this is probably too much to ask. So look intoNIntegrate
instead. $\endgroup$