You can use Stan Wagon's FindRoots2D
function for conveniently finding all zeros in a region. When using this function, you'll need to explicitly break the complex function into Re
and Im
parts and find the points where both are zero.
I'm going to give you an example that you can modify for your purposes. Make sure to evaluate the definition of FindRoot2D
first.
Partial sums of the Riemann ζ are given by HarmonicNumber
in Mathematica. As a beginner, be sure to always expand the Details section of documentation pages. There's a lot of important and useful information "hidden" there, for example every special function has a precise definition in this section.
Let's sum up to n
:
n = 10;
Then the function is HarmonicNumber[n, x + I y]
. Let's find its zeros (be sure to evaluate the definition from here first):
zeros = FindRoots2D[{Re[HarmonicNumber[n, x + I y]], Im[HarmonicNumber[n, x + I y]]}, {x, -4, 12}, {y, -12, 12}]
These are some colours from an old package I like to use:
mediumSeaGreen = RGBColor[0.235298`, 0.702002`, 0.443098`];
violet = RGBColor[0.559999`, 0.370006`, 0.599994`];
orangeRed = RGBColor[1.`, 0.270608`, 0.`];
Now let's plot the zeros, together with the contours of zero real and imaginary parts:
ContourPlot[{Re[HarmonicNumber[n, x + I y]] == 0, Im[HarmonicNumber[n, x + I y]] == 0}, {x, -4, 10}, {y, -12, 12},
MaxRecursion -> 3, (* this is to make it smoother at the expense of more computation *)
ContourStyle -> {Directive[Thick, mediumSeaGreen], Directive[Thick, violet]}, (* this is to make it prettier *)
Epilog -> {PointSize[0.02], orangeRed, Point[zeros]} (* this is to plot the roots as big orange dots *)
]
The reason why I plotted the contours as well is that this FindRoots2D
function also uses ContourPlot
to come up with initial estimates for the roots, which it then improves using FindRoot
.
You'll find all the functions and options I used in the documentation. This example is to show you how to put them together. Note: The things I put in Epilog
are the same types of graphics primitives you can use in Graphics
.
The code I used is on my office computer
You are saying you do not haveGoToMyPc
installed? (I hear this commerical ad on radio for gotomypc , the techguy show) and thought this is good time to say it :) $\endgroup$