Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.mathematica > #8029 > unrolled thread

Re: Tips for writing correct, non trivial Mathematica Libraries

Started byNehal Patel <nehal.alum@gmail.com>
First post2012-01-20 06:52 +0000
Last post2012-01-20 06:52 +0000
Articles 1 — 1 participant

Back to article view | Back to comp.soft-sys.math.mathematica

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: Tips for writing correct, non trivial Mathematica Libraries Nehal Patel <nehal.alum@gmail.com> - 2012-01-20 06:52 +0000

#8029 — Re: Tips for writing correct, non trivial Mathematica Libraries

FromNehal Patel <nehal.alum@gmail.com>
Date2012-01-20 06:52 +0000
SubjectRe: Tips for writing correct, non trivial Mathematica Libraries
Message-ID<jfb2vg$hno$1@smc.vnet.net>
>> 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.

[toc] | [standalone]


Back to top | Article view | comp.soft-sys.math.mathematica


csiph-web