AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Thema durchsuchen
Ansicht
Themen-Optionen

Mathe Unit

Ein Thema von ssach · begonnen am 11. Mai 2003 · letzter Beitrag vom 11. Mai 2003
Antwort Antwort
ssach

Registriert seit: 9. Dez 2002
Ort: schleiwenhaff
99 Beiträge
 
Delphi 6 Professional
 
#1

Mathe Unit

  Alt 11. Mai 2003, 02:26
hy,

ichhabe eine kleine sammlung von mathefunktionen in eineunit geschrieben, wenn ihr vorschlaege habt fuer weitere funtionen, bitte sendet sie mir!!

danke

cu
Angehängte Dateien
Dateityp: pas mathe.pas (1,7 KB, 13x aufgerufen)
Greissen all d'Letzebuerger !!
  Mit Zitat antworten Zitat
Benutzerbild von mirage228
mirage228

Registriert seit: 23. Mär 2003
Ort: Münster
3.750 Beiträge
 
Delphi 2010 Professional
 
#2
  Alt 11. Mai 2003, 06:12
sind die funktionsnamen und kommentare in FRANZÖSISCH oder kommt mir das nur so vor?
David F.
  Mit Zitat antworten Zitat
Benutzerbild von toms
toms
(CodeLib-Manager)

Registriert seit: 10. Jun 2002
4.648 Beiträge
 
Delphi XE Professional
 
#3
  Alt 11. Mai 2003, 07:59
Hi,

Einige Funktionen gibt's bereits in der Math unit, daher überflüssig.
PS: Der Source Code ist schlecht formatiert.

Sieht doch besser so aus?

Code:
unit Mathe;

interface

uses SysUtils;

implementation

function Factorielle(X: Integer): Longint;
var
  N: Integer;
begin
  Result := 1;
  for N := 1 to X do
    Result := Result * N;
end;

function Exposant(X: real; Y: Integer): Extended;
var
  N: Integer;
  TEMP: real;
begin
  if Y = 0 then
    Result := 1
  else
  begin
    Result := X;
    TEMP  := X;
    for N := 2 to Y do
      Result := Result * TEMP;
    if Y < 0 then
      Result := 1 / Result;
  end;
end;

function Tan(COS: real; SIN: real): real;
begin
  Result := COS / SIN;
end;

function Pourcent(X: real; Y: Integer): Extended;
begin
  Result := (X / 100) * Y;
end;

//Pour un triangle de pascal
function COEF_BINOMIAL(P: Integer; Q: Integer): real;
begin
  Result := Factorielle(P) / (Factorielle(Q) * Factorielle(P - Q));
end;

function Pythagore(A: real; B: real): real;
begin
  Result := sqrt(sqr(A) + sqr(B));
end;

function PairImpair(X: Integer): Boolean;
begin
  Result := True;
  if (X mod 2 <> 0) then Result := False;
end;

function Fibunacci(X: Integer): Extended;
var
  I: Integer;
begin
  Result := 1;
  for I := 1 to X do
    Result := Result + X;
end;

function DecToDual(X: Longint): string;
begin
  Result := '';
  while (X <> 0) do
  begin
    Result := Result + IntToStr(X mod 2);
    X := X div 2;
  end;
end;

function DualtoDec(X: string): Longint;
var
  I, COUNTER: Integer;
begin
  Result := 0;
  COUNTER := 0; //for Exposant
  for I := Length(X) downto 1 do
  begin
    Result := Result + round(Exposant(StrToInt(X[I]), COUNTER));
    COUNTER := COUNTER + 1;
  end;
end;

end.
Thomas
  Mit Zitat antworten Zitat
ssach

Registriert seit: 9. Dez 2002
Ort: schleiwenhaff
99 Beiträge
 
Delphi 6 Professional
 
#4
  Alt 11. Mai 2003, 20:47
ja,

kommentare sind in französisch *g*! nutze normalerweise englisch jedochj manchmal auch französisch!
Greissen all d'Letzebuerger !!
  Mit Zitat antworten Zitat
Antwort Antwort


Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 00:54 Uhr.
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz