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
 Helge Gabert Senior Member Posts: 467 Joined: Dec 2013
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.
07-29-2014, 11:19 AM
Post: #2
 Thomas Ritschel Member Posts: 66 Joined: Feb 2014
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).
07-29-2014, 03:35 PM
Post: #3
 Helge Gabert Senior Member Posts: 467 Joined: Dec 2013
RE: product ?
Apparently so. Maybe this requirement can be relaxed in the future, so that the product command becomes more useful.
07-29-2014, 04:58 PM
Post: #4
 Thomas Ritschel Member Posts: 66 Joined: Feb 2014
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).
07-29-2014, 07:09 PM
Post: #5
 Helge Gabert Senior Member Posts: 467 Joined: Dec 2013
RE: product ?
Yes, that would be an easy one to transform.

Others won't be, however.
07-30-2014, 03:43 PM
Post: #6
 parisse Senior Member Posts: 1,206 Joined: Dec 2013
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
07-31-2014, 12:39 AM (This post was last modified: 07-31-2014 01:58 AM by Helge Gabert.)
Post: #7
 Helge Gabert Senior Member Posts: 467 Joined: Dec 2013
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?]
07-31-2014, 07:42 AM
Post: #8
 parisse Senior Member Posts: 1,206 Joined: Dec 2013
RE: product ? *** and sum ? ***
There is nothing to do for that, since it's in the common code product and sum share.
07-31-2014, 03:24 PM
Post: #9
 Helge Gabert Senior Member Posts: 467 Joined: Dec 2013
RE: product ? *** and sum ? ***