F(x)=x+5π funksiyani [-π; π] oraliqda fur'ye qatoriga yoying


f(x) = 6π + ∑[n=1 to ∞] [(2/n + 10/n²) sin(nx)]


Download 279.03 Kb.
bet2/4
Sana29.07.2023
Hajmi279.03 Kb.
#1663563
1   2   3   4
Bog'liq
2-amaliy topshiriq

f(x) = 6π + ∑[n=1 to ∞] [(2/n + 10/n²) sin(nx)]

Bu formulada n butun sonlar uchun sin(nx) ni hisoblashimiz mumkin. Chunki bₙ = 0, cos(nx) koeffitsiyenti mavjud emas.




C++ kodi:

#include


#include
const double pi = 3.14159265358979323846;
double calculate_a0() {
return 6 * pi;
}
double calculate_an(int n) {
return (2.0 / n + 10.0 / (n * n)) * sin(n * pi);
}
double calculate_bn() {
return 0; // bn = 0 for this function
}
double calculate_fourier_series(double x, int num_terms) {
double result = calculate_a0();
for (int n = 1; n <= num_terms; ++n) {
result += calculate_an(n) * sin(n * x);
}
return result;
}
int main() {
double lower_bound = -pi;
double upper_bound = pi;
int num_terms = 10;
for (double x = lower_bound; x <= upper_bound; x += 0.1) {
double f_x = x + 5 * pi;
double fourier_series = calculate_fourier_series(x, num_terms);
std::cout << "x = " << x << ", f(x) = " << f_x << ", Fourier series = " << fourier_series << std::endl;
}
return 0;
}






  1. Vazifa:

f(x)=x^2-4 funksiyani (0;1) oraliqda fur'ye qatoriga yoying.


Javob:

f(x) = a₀ + ∑[n=1 to ∞] (aₙ cos(nx) + bₙ sin(nx))


Bu formulda a₀, aₙ, va bₙ - Fourier koeffitsiyentlaridir.
Biz f(x) = x^2 - 4 funksiyasini yoyib berish uchun, koeffitsiyentlarni topishimiz kerak.
a₀ ni topish uchun, f(x) ni 0 dan 1 gacha integrallaymiz va natijani 1 ga bo'lib 2 ga bo'lib bo'limaymiz:
a₀ = (1/1) ∫[0 to 1] (x^2 - 4) dx
= ∫[0 to 1] (x^2 - 4) dx
= [(x^3/3 - 4x) | [0 to 1]
= [(1/3 - 4) - (0 - 0)]
= (-11/3)

aₙ ni topish uchun, f(x) ni 0 dan 1 gacha integrallaymiz, cos(nx) bilan ko'paytiramiz va natijani 1 ga bo'lib 2 ga bo'lib bo'limaymiz:


aₙ = (1/1) ∫[0 to 1] (x^2 - 4) cos(nx) dx


= ∫[0 to 1] (x^2 - 4) cos(nx) dx
= [(x^2/n sin(nx) - 2/n^2 cos(nx)) | [0 to 1]
= [(1/n sin(n) - 2/n^2 cos(n)) - (0 - 0)]
= (1/n sin(n) - 2/n^2 cos(n))

bₙ ni topish uchun, f(x) ni 0 dan 1 gacha integrallaymiz, sin(nx) bilan ko'paytiramiz va natijani 1 ga bo'lib 2 ga bo'lib bo'limaymiz:


bₙ = (1/1) ∫[0 to 1] (x^2 - 4) sin(nx) dx


= ∫[0 to 1] (x^2 - 4) sin(nx) dx
= [(-x^2/n cos(nx) + 4/n^2 sin(nx)) | [0 to 1]
= [(-1/n cos(n) + 4/n^2 sin(n)) - (0 - 0)]
= (-1/n cos(n) + 4/n^2 sin(n))

Ushbu koeffitsiyentlarni topganimizga ko'ra, f(x) = x^2 - 4 funksiyasining Fourier qatori quyidagicha bo'ladi:


f(x) = (-11/3) + ∑[n=1 to ∞] [(1/n sin(n) - 2/n^2 cos(n)) cos(nx) + (-1/n cos(n) + 4/n^2 sin(n)) sin(nx)]

Bu formulada a₀ = -11/3 koeffitsiyenti hisoblanadi.


Natijada, f(x) ni Fourier qatori quyidagicha bo’ladi:





Download 279.03 Kb.

Do'stlaringiz bilan baham:
1   2   3   4




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©fayllar.org 2024
ma'muriyatiga murojaat qiling