Post Reply 
product ? *** and sum ? ***
07-29-2014, 05:22 AM (This post was last modified: 07-31-2014 02:00 AM by Helge Gabert.)
Post: #1
product ? *** and sum ? ***
I just ran into this - -

in Home: product(N,N,1,3,.5) runs fine

But product(N,N,.5,3,.5) does not run and returns the arguments as multiplicands.

in CAS: product(n,n,1,3,1/2) runs fine

But again, product(n,n,1/2,3,1/2) returns 3/4*n^2.

It appears that the minimum value is not to be less than one, which is strange.
Find all posts by this user
Quote this message in a reply
07-29-2014, 11:19 AM
Post: #2
RE: product ?
According to the manual the arguments (a, b, and p) should be integers:
Code:
product(Expr||Lst,[Var||Lst],[Intg(a)],[Intg(b)],[Intg(p)])

It turns out that the step size (p) could be non-integral, but a and b must be integers. Otherwise you'll get those "list products" (e.g. multiplication of all 5 arguments).
Find all posts by this user
Quote this message in a reply
07-29-2014, 03:35 PM
Post: #3
RE: product ?
Apparently so. Maybe this requirement can be relaxed in the future, so that the product command becomes more useful.
Find all posts by this user
Quote this message in a reply
07-29-2014, 04:58 PM
Post: #4
RE: product ?
Of course one could rewrite product(N,N,0.5,3,0.5) as product(N/2,N,1,6,1) and would get the correct answer (45/4).
Find all posts by this user
Quote this message in a reply
07-29-2014, 07:09 PM
Post: #5
RE: product ?
Yes, that would be an easy one to transform.

Others won't be, however.
Find all posts by this user
Quote this message in a reply
07-30-2014, 03:43 PM
Post: #6
RE: product ?
If arg3 and arg4 are not integers, product behaves like if you input a list of values, it makes the product of the elements of the list. I'm going to modify product:
- if the argument is a list (with [] or {} delimiters) or does not have 5 args, no change
- if the argument is a sequence with 5 arguments, do what you want
Find all posts by this user
Quote this message in a reply
07-31-2014, 12:39 AM (This post was last modified: 07-31-2014 01:58 AM by Helge Gabert.)
Post: #7
RE: product ? and sum ?
Thank you. That would be great, and maybe we'll see that in the Prime, too!

[Edit: Actually, sum behaves similarly. Would it be possible to modify product and sum in the same way?]
Find all posts by this user
Quote this message in a reply
07-31-2014, 07:42 AM
Post: #8
RE: product ? *** and sum ? ***
There is nothing to do for that, since it's in the common code product and sum share.
Find all posts by this user
Quote this message in a reply
07-31-2014, 03:24 PM
Post: #9
RE: product ? *** and sum ? ***
OK, thanks for replying!
Find all posts by this user
Quote this message in a reply
Post Reply 




User(s) browsing this thread: 2 Guest(s)