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


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

Re: Tips for writing correct, non trivial Mathematica Libraries

From Nehal Patel <nehal.alum@gmail.com>
Newsgroups comp.soft-sys.math.mathematica
Subject Re: Tips for writing correct, non trivial Mathematica Libraries
Date 2012-01-20 06:52 +0000
Organization Steven M. Christensen and Associates, Inc and MathTensor, Inc.
Message-ID <jfb2vg$hno$1@smc.vnet.net> (permalink)
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>

Show all headers | View raw


>> 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.

Back to comp.soft-sys.math.mathematica | Previous | Next | Find similar | Unroll thread


Thread

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

csiph-web