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.
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).
Apparently so. Maybe this requirement can be relaxed in the future, so that the product command becomes more useful.
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).
Yes, that would be an easy one to transform.
Others won't be, however.
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
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?]
There is nothing to do for that, since it's in the common code product and sum share.