Autor Beitrag
DelphiFreund
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 120

Win XP
D7 Enterprise
BeitragVerfasst: Do 08.07.04 15:57 
Hallo Leute,
mal wieder brauch ich eure Hilfe:

Ihr kennt (hoffentlich :P ) alle x^y, ich weiß das es eine Funktion gibt, die irgendetwas mit dem Logaritmus zu tun hat, die das gleiche Ergebnis liefert.
Wie ging die Formel dafür und welchen Logaritmus berechnet Delphi eigentlich? :?:


Moderiert von user profile iconPeter Lustig: Topic aus Sonstiges verschoben am Do 08.07.2004 um 16:58
jaenicke
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 19346
Erhaltene Danke: 1754

W11 x64 (Chrome, Edge)
Delphi 12 Pro, C# (VS 2022), JS/HTML, Java (NB), PHP, Lazarus
BeitragVerfasst: Do 08.07.04 15:59 
Meinst du Math.pow?

(Ich schreib Math. dazu, damit du weißt, dass die Funktion in der Unit Math steht...

Und der Quelltext ist ja dabei, einfach Strg drücken und auf pow klicken.
(Natürlich nach Einbindung der Unit Math in die uses-Klausel...)
Christian S.
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 20451
Erhaltene Danke: 2264

Win 10
C# (VS 2019)
BeitragVerfasst: Do 08.07.04 16:00 
Hallo!

Da es ja mehr ein mathematisches Problem ist, habe ich das mal ins Off Topic verschoben. Ich glaube, das, was Du suchst, ist folgendes:

x^y = e^(ln(x) * y)

Und Delphi berechnet den natürlichen Logarithmus, also den zur Basis e.

MfG
Peter

_________________
Zwei Worte werden Dir im Leben viele Türen öffnen - "ziehen" und "drücken".
DelphiFreund Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 120

Win XP
D7 Enterprise
BeitragVerfasst: Do 08.07.04 16:02 
Ja, das hab ich gemeint.

Aber nochmal eine Frage:
Natürliche Logaritmus? log???X ?


jaenicke: Danke, Math kenn ich schon, aber 1. Zuviel unwichtiges Zeug 2. ich möchts selber können. 8)
jaenicke
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 19346
Erhaltene Danke: 1754

W11 x64 (Chrome, Edge)
Delphi 12 Pro, C# (VS 2022), JS/HTML, Java (NB), PHP, Lazarus
BeitragVerfasst: Do 08.07.04 16:12 
Wie Peter Lustig schrieb: Zur Basis e, also logeX...
DelphiFreund Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 120

Win XP
D7 Enterprise
BeitragVerfasst: Do 08.07.04 16:13 
Was ist e?
jaenicke
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 19346
Erhaltene Danke: 1754

W11 x64 (Chrome, Edge)
Delphi 12 Pro, C# (VS 2022), JS/HTML, Java (NB), PHP, Lazarus
BeitragVerfasst: Do 08.07.04 16:16 
Die Eulersche Zahl... (ca. 2,7 und in Math bekannt)

Für den Logarithmus zur Basis e schreibt man auch ln(x), wie Peter Lustig es gemacht hat und wie Delphi das auch kann...
DelphiFreund Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 120

Win XP
D7 Enterprise
BeitragVerfasst: Do 08.07.04 16:20 
Danke. Gibt es nicht dafür auch eine Formel, ohne Potenzen zu benutzen?
Segelflieger
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 124

WinXP Pro
D7 Prof
BeitragVerfasst: Do 08.07.04 16:31 
Für e^x gibt es in delphi die Funktion exp(x).

Also:

x^y = exp(ln(x)*y)

_________________
Früher hatten die Menschen Angst vor der Zukunft. Heute muss die Zukunft Angst vor den Menschen haben.
COMMANDER86
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 167

Win XP, Win Vista
D3 Prof., D7 Pers., Lazarus
BeitragVerfasst: Do 08.07.04 16:52 
Das Problem hatte ich auch mal. Ich hab das ganze mit einer for-to-do-Schleife elegant umgangen. :wink:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
var i:integer;
var x,y,z : real;

x:=...;
y:=...;
z:=y;

for i:=1 to y do
begin
y:=y*z;
end;
end.


In etwa so... 8)

Mit freundlichen Grüßen

COMMANDER86


Moderiert von user profile iconPeter Lustig: Delphi-Tags hinzugefügt.

_________________
Streichen Sie bitte sämtlichen Sarkasmus aus vorhergehender Nachricht. Dann wissen Sie, was ich sagen möchte. Meine Lösungen sind die vermutlich Umständlichsten, aber sie funktionieren (bei mir). ;)
DelphiFreund Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 120

Win XP
D7 Enterprise
BeitragVerfasst: Do 08.07.04 17:12 
Was wenn y=2,5 oder 0?
sourcehunter
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 482

Win XP | Suse 10.1
Delphi 2005 Pers.
BeitragVerfasst: Do 08.07.04 19:23 
Im Göhler :wink: steht, dass e^x=1+x/1!+x^2/2!+x^3/3!+...

x!=1*2*3*...*x.

Das ist allerdings das selbe, was Exp(x) auch macht, weil es sonts keinen anderen Weg gibt. Warscheinlich ist das oben noch optimiert, so dass es schneller geht. Desweiteren wirst du feststellen, dass es nicht ganz ohne Potenz geht.

_________________
Linux und OpenSource rulez!
DelphiFreund Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 120

Win XP
D7 Enterprise
BeitragVerfasst: Do 08.07.04 21:32 
Ich bin mir sicher das es da was gab, habs mal irgendwo gelesen. Wenn ichs wieder finde schreib ichs hier rein.

Danke an alle :D
COMMANDER86
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 167

Win XP, Win Vista
D3 Prof., D7 Pers., Lazarus
BeitragVerfasst: Mo 12.07.04 10:36 
@ DelphiFreund

2,5 oder 0 sind kein Problem bei dieser Gleichung. Denn:

Ein Produkt ist gleich Null, wenn einer der Faktoren gleich Null ist.

Die 2,5 wird vom Real-Zahlen-Bereich abgedeckt. Den genauen Berech kenn ich nicht, aber der ist groß genug um 2,5 zu unterstützen :wink: !

Mit freundlichen Grüßen

COMMANDER86

_________________
Streichen Sie bitte sämtlichen Sarkasmus aus vorhergehender Nachricht. Dann wissen Sie, was ich sagen möchte. Meine Lösungen sind die vermutlich Umständlichsten, aber sie funktionieren (bei mir). ;)