Java examples for java.lang:Math Function
Returns the approximate circumference of the ellipse defined by the specified minor and major axes.
// Copyright (C) 2002-2012 Three Rings Design, Inc., All Rights Reserved //package com.java2s; public class Main { /**/*from www . j a v a 2 s .c o m*/ * Returns the approximate circumference of the ellipse defined by the specified minor and * major axes. The formula used (due to Ramanujan, via a paper of his entitled "Modular * Equations and Approximations to Pi"), is <code>Pi(3a + 3b - sqrt[(a+3b)(b+3a)])</code>. */ public static double ellipseCircum(double a, double b) { return Math.PI * (3 * a + 3 * b - Math.sqrt((a + 3 * b) * (b + 3 * a))); } }