Sonntag, 5. August 2012

Methoden in Math

Winkelfunktionen in Java - Math
double erg1 = Math.sin(12.434); // Math.sin(n) = Sinus
double erg2 = Math.cos(6.57); // Math.cos(n) = Cosinus
double erg3 = Math.tan(30.441); // Math.tan(n) = Tangens
double erg4 = Math.asin(51.124); // Math.asin(n) = arc-Sinus
double erg5 = Math.acos(7.992); // Math.acos(n) = arc-Cosinus
double erg6 = Math.atan(1.5453); // Math.atan(n) = arc-Tangens

Wurzelziehen und Potezieren in Java - Math
 ↔ vorhergehenden Post

Besondere Konstanten in Java - Math
(Deklarationen)
public static final double E = 2.718281828459045; // E: Eulersche zahl
public static final double PI = 3.141592653589793; // PI: Pi (Kreiszahl)

(Verwendung)
protected double x = (12.3 * Math.cbrt(133.1)) * Math.pow(Math.PI, (Math.E * 3.5 + Math.atan(Math.PI))); // Komplizierte Berechnung
System.out.println("Ergebnis: " + x); // Ausgabe


Math.cbrt() und Math.pow() siehe Abschnitt "Wurzelziehen und Potezieren in Java Math"
Math.atan() siehe Abschnitt "Winkelfunktionen in Java - Math"

Keine Kommentare:

Kommentar veröffentlichen