Program to calculate Surface Area of Ellipsoid

17 Aug, 2021
Given the length of the three semi-axes as A, B, and C, the task is to find the surface area of the given Ellipsoid.
Ellipsoid is a closed surface of which all plane cross-sections are either ellipses or circles. An ellipsoid is symmetrical about the three mutually perpendicular axes that intersect at the center. It is a three-dimensional, closed geometric shape, all planar sections of which are ellipses or circles.
An ellipsoid has three independent axes, and is usually specified by the lengths a, b, c of the three semi-axes. If an ellipsoid is made by rotating an ellipse about one of its axes, then two axes of the ellipsoid are the same, and it is called an ellipsoid of revolution, or spheroid. If the lengths of all three of its axes are the same, it is a sphere.
Examples:
Input: A = 1, B = 1, C = 1Output: 12.57
Input: A = 11, B = 12, C = 13Output: 1807.89
Approach: The given problem can be solved by using the formula for Surface Area of the Ellipsoid as:
Below is the implementation of the above approach:
C++
Java
Python3
C#
Javascript
// C++ program for the above approach #include <iomanip>#include <iostream>#include <math.h>using namespace std; // Function to find the surface area of// the given Ellipsoidvoid findArea(double a, double b, double c){     // Formula to find surface area    // of an Ellipsoid    double area = 4 * 3.141592653                  * pow((pow(a * b, 1.6) + pow(a * c, 1.6)                         + pow(b * c, 1.6))                            / 3,                        1 / 1.6);     // Print the area    cout << fixed << setprecision(2)         << area;} // Driver Codeint main(){    double A = 11, B = 12, C = 13;    findArea(A, B, C);     return 0;}
// Java program of the above approachimport java.util.*; class GFG{ // Function to find the surface area of// the given Ellipsoidstatic void findArea(double a, double b, double c){         // Formula to find surface area    // of an Ellipsoid    double area = 4 * 3.141592653 * Math.pow((Math.pow(a * b, 1.6) +                       Math.pow(a * c, 1.6) + Math.pow(b * c, 1.6)) /                             3, 1 / 1.6);     // Print the area    System.out.print(String.format("%.2f", area));} // Driver Codepublic static void main(String[] args){    double A = 11, B = 12, C = 13;         findArea(A, B, C);}} // This code is contributed by code_hunt
# Python3 program for the above approachfrom math import pow # Function to find the surface area of# the given Ellipsoiddef findArea(a, b, c):         # Formula to find surface area    # of an Ellipsoid    area = (4 * 3.141592653 * pow((pow(a * b, 1.6) +            pow(a * c, 1.6) + pow(b * c, 1.6)) / 3, 1 / 1.6))     # Print the area    print("{:.2f}".format(round(area, 2))) # Driver Codeif __name__ == '__main__':         A = 11    B = 12    C = 13         findArea(A, B, C)     # This code is contributed by SURENDRA_GANGWAR
// C# program of the above approachusing System; class GFG{ // Function to find the surface area of// the given Ellipsoidstatic void findArea(double a, double b, double c){         // Formula to find surface area    // of an Ellipsoid    double area = 4 * 3.141592653 * Math.Pow((Math.Pow(a * b, 1.6) +                       Math.Pow(a * c, 1.6) + Math.Pow(b * c, 1.6)) /                             3, 1 / 1.6);     // Print the area    Console.Write(Math.Round(area, 2));} // Driver Codepublic static void Main(String[] args){    double A = 11, B = 12, C = 13;         findArea(A, B, C);}} // This code is contributed by shivanisinghss2110
<script>        // JavaScript Program to implement        // the above approach         // Function to find the surface area of        // the given Ellipsoid        function findArea(a, b, c) {             // Formula to find surface area            // of an Ellipsoid            let area = 4 * 3.141592653                * Math.pow((Math.pow(a * b, 1.6) + Math.pow(a * c, 1.6)                    + Math.pow(b * c, 1.6))                    / 3,                    1 / 1.6);             // Print the area            document.write(area.toPrecision(6));        }         // Driver Code        let A = 11, B = 12, C = 13;        findArea(A, B, C); // This code is contributed by Potta Lokesh    </script>
1807.89
 
Time Complexity: O(1)Auxiliary Space: O(1)
SURENDRA_GANGWAR
lokeshpotta20
code_hunt
shivanisinghss2110
area-volume-programs
Mensuration 3D
Geometric
Mathematical
Mathematical
Geometric
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Maximum Manhattan distance between a distinct pair from N coordinates
Total area of two overlapping rectangles
Largest area possible after removal of a series of horizontal & vertical bars
Program to find line passing through 2 Points
Orientation of 3 ordered points
Program for Fibonacci numbers
Set in C++ Standard Template Library (STL)
Write a program to print all permutations of a given string
C++ Data Types
Merge two sorted arrays