GeometricMean definitionUsing a PatternTest versus a Condition for pattern matchingMoving the location of the...
Did 5.25" floppies undergo a change in magnetic coating?
Replacement ford fiesta radiator has extra hose
chrony vs. systemd-timesyncd – What are the differences and use cases as NTP clients?
What's the difference between a cart and a wagon?
You'll find me clean when something is full
Is there a low-level alternative to Animate Objects?
Make me a metasequence
It took me a lot of time to make this, pls like. (YouTube Comments #1)
What is the difference between ashamed and shamed?
Exponential growth/decay formula: what happened to the other constant of integration?
How to count occurrences of Friday 13th
What is this waxed root vegetable?
How do ISS astronauts "get their stripes"?
Logistics of a hovering watercraft in a fantasy setting
Contradiction with Banach Fixed Point Theorem
What is the difference between throw e and throw new Exception(e)?
What is the wife of a henpecked husband called?
Can you 'upgrade' leather armor to studded leather armor without purchasing the new armor directly?
Non-Italian European mafias in USA?
Why does the author believe that the central mass that gas cloud HCN-0.009-0.044 orbits is smaller than our solar system?
Second-rate spelling
Is divide-by-zero a security vulnerability?
Book where the good guy lives backwards through time and the bad guy lives forward
Multiplication via squaring and addition
GeometricMean definition
Using a PatternTest versus a Condition for pattern matchingMoving the location of the branch cut in MathematicaUse elements of Array inside function definitionExtract information from function definition returned by DefineDLLFunctionStrange behaviour of MMA in derivatives of some standard functionsRecursive definition of nested sumsWhy is the evaluation of f different using rules and using arguments to it as a function?Domain definition of a functionRecursion definition wont workImmediate Function Definition inside a Module
$begingroup$
According to the documentation for
GeometricMean
GeometricMean[Table[x[i],{i,1,n}]]==Product[x[i],{i,1,n}]^(1/n)
Presumably this is correct for x[i]
positive real.
However, GeometricMean
returns answers for some negative and complex inputs that are not consistent with this definition.
For example
GeometricMean[{-4, -4}]
(* -4 *)
(Perhaps it simply recognises a constant list as a special case, and shortcuts the definition to give an incorrect answer?)
functions
$endgroup$
add a comment |
$begingroup$
According to the documentation for
GeometricMean
GeometricMean[Table[x[i],{i,1,n}]]==Product[x[i],{i,1,n}]^(1/n)
Presumably this is correct for x[i]
positive real.
However, GeometricMean
returns answers for some negative and complex inputs that are not consistent with this definition.
For example
GeometricMean[{-4, -4}]
(* -4 *)
(Perhaps it simply recognises a constant list as a special case, and shortcuts the definition to give an incorrect answer?)
functions
$endgroup$
$begingroup$
Exp[Mean[Log[{-4, -4}]]]
yields-4
. The definition stated in the documentation doesn't seem to be the one used for numeric input.
$endgroup$
– Coolwater
5 hours ago
$begingroup$
@Coolwater, but note thatFullSimplify[Exp[Mean[Log[#]]] == GeometricMean[#]] &@{-4, -5}
returnsFalse
, so I don't think your explanation generalises.
$endgroup$
– mikado
5 hours ago
1
$begingroup$
"The geometric mean applies only to positive numbers." (Wiki
(Times @@ #)^(1/Length@#) == Exp@Mean@Log@# &@ RandomReal[10, 100]
evaluates toTrue
$endgroup$
– Bob Hanlon
5 hours ago
$begingroup$
GeometricMean[{-4, -4.}]
yields positive4.
, andGeometricMean[{-4, Unevaluated[-2^2]}]
yields positive4
. Apparently a shortcut is taken when input is a list of identical elements, namelyGeometricMean[{a, a,...}]
is assumed to bea
. (AndGeometricMean[{-4, -4, -4, -4, -4.}]
illustrates one of @Somos's points.)
$endgroup$
– Michael E2
1 hour ago
add a comment |
$begingroup$
According to the documentation for
GeometricMean
GeometricMean[Table[x[i],{i,1,n}]]==Product[x[i],{i,1,n}]^(1/n)
Presumably this is correct for x[i]
positive real.
However, GeometricMean
returns answers for some negative and complex inputs that are not consistent with this definition.
For example
GeometricMean[{-4, -4}]
(* -4 *)
(Perhaps it simply recognises a constant list as a special case, and shortcuts the definition to give an incorrect answer?)
functions
$endgroup$
According to the documentation for
GeometricMean
GeometricMean[Table[x[i],{i,1,n}]]==Product[x[i],{i,1,n}]^(1/n)
Presumably this is correct for x[i]
positive real.
However, GeometricMean
returns answers for some negative and complex inputs that are not consistent with this definition.
For example
GeometricMean[{-4, -4}]
(* -4 *)
(Perhaps it simply recognises a constant list as a special case, and shortcuts the definition to give an incorrect answer?)
functions
functions
edited 5 hours ago
mikado
asked 5 hours ago
mikadomikado
6,6021929
6,6021929
$begingroup$
Exp[Mean[Log[{-4, -4}]]]
yields-4
. The definition stated in the documentation doesn't seem to be the one used for numeric input.
$endgroup$
– Coolwater
5 hours ago
$begingroup$
@Coolwater, but note thatFullSimplify[Exp[Mean[Log[#]]] == GeometricMean[#]] &@{-4, -5}
returnsFalse
, so I don't think your explanation generalises.
$endgroup$
– mikado
5 hours ago
1
$begingroup$
"The geometric mean applies only to positive numbers." (Wiki
(Times @@ #)^(1/Length@#) == Exp@Mean@Log@# &@ RandomReal[10, 100]
evaluates toTrue
$endgroup$
– Bob Hanlon
5 hours ago
$begingroup$
GeometricMean[{-4, -4.}]
yields positive4.
, andGeometricMean[{-4, Unevaluated[-2^2]}]
yields positive4
. Apparently a shortcut is taken when input is a list of identical elements, namelyGeometricMean[{a, a,...}]
is assumed to bea
. (AndGeometricMean[{-4, -4, -4, -4, -4.}]
illustrates one of @Somos's points.)
$endgroup$
– Michael E2
1 hour ago
add a comment |
$begingroup$
Exp[Mean[Log[{-4, -4}]]]
yields-4
. The definition stated in the documentation doesn't seem to be the one used for numeric input.
$endgroup$
– Coolwater
5 hours ago
$begingroup$
@Coolwater, but note thatFullSimplify[Exp[Mean[Log[#]]] == GeometricMean[#]] &@{-4, -5}
returnsFalse
, so I don't think your explanation generalises.
$endgroup$
– mikado
5 hours ago
1
$begingroup$
"The geometric mean applies only to positive numbers." (Wiki
(Times @@ #)^(1/Length@#) == Exp@Mean@Log@# &@ RandomReal[10, 100]
evaluates toTrue
$endgroup$
– Bob Hanlon
5 hours ago
$begingroup$
GeometricMean[{-4, -4.}]
yields positive4.
, andGeometricMean[{-4, Unevaluated[-2^2]}]
yields positive4
. Apparently a shortcut is taken when input is a list of identical elements, namelyGeometricMean[{a, a,...}]
is assumed to bea
. (AndGeometricMean[{-4, -4, -4, -4, -4.}]
illustrates one of @Somos's points.)
$endgroup$
– Michael E2
1 hour ago
$begingroup$
Exp[Mean[Log[{-4, -4}]]]
yields -4
. The definition stated in the documentation doesn't seem to be the one used for numeric input.$endgroup$
– Coolwater
5 hours ago
$begingroup$
Exp[Mean[Log[{-4, -4}]]]
yields -4
. The definition stated in the documentation doesn't seem to be the one used for numeric input.$endgroup$
– Coolwater
5 hours ago
$begingroup$
@Coolwater, but note that
FullSimplify[Exp[Mean[Log[#]]] == GeometricMean[#]] &@{-4, -5}
returns False
, so I don't think your explanation generalises.$endgroup$
– mikado
5 hours ago
$begingroup$
@Coolwater, but note that
FullSimplify[Exp[Mean[Log[#]]] == GeometricMean[#]] &@{-4, -5}
returns False
, so I don't think your explanation generalises.$endgroup$
– mikado
5 hours ago
1
1
$begingroup$
"The geometric mean applies only to positive numbers." (
Wiki
(Times @@ #)^(1/Length@#) == Exp@Mean@Log@# &@ RandomReal[10, 100]
evaluates to True
$endgroup$
– Bob Hanlon
5 hours ago
$begingroup$
"The geometric mean applies only to positive numbers." (
Wiki
(Times @@ #)^(1/Length@#) == Exp@Mean@Log@# &@ RandomReal[10, 100]
evaluates to True
$endgroup$
– Bob Hanlon
5 hours ago
$begingroup$
GeometricMean[{-4, -4.}]
yields positive 4.
, and GeometricMean[{-4, Unevaluated[-2^2]}]
yields positive 4
. Apparently a shortcut is taken when input is a list of identical elements, namely GeometricMean[{a, a,...}]
is assumed to be a
. (And GeometricMean[{-4, -4, -4, -4, -4.}]
illustrates one of @Somos's points.)$endgroup$
– Michael E2
1 hour ago
$begingroup$
GeometricMean[{-4, -4.}]
yields positive 4.
, and GeometricMean[{-4, Unevaluated[-2^2]}]
yields positive 4
. Apparently a shortcut is taken when input is a list of identical elements, namely GeometricMean[{a, a,...}]
is assumed to be a
. (And GeometricMean[{-4, -4, -4, -4, -4.}]
illustrates one of @Somos's points.)$endgroup$
– Michael E2
1 hour ago
add a comment |
1 Answer
1
active
oldest
votes
$begingroup$
Similar to many other means, the geometric mean is homogenous. This means that
GeometricMean[ c data ] == c GeometricMean[ data ]
should be true for any number c. However, the problem is that $n$th roots are multi-valued in general and this causes no end of confusion. This is usually no problem for positive reals, but for negative reals it can be confusing. Do you want odd roots of negative reals be negative? Sometimes yes and sometimes no. For example, in version 10.2 the result of your example is $4$. Thus, the behavior has changed somewhat over time and there is no way to satisfy all expectations. The documentation for GeometricMean[]
should be more clear in this regard.
$endgroup$
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
return StackExchange.using("mathjaxEditing", function () {
StackExchange.MarkdownEditor.creationCallbacks.add(function (editor, postfix) {
StackExchange.mathjaxEditing.prepareWmdForMathJax(editor, postfix, [["$", "$"], ["\\(","\\)"]]);
});
});
}, "mathjax-editing");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "387"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmathematica.stackexchange.com%2fquestions%2f192613%2fgeometricmean-definition%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
$begingroup$
Similar to many other means, the geometric mean is homogenous. This means that
GeometricMean[ c data ] == c GeometricMean[ data ]
should be true for any number c. However, the problem is that $n$th roots are multi-valued in general and this causes no end of confusion. This is usually no problem for positive reals, but for negative reals it can be confusing. Do you want odd roots of negative reals be negative? Sometimes yes and sometimes no. For example, in version 10.2 the result of your example is $4$. Thus, the behavior has changed somewhat over time and there is no way to satisfy all expectations. The documentation for GeometricMean[]
should be more clear in this regard.
$endgroup$
add a comment |
$begingroup$
Similar to many other means, the geometric mean is homogenous. This means that
GeometricMean[ c data ] == c GeometricMean[ data ]
should be true for any number c. However, the problem is that $n$th roots are multi-valued in general and this causes no end of confusion. This is usually no problem for positive reals, but for negative reals it can be confusing. Do you want odd roots of negative reals be negative? Sometimes yes and sometimes no. For example, in version 10.2 the result of your example is $4$. Thus, the behavior has changed somewhat over time and there is no way to satisfy all expectations. The documentation for GeometricMean[]
should be more clear in this regard.
$endgroup$
add a comment |
$begingroup$
Similar to many other means, the geometric mean is homogenous. This means that
GeometricMean[ c data ] == c GeometricMean[ data ]
should be true for any number c. However, the problem is that $n$th roots are multi-valued in general and this causes no end of confusion. This is usually no problem for positive reals, but for negative reals it can be confusing. Do you want odd roots of negative reals be negative? Sometimes yes and sometimes no. For example, in version 10.2 the result of your example is $4$. Thus, the behavior has changed somewhat over time and there is no way to satisfy all expectations. The documentation for GeometricMean[]
should be more clear in this regard.
$endgroup$
Similar to many other means, the geometric mean is homogenous. This means that
GeometricMean[ c data ] == c GeometricMean[ data ]
should be true for any number c. However, the problem is that $n$th roots are multi-valued in general and this causes no end of confusion. This is usually no problem for positive reals, but for negative reals it can be confusing. Do you want odd roots of negative reals be negative? Sometimes yes and sometimes no. For example, in version 10.2 the result of your example is $4$. Thus, the behavior has changed somewhat over time and there is no way to satisfy all expectations. The documentation for GeometricMean[]
should be more clear in this regard.
edited 3 hours ago
answered 5 hours ago
SomosSomos
1,33519
1,33519
add a comment |
add a comment |
Thanks for contributing an answer to Mathematica Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
Use MathJax to format equations. MathJax reference.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmathematica.stackexchange.com%2fquestions%2f192613%2fgeometricmean-definition%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
$begingroup$
Exp[Mean[Log[{-4, -4}]]]
yields-4
. The definition stated in the documentation doesn't seem to be the one used for numeric input.$endgroup$
– Coolwater
5 hours ago
$begingroup$
@Coolwater, but note that
FullSimplify[Exp[Mean[Log[#]]] == GeometricMean[#]] &@{-4, -5}
returnsFalse
, so I don't think your explanation generalises.$endgroup$
– mikado
5 hours ago
1
$begingroup$
"The geometric mean applies only to positive numbers." (
Wiki
(Times @@ #)^(1/Length@#) == Exp@Mean@Log@# &@ RandomReal[10, 100]
evaluates toTrue
$endgroup$
– Bob Hanlon
5 hours ago
$begingroup$
GeometricMean[{-4, -4.}]
yields positive4.
, andGeometricMean[{-4, Unevaluated[-2^2]}]
yields positive4
. Apparently a shortcut is taken when input is a list of identical elements, namelyGeometricMean[{a, a,...}]
is assumed to bea
. (AndGeometricMean[{-4, -4, -4, -4, -4.}]
illustrates one of @Somos's points.)$endgroup$
– Michael E2
1 hour ago