Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <math.h>
- #include <bits/stdc++.h>
- double reZeta (double s, double t = 0, int lim = 1000) {
- double re; int i;
- for (i = 1; i <= lim; i++) {
- re += pow(i,-s)*cos(t*log(i));
- }
- re += ((s-1)*cos(t*log(lim))+(-t)*sin(t*log(lim)))*pow(lim,1-s)/((1-s)*(1-s)+t*t);
- return re;
- }
- double imZeta (double s, double t = 0, int lim = 1000) {
- double im; int i;
- for (i = 1; i <= lim; i++) {
- im -= pow(i,-s)*sin(t*log(i));
- }
- im += ((-t)*cos(t*log(lim))-(s-1)*sin(t*log(lim)))*pow(lim,1-s)/((1-s)*(1-s)+t*t);
- return im;
- }
- int main () {
- double s; double t;
- std::cout << "ΞΆ(z)" << std::endl;
- while (s != 1 or t != 0) {
- std::cout << "Input consecutively the real and imaginary parts" << std::endl;
- std::cin >> s >> t;
- if (s == 1 and t == 0) {
- break;
- }
- std::cout << "ΞΆ(" << s << "+" << t << "i" << ") β " << reZeta(s,t) << "+" << imZeta(s,t) << "i" << std::endl;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement