# Defining functions trouble [closed]

I'm a neophyte in Mathematica so this is a very basic question.

I'm having trouble with defining the following functions:

ClearAll[rtartaruga, f, g]

(* formula 2.22 *)
rtartaruga[r_, rp_, rm_, ν_] := (2 ν*rp -
Sqrt[rp* rm *(ν^2 + 3)])/((ν^2 + 3)*(rp - rm))*
Log[Abs[ r - rp]] - (2 ν*rm -
Sqrt[rp* rm *(ν^2 + 3)])/((ν^2 + 3)*(rp - rm))*Log[Abs[r - rm]]

?rtartaruga

(* formula 3.24 *)
f[rmin_, rmax_, rm_, rp_, ν_, Ε_] := Integrate[
1/((ν^2 + 3)*(r - rm)*(r -
rp))*[r (2 ν r - Sqrt[rp*rm*(ν^2 + 3)] ) - 2*Ε*
Sqrt[[(2 ν r - Sqrt[rp*rm*(ν^2 + 3)] )^2 - (ν^2 + 3)*
(r - rm)*(r - rp)]/(4*Ε^2 +
(ν^2 + 3)*(r - rm)*(r - rp))]], {r,rmin, rmax}]

?f

(*formula 3.25*)
g[τ_, rmin_, rmax_, rp_, rm_, ν_] := τ/(2*rAdS) +
rtartaruga[rmax, rp, rm, ν] - rtartaruga[rmin, rp, rm, ν]

?g

rtartaruga[r, rp, rm, ν]
f[rmin, rmax, rm, rp, ν, Ε]
g[τ, rmin, rmax, rp, rm, ν]


When I run the code it yields this output:

  rtartaruga[r_,rp_,rm_,ν_]:=((2 ν rp-Sqrt[rp rm (ν^2+3)])
Log[Abs[r-rp]])/((ν^2+3) (rp-rm))-((2 ν rm-Sqrt[rp rm
(ν^2+3)]) Log[Abs[r-rm]])/((ν^2+3) (rp-rm))


And the name "rtartaruga" from blue becomes black, whereas those of the functions "f" and "g" remain blue.

I guess I'm missing the output for the commands "?f", "?g" and for those in the last three lines, but I'm not able to spot the problems in the code.

Thank's a lot for your help!

• Nov 29, 2018 at 14:24

In your definition of f, you have used square brackets [...] without a "function name", if you use square brackets, then they need to be used in association with a function, e.g. Sqrt[...] as you have in other positions.
Either you have missed a function name or you have used [...] when you actually need to be using (...).
f[rmin_, rmax_, rm_, rp_, ν_, Ε_] := Integrate[