product ? *** and sum ? *** - Printable Version +- HP Forums (https://www.hpmuseum.org/forum) +-- Forum: HP Calculators (and very old HP Computers) (/forum-3.html) +--- Forum: HP Prime (/forum-5.html) +--- Thread: product ? *** and sum ? *** (/thread-1884.html) |
product ? *** and sum ? *** - Helge Gabert - 07-29-2014 05:22 AM 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. RE: product ? - Thomas Ritschel - 07-29-2014 11:19 AM 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). RE: product ? - Helge Gabert - 07-29-2014 03:35 PM Apparently so. Maybe this requirement can be relaxed in the future, so that the product command becomes more useful. RE: product ? - Thomas Ritschel - 07-29-2014 04:58 PM 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). RE: product ? - Helge Gabert - 07-29-2014 07:09 PM Yes, that would be an easy one to transform. Others won't be, however. RE: product ? - parisse - 07-30-2014 03:43 PM 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 RE: product ? and sum ? - Helge Gabert - 07-31-2014 12:39 AM 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?] RE: product ? *** and sum ? *** - parisse - 07-31-2014 07:42 AM There is nothing to do for that, since it's in the common code product and sum share. RE: product ? *** and sum ? *** - Helge Gabert - 07-31-2014 03:24 PM OK, thanks for replying! |