|
3-amaliy ishi
|
tarix | 07.06.2023 | ölçüsü | 240,56 Kb. | | #126202 |
| 3-amaliy ish
TATU QARSHI FILIALI TT VA KT FAKULTETI TT-11-21 GURUH TALABASI QUDRATOV MUSULMONNING ALGORITMLARNI LOYIHALASH FANIDAN TAYYORLAGAN
3-AMALIY ISHI
#include
#include
using namespace std;
const double PI = 3.14159265358979323846;
double integral_cos_cos(int m, int n) {
if (m == n) {
return PI;
} else {
return sin((m-n)*PI) / (m - n) - sin((m+n)*PI) / (m + n);
}
}
double integral_cos_sin(int m, int n) {
if (m == n) {
return 0;
} else {
return (sin((m-n)*PI) / (m - n) - sin((m+n)*PI) / (m + n)) / 1.0;
}
}
int main() {
int n;
cout << "Hisoblash uchun koeffitsientlar sonini kiriting: ";
cin >> n;
double a0 = 0;
double an, bn;
for (int i = 1; i <= n; i++) {
an = 1 * integral_cos_cos(1, i) / PI;
bn = 1 * integral_cos_sin(1, i) / PI;
if (i == 1) {
a0 = an;
}
cout << "a" << i << " = " << an << endl;
cout << "b" << i << " = " << bn << endl;
}
cout << "a0 = " << a0 << endl;
return 0;
}
Dostları ilə paylaş: |
|
|