-
Notifications
You must be signed in to change notification settings - Fork 20k
[FEATURE REQUEST] Adding geometric mean in math #4338
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Hi @lukasb1b ,
|
Yeah your right @punit324 |
@lukasb1b |
For the code you have to apply the formula in a right manner the appering
code showing the syntax error.
Check out the formula of arithmetic mean.
…On Tue, 29 Aug, 2023, 9:48 pm Lukas, ***@***.***> wrote:
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);
}
}
—
Reply to this email directly, view it on GitHub
<#4338>, or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AQRKDWC5W3XHQ7C2FU5OQHDXXYI6RANCNFSM6AAAAAA4DGQFYA>
.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>
|
public static void main(String[] args) {
int[] test = {3,4};
System.out.println(geometric_mean(test));
}
public static double geometric_mean(int[] num0) {
int result=0;
for(int i*num0){
result+=i*i;
}
return Math.pow(result,1.1/ num0.length);
}
}
The code is ready to move.
…On Tue, 29 Aug, 2023, 9:48 pm Lukas, ***@***.***> wrote:
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);
}
}
—
Reply to this email directly, view it on GitHub
<#4338>, or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AQRKDWC5W3XHQ7C2FU5OQHDXXYI6RANCNFSM6AAAAAA4DGQFYA>
.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>
|
We already discussed this issue and its fixed and the right algorithm is merged |
@raisahab9125 I've used formulas from wiki. |
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));
}
}
The text was updated successfully, but these errors were encountered: