Skip to content

[FEATURE REQUEST] Adding geometric mean in math #4338

Closed
@lukasb1b

Description

@lukasb1b

What would you like to Propose?

I did not see a geometric mean function in maths.
I added a test feature in the attachment I obviuously would change it according to the rules of the repository if assigned to me.

Issue details

Missing geometric mean function in maths src/main/java/com/thealgorithms/maths

Additional Information

public class test {
public static void main(String[] args) {
int[] test = {3,4};
System.out.println(geometric_mean(test));
}

public static double geometric_mean(int[] num) {
    int result=0;
    for(int i:num){
        result+=i*i;
    }

    return Math.pow(result,1.0/ num.length);
}

}

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions