Autor Beitrag
Fabian
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 42



BeitragVerfasst: So 21.07.02 15:06 
Wie kann ich x hoch n berechnen ? Wie lautet in Delphi der Befehl um zu potenzieren ?
Klabautermann
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Veteran
Beiträge: 6366
Erhaltene Danke: 60

Windows 7, Ubuntu
Delphi 7 Prof.
BeitragVerfasst: So 21.07.02 15:14 
Hallo,

dies ist der von dir gesuchte Befehl:
ausblenden Quelltext
1:
function Power(Base, Exponent: Extended): Extended;					

Zu finden in der Unit Math.

Gruß
Klabautermann
Christian S.
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 20451
Erhaltene Danke: 2264

Win 10
C# (VS 2019)
BeitragVerfasst: So 21.07.02 15:18 
Hi!

Das sollte so gehen:
ausblenden Quelltext
1:
ergebnis:=exp(ln(x)*n);					


MfG,
Peter

_________________
Zwei Worte werden Dir im Leben viele Türen öffnen - "ziehen" und "drücken".
mth
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 34



BeitragVerfasst: Mo 22.07.02 02:38 
Peter Lustig hat folgendes geschrieben:

ausblenden Quelltext
1:
ergebnis:=exp(ln(x)*n);					



Jaein, wenn x < 0 wäre der ln von x komplex. Dieser Fall und der x = 0 Fall werden von dieser Formel (bei beschränkung auf reele Zahlen) nicht erfasst.
b.brecht
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 81



BeitragVerfasst: Mo 22.07.02 11:34 
Nimm einfach die Power Funktion, die Klabautermann angesprochen hatte. Die ist eiegtnlich ganz nützlich!
Christian S.
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 20451
Erhaltene Danke: 2264

Win 10
C# (VS 2019)
BeitragVerfasst: Mo 22.07.02 14:12 
Hi!

Sowohl mth und b.brecht haben recht. Ich hatte die Antwort von Klabautermann erst gesehen, nachdem ich meine abgeschickt hatte.

Aber ist der ln(x) für x<=0 komplex? Soweit ich weiß, ist er dort einfach nur nicht definiert. Ist aber auch nicht wirklich wichtig!

MfG,
Peter

_________________
Zwei Worte werden Dir im Leben viele Türen öffnen - "ziehen" und "drücken".
mth
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 34



BeitragVerfasst: Mo 22.07.02 14:57 
Peter Lustig hat folgendes geschrieben:

Aber ist der ln(x) für x<=0 komplex? Soweit ich weiß, ist er dort einfach nur nicht definiert. Ist aber auch nicht wirklich wichtig!


Nö. Nur für x < 0.

Der Ln kann in der komplexen weitergeführt werden mit:

ln z := ln |z| + arg(z) I

dann ist z. B. für -2 ^ 3 = e^(ln(-2) *3 )

ln(-2) = ln(2) + pi I
ln(-2) * 3 = 3 * ln(2) + 3*pi I

und somit

e^(3 * ln(2) + 3*pi I) = -8

(Achtung: Aus Zeitgründen _viele_ zwischenschritte ausgelassen, sollte zum Nachvollziehen aber (hoffentlich) reichen.)
b.brecht
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 81



BeitragVerfasst: Mo 22.07.02 16:12 
Angenommen wir haben eine Exponentialgleichung, z.B:

5 hoch x = 25

dann wäre die Löung = ln(25) / ln(5) also 2.

Da x hoch y immer eine positive Zahl als Ergebnis hat, kann man keine Logarithmen aus Zahln = oder <0 errechnen !!!

Die Gleichung

5 hoch x = -25 lässt sich höchstens mit hilfe der Komplexen Zahlen lösen (Siehe Gaus).

Also nimm einfach die Powerfuntion ;-)
Christian S.
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 20451
Erhaltene Danke: 2264

Win 10
C# (VS 2019)
BeitragVerfasst: Mo 22.07.02 16:23 
Hi!


@mth:

Bis auf eines ist alles klar: wie ist arg(z) definiert? Für z>0 arg(z):=0, für z<0 arg(z):=pi?

MfG,
Peter

_________________
Zwei Worte werden Dir im Leben viele Türen öffnen - "ziehen" und "drücken".
mth
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 34



BeitragVerfasst: Mo 22.07.02 17:23 
Peter Lustig hat folgendes geschrieben:

Bis auf eines ist alles klar: wie ist arg(z) definiert?


Mit arg meinte ich das _Arg_ument, bzw. den Winkel/das Phi der Polardarstellung.

Peter Lustig hat folgendes geschrieben:

Für z>0 arg(z):=0, für z<0 arg(z):=pi?


Könnte man so sagen, natürlich nur solange z keinen Imaginäranteil hat.
Christian S.
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 20451
Erhaltene Danke: 2264

Win 10
C# (VS 2019)
BeitragVerfasst: Mo 22.07.02 17:31 
mth hat folgendes geschrieben:
Mit arg meinte ich das _Arg_ument, bzw. den Winkel/das Phi der Polardarstellung.


Jetzt ist der Groschen (die ca. 5Cent) gefallen! Danke!

MfG,
Peter

_________________
Zwei Worte werden Dir im Leben viele Türen öffnen - "ziehen" und "drücken".