Re: Tips for writing correct, non trivial Mathematica Libraries

*To*: mathgroup at smc.vnet.net*Subject*: [mg124452] Re: Tips for writing correct, non trivial Mathematica Libraries*From*: Nehal Patel <nehal.alum at gmail.com>*Date*: Fri, 20 Jan 2012 01:50:20 -0500 (EST)*Delivered-to*: l-mathgroup@mail-archive0.wolfram.com*References*: <201201191012.FAA03722@smc.vnet.net> <3609A129-8BFE-453D-B414-9C1D4366BA43@mimuw.edu.pl> <A0087CCC-AB33-4507-A793-9806842F1832@gmail.com> <02BFEBF3-35C4-4C4E-83B7-E0A4EDBF6512@mimuw.edu.pl>

>> of x + y to be Sqrt[x y], it should be (x + y)^1 = x+ y > > No, it shouldn't be. There is no such thing as a mean of a number or an algebraic expression. What you would expect is But something like Times[2] should be ok? It think it's a reasonable matter of convention whether someone feels like a definition for geometric mean should expect a single vector argument, or as multiple arguments e.g. geom[x,y,z,=85] but I'll admit we're quibbling at this point and move on. > > Clear[geom] > > geom::nonlist = > "The argument `1` is neither a non-empty vector nor a non-empty matrix"; > > geom[ls_] /;If[Head[ls] === List, True, Message[geom::nonlist, x]; False] := > Apply[Times, ls]^(1/Length[ls]) Awesome -- this is what I was curious about! Thanks for taking the time.

**References**:**Re: Tips for writing correct, non trivial Mathematica Libraries***From:*Bill Rowe <readnews@sbcglobal.net>