### Rieman Zeta Function Program?

Hello All, I realize this problem in particular will be difficult to answer for anyone without a strong math backround, so if you're looking to help out someone, give it a try. This program is designed to take a complex input, and apply it to the Zeta Function, and output the result. (Obviously it doesnt take the infinite sum, so i set it to go to 1000000 and output to 10 decimal places)

Okay so Here is the problem: The function works perfectly well for value's a + bi where a is any number greater than 1 but as soon as a is less than 1 it gives me a completely wrong answer. Does anyone know how i might fix this? Or if not does anyone have a link to reimans analytic continuation of the function? I know its a vague question but anything helps!

 ``123456789101112131415161718192021222324252627282930313233343536373839404142434445`` ``````#include #include //Logs and trig #include #include //For cout precision #include //Put it in before, but realized i dont need it (yet) using namespace std; int main(){ double real; //Real Part double realsum = 0; double imag; //Imaginary Part double imagsum = 0; double theta; //Argument double n; //Loop double mag; //Magnitude char PlusMinus; //If negative #define Pi 3.14159265 //Define PI std::cout.precision(10); cout << "Enter a complex number in the form of a + bi" << endl; cin >> real; cin >> PlusMinus; cin >> imag; theta = atan(imag/real); mag = sqrt(((pow(imag, 2)) + (pow(real, 2)))); real = real * -1; for (n = 1; n < 1000000; n++) {realsum = realsum + (pow(n, real) * cos(imag*log(n))); imagsum = imagsum + (pow(n, real) * sin(imag*log(n))); } //I know there are a few problems with angles at multiples of pi ill fix it later cout << "Zeta(" << mag << "e^"<< theta << ") is: " << endl; if (PlusMinus == '+') cout << realsum << " + " << imagsum <<"i" << endl; else cout << realsum << " - " << imagsum <<"i" << endl; return 0; }``````

(Sorry for sloppy commenting i just added it while posting this)
Topic archived. No new replies allowed.