# How to define a function that is related to derivative of Jacobi theta function

I would like to make 3D plot of the following function.

F[x_]:=(x D[EllipticTheta[3, 0, E^(-Pi x)], {x, 2}] +
(3/2) D[EllipticTheta[3, 0, E^(-Pi x)], {x, 1}]) x^(5/4))


It did not work with F[1.0]. The error message is: General::ivar: 1. is not a valid variable.

So I define it as:

    G[y_]:=((x D[EllipticTheta[3, 0, E^(-Pi x)], {x, 2}] +
(3/2) D[EllipticTheta[3, 0, E^(-Pi x)], {x, 1}]) x^(5/4)))//.x->y


I can now do:

Plot[F[t], {t, 0, 3/2}]
Plot[F[I t], {t, -Pi/2, Pi/2}]


Is there a proper way to define F[x] without using replacement?

Just use Evaluate.

Let's define

F[x_] := (x D[EllipticTheta[3, 0, E^(-Pi x)], {x, 2}] + (3/2) D[
EllipticTheta[3, 0, E^(-Pi x)], {x, 1}]) x^(5/4)


First we plot the function on the real line

Plot[Evaluate[F[x]], {x, -2, 4}]
(* 141107_Plot _F (x).jpg *)


Now the 3D-plot for Re, Im, and Abs, respectively

Plot3D[Evaluate[Re[F[z] /. z -> x + I y]], {x, -2, 2}, {y, -1, 1}]
(* 141107_Plot3D _Re F (x).jpg *)


Plot3D[Evaluate[Im[F[z] /. z -> x + I y]], {x, -2, 2}, {y, -1, 1}]
(* 141107_Plot3D _Im F (x).jpg *)


Plot3D[Evaluate[Abs[F[z] /. z -> x + I y]], {x, -2, 2}, {y, -1, 1}]
(* 141107_Plot3D _Abs F (x).jpg *)


Regards,
Wolfgang

• Thanks a lot for the help! How about the following plot? Plot3D[Evaluate[Abs[F[Exp[z]] /. z -> x + I y]], {x, 0, 2}, {y, -Pi/2, Pi/2}]
– mike
Nov 7, 2014 at 22:49
• Hi, evaluating F[1.0] gives an error. The OP pointed that out and I think wants to avoid it. Nov 7, 2014 at 23:20
• @ Michael E2: you are right. Hence the best way to avoid it is to adopt Bob Hanlon's proposal. Nov 8, 2014 at 17:50

Use Set ( = ) rather than SetDelayed ( := ) so that the derivatives are carried out before x has a value.

F[x_] = (x D[EllipticTheta[3, 0, E^(-Pi x)], {x, 2}] + (3/2) D[
EllipticTheta[3, 0, E^(-Pi x)], {x, 1}]) x^(5/4);

F[1.]
`

0.446697

• @ Bob Hanlon: your idea is even better. I have compared the speed, funny but := with Evaluate[] is slightly faster than =. Nov 7, 2014 at 22:07
• Thanks a lot. Both methods worked for me.
– mike
Nov 7, 2014 at 23:02