|
|
Re: 0^0=1
Posted:
May 2, 2012 1:25 PM
|
|
In article <8066958b-610e-49e6-9aa6-fa3b57076920@w5g2000vbp.googlegroups.com>, Dan Christensen <Dan_Christensen@sympatico.ca> writes: >On May 2, 12:43=A0pm, Frederick Williams <freddywilli...@btinternet.com> wrote: >> Dan Christensen wrote:
>> > [...] (In my program, I do not include 0 in >> > N.) >> >> Do you program in any language that allows functions to operate on >> lists? > >There must be some, but I don't know of any language with a built-in >prod function as you describe it.
Try LISP. If I recall the syntax correctly, x = x1 * x2 * x3 would be:
(set x (prod x1 x2 x3))
(Or would it be setq?)
>prod function as you describe it. I can, however, write a function in >Visual Basic (my preferred language) to multiply all the numbers in an >array and return the result. Of course, I would have to decide what to >do in the case of less than 2 numbers in the array. Would I indicate a >error condition, or just return a zero or some other number? It would >be really quite arbitrary.
Returning zero would certainly be an arbitrary and less-than-sensible approach. Would you return one if somebody asked you to calculate the sum of an empty array? If not, then why return zero for the product of an empty array?
If C is a vector, and {A, B} is a partition on that vector, it would seem the simplest to say Prod( C ) = Prod( A ) * Prod( B ) without exception.
-- Michael F. Stemper #include <Standard_Disclaimer> This message contains at least 95% recycled bytes.
|
|