Autor Beitrag
maxk
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 1696
Erhaltene Danke: 1

Win XP, Debian Lenny
Delphi 6 Personal
BeitragVerfasst: Mo 24.02.03 10:51 
Hi,

ich habe mal wieder eine Frage, der Tangens von 45° ist 1. Delphi ermittelt:
ausblenden Delphi-Quelltext
1:
2:
 Caption:=FloatToStr(tan(45));
 // Caption=1,6177....

Gibt es einen genaueren Weg :?:

Danke,
maxk

_________________
Ein Computer wird das tun, was Du programmierst - nicht das, was Du willst.
UGrohne
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Veteran
Beiträge: 5502
Erhaltene Danke: 220

Windows 8 , Server 2012
D7 Pro, VS.NET 2012 (C#)
BeitragVerfasst: Mo 24.02.03 10:55 
Tan erwartet so weit ich weiß, Angaben im Bogenmaß
Udontknow
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 2596

Win7
D2006 WIN32, .NET (C#)
BeitragVerfasst: Mo 24.02.03 11:02 
Hi.

Kleiner Tip: es gibt in dieser Unit auch die Funktion DegToRad, die einem die Winkel umrechnet.

Cu, :)
Udontknow
Raphael O.
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 1596


VS 2013
BeitragVerfasst: Mo 24.02.03 12:07 
was ist denn daran ungenau???

kannst Tan auch mit sin/cos ausrechnen...

sin und cos erwarten auf jeden Fall BogenmaßWinkel...
DaRkFiRe
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 526

WinXP Home & Professional
C, C++, Delphi
BeitragVerfasst: Mo 24.02.03 16:09 
Im Prinzip kann man auch direkt per (Winkel°)*Pi/180 - denn mehr macht die Funktion auch nicht.

Kurz zur mathematischen Seite:

180° entsprechen Pi
360° entsprechen 2*Pi [Vollkreis]

demnach entsprechen 90° Pi/2 (180°/2 = Pi/2) usw.

Winkel in Grad: g
Winkel im Bogenmaß: b

g/180 = b/Pi -> b: g*Pi/180

_________________
Lang ist der Weg durch Lehren - kurz und wirksam durch Beispiele! Seneca
maxk Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 1696
Erhaltene Danke: 1

Win XP, Debian Lenny
Delphi 6 Personal
BeitragVerfasst: Mo 24.02.03 18:02 
Zitat:
(Winkel°)*Pi/180


Also,
45° * Pi / 180 = 0,78539816339744830961566084581988

Aber Tan(45) ist 1 :!:

Im Übrigen rechnet auch sin(45)/cos(45) nicht 1 aus.

maxk

_________________
Ein Computer wird das tun, was Du programmierst - nicht das, was Du willst.
UGrohne
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Veteran
Beiträge: 5502
Erhaltene Danke: 220

Windows 8 , Server 2012
D7 Pro, VS.NET 2012 (C#)
BeitragVerfasst: Mo 24.02.03 18:20 
maxk hat folgendes geschrieben:
Zitat:
(Winkel°)*Pi/180


Also,
45° * Pi / 180 = 0,78539816339744830961566084581988

Aber Tan(45) ist 1 :!:

Im Übrigen rechnet auch sin(45)/cos(45) nicht 1 aus.

maxk


Mit der Formel (Winkel°)*Pi/180 rechnest Du den Winkel vom Gradmaß ins Bogenmaß um, das brauchst Du um damit dann den Tangens auszurechnen. Das Bogenmaß ist eine andere Schreibweise, um Winkel anzugeben, noch nicht in Mathe gehabt?

tan ist nicht gleich (Winkel°)*Pi/180, sonst wärs ja einfach.
Um also den Tangens von 45° auszurechnen, machste folgendes:
ausblenden Quelltext
1:
tan(Winkel*Pi/180)					

Und dann kriegste auch 1 raus, wenn winkel:=45

Gruß
Udontknow
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 2596

Win7
D2006 WIN32, .NET (C#)
BeitragVerfasst: Mo 24.02.03 18:24 
Da ist dir wohl ein Fehler unterlaufen.

Sowohl Sin(45) als auch Cos(45) ergeben 0,707106, Sin(45) durch Cos(45) ergibt tatsächlich 1, sofern die Funktionen Gradzahlen annehmen, ansonsten musst du immer umrechnen (z.B. Sin(45*Pi/180) ).

Ausserdem :

Zitat:
45*Pi/180=0,78539816339744830961566084581988


Soweit korrekt, aber du musst auch die Tan-Funktion auf diesen Wert anwenden, also:

Tan(45*Pi/180)=1 :wink:

Cu,
Udontknow


Zuletzt bearbeitet von Udontknow am Mo 24.02.03 18:26, insgesamt 1-mal bearbeitet
Udontknow
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 2596

Win7
D2006 WIN32, .NET (C#)
BeitragVerfasst: Mo 24.02.03 18:25 
UGrohne war schneller... :D

Cu,
Udontknow
UGrohne
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Veteran
Beiträge: 5502
Erhaltene Danke: 220

Windows 8 , Server 2012
D7 Pro, VS.NET 2012 (C#)
BeitragVerfasst: Mo 24.02.03 18:26 
Um genau 4 Minuten *hehe* Musste halt schneller tippen *g*
maxk Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 1696
Erhaltene Danke: 1

Win XP, Debian Lenny
Delphi 6 Personal
BeitragVerfasst: Mo 24.02.03 19:09 
:lol: Achso,
dann hab ich es jetzt endlich kapiert!

Thx,
maxk

_________________
Ein Computer wird das tun, was Du programmierst - nicht das, was Du willst.


Zuletzt bearbeitet von maxk am Di 25.02.03 16:31, insgesamt 1-mal bearbeitet
DaRkFiRe
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 526

WinXP Home & Professional
C, C++, Delphi
BeitragVerfasst: Mo 24.02.03 23:09 
Kapiert nur mit einem "p" *g*

_________________
Lang ist der Weg durch Lehren - kurz und wirksam durch Beispiele! Seneca
maxk Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 1696
Erhaltene Danke: 1

Win XP, Debian Lenny
Delphi 6 Personal
BeitragVerfasst: Di 25.02.03 16:32 
@DaRkFiRe: Auch wenn es wohl nicht ernst gemeint war: Ich habe es geändert!

_________________
Ein Computer wird das tun, was Du programmierst - nicht das, was Du willst.