ANA SAYFA
İÇİNDEKİLER
PROSEDÜR
FONKSİYON
=> Örnek 1
=> Örnek 2
=> Örnek 3
=> Örnek 4
=> Örnek 5
=> Örnek 6
=> Örnek 7
=> Örnek 8
=> Örnek 9
=> Örnek 10
=> Örnek 11
=> Örnek 12
=> Örnek 13
=> Örnek 14
=> Örnek 15
=> Örnek 16
=> Örnek 17
=> Örnek 18
=> Örnek 19
=> Örnek 20
=> Örnek 21
=> Örnek 22
=> Örnek 23
=> Örnek 24
=> Örnek 25
İSTATİSTİK
Z. DEFTERİ
İLETİŞİM
Örnek 17

Soru = Cos(x)’in Mac Laurin seri açılımı cos(x) = 1 - x2/2! + x4/4! - x6/6! + x8/8! ... şeklindedir. x radyan cinsinden verilen açıyı göstermek üzere, cos(x)’i hesaplayacak programı kullanıcı tanımlı fonksiyon kullanarak yazınız.

Şekli :

Image Hosted by ImageShack.us

Kodlar : 

Function faktor(deger:integer):longint;
var 
f:longint; k:byte;
begin
f:=1;
for k:=1 to deger do
f:=f*k;
faktor:=f;
end;
 
Function xCos(x:real):real;
const 
duyarlilik=0.00000001;
var
arasonuc, sonuc: real;
sayi, isaret: integer;
begin
sonuc:=0.0;
isaret:=1;
sayi:=0;
repeat
sonuc:=sonuc + isaret * exp(sayi*ln(x)) / faktor(sayi);
isaret:=isaret*(-1);
sayi:=sayi+2;
until (exp(sayi*ln(x))/faktor(sayi) < duyarlilik);
xCos:=sonuc;
end;
 
Procedure TForm1.Button1Click(Sender: TObject);
begin
Edit2.text:=floattostr(xCos(strtofloat(edit1.text)/180*pi));
end;
 
Çalışma Şekli :

Image Hosted by ImageShack.us       Image Hosted by ImageShack.us

Derece girildikten sonra ‘Hesapla’ butonuna tıklandığında bize açı değerini gösterecektir.

 

Hakkında
Bu tasarım PINAR ÖZER tarafından sistem analizi dersi için verilen proje kapsamında yapılmıştır.
Bu web sitesi ücretsiz olarak Bedava-Sitem.com ile oluşturulmuştur. Siz de kendi web sitenizi kurmak ister misiniz?
Ücretsiz kaydol