Menu

#127 prod() in error

None
accepted
None
5
2020-10-13
2020-07-29
m-stgt
No

Running Reduce (Free CSL version, revision 5368), 24-Jun-20 ...

1: prod(n, n, 1, k);
results (LateX) \prod_{n=1}^k\,n
That is correct, also correct would be FACTORIAL(k) Alas, Reduce does not know about this (or I do not know which flags to set to make this work). So even
2: factorial(k)-ws;
is returned as entered. Only numericaly
3: let k=>5003; ws;
the result is 0. I do not regard this as error, a deficiency only. In contrast to following:
4: prod(1/(n-1), n, 1, k);
returns 1/prod(n - 1,n,1,k)
5: prod(m/(n-1), n, 1, k);
returns m^k/prod(n - 1,n,1,k) -- but
6: prod(n/(n-1), n, 1, k);
returns ***** Zero divisor -- why not already the two before?
7: prod(2*n/(2*n-1), n, 1, k);
returns (2**k*prod(n/(2*n - 1),n,1,k))/prod(2*n - 1,n,1,k) -- I doubt.
Next try
8: prod(n/(n-1)^2, n, 1, k);
resultsprod(n,n,1,k)/prod(n - 1,n,1,k)**2, but
9: prod(n/(n-1), n, 1, k);
returns ***** Zero divisor -- why not #8 too?
Like some more?
10: prod(n/(n^2-1), n, 1, k);
returns prod(n,n,1,k)/(prod(n - 1,n,1,k)*prod(n + 1,n,1,k)) -- smells funny,
11: prod(m*n/(n^2-1), n, 1, k);
returns (m**k*prod(n,n,1,k))/(prod(n - 1,n,1,k)**2*prod(n + 1,n,1,k)**2) -- but
12: prod(n^2/(n^2-1), n, 1, k);
returns ***** Zero divisor -- now, so suddenly.

Obviously prod() is in trouble.

Related

Bugs: #127

Discussion

  • Rainer Schöpf

    Rainer Schöpf - 2020-10-11
    • status: open --> accepted
    • assigned_to: Rainer Schöpf
    • Group: -->
     
  • Rainer Schöpf

    Rainer Schöpf - 2020-10-11

    I corrected the programming error that caused the extra, incorrect factors in the denominator, and added a rule for the factorial case.

    The failure to signal the "Zero divisor" is trickier.
    First of all a closed form solution for the product is attempted algorithmically.
    If this succeeds, the result can be obtained by substituting the limits and division.
    At that point the "Zero divisor" error may occur.
    If no closed form solution can be found the code falls back to a couple of heuristics, where the zero denominator is not recognized.
    I could add a couple of rules for special cases, of course.

    Rainer

     
    • m-stgt

      m-stgt - 2020-10-12

      Well, I am not a mathematician, I have no idea what goes on behind the curtains of Reduce, so I may only ask lowbrow questions from a hobbyist's point of view. What would be best help for someone using Reduce only now and then, or a student trying to grasp something. For me Reduce is prime quality for its way to handle sums (where other CAS fail), maybe a similar lead with products is advantageous too.

      At least one special case would be nice: prod(n, n, 1, k);
      Is it too much asked, not worth the effort to rewrite it as factorial(k)?

      Thank you.
      M.

       
  • Rainer Schöpf

    Rainer Schöpf - 2020-10-13

    I added a rule for the factorial case.

    The problem is that the identity holds only for k being a nonnegative integer. Imagine the cases k=-2 or k=3/2.

    Nevertheless I believe that it is a useful rule.

    Rainer

     
    • m-stgt

      m-stgt - 2020-10-13

      Hallo Herr Schöpf,

      vielen Dank dafür, zukünftige Anwender wird es ebenso freuen.

      Gruss
      MF

      Am 13.10.2020 um 15:09 schrieb "Rainer Schöpf":

      I added a rule for the factorial case.

      The problem is that the identity holds only for k being a nonnegative integer. Imagine the cases k=-2 or k=3/2.

      Nevertheless I believe that it is a useful rule.

      Rainer


      ** [bugs:#127] prod() in error**

      Status: accepted
      Group:
      Created: Wed Jul 29, 2020 11:06 PM UTC by m-stgt
      Last Updated: Mon Oct 12, 2020 10:50 PM UTC
      Owner: Rainer Schöpf

      Running Reduce (Free CSL version, revision 5368), 24-Jun-20 ...

      1: prod(n, n, 1, k);
      results (LateX) \prod_{n=1}^k\,n
      That is correct, also correct would be FACTORIAL(k) Alas, Reduce does not know about this (or I do not know which flags to set to make this work). So even
      2: factorial(k)-ws;
      is returned as entered. Only numericaly
      3: let k=>5003; ws;
      the result is 0. I do not regard this as error, a deficiency only. In contrast to following:
      4: prod(1/(n-1), n, 1, k);
      returns 1/prod(n - 1,n,1,k)
      5: prod(m/(n-1), n, 1, k);
      returns m^k/prod(n - 1,n,1,k) -- but
      6: prod(n/(n-1), n, 1, k);
      returns ***** Zero divisor -- why not already the two before?
      7: prod(2*n/(2*n-1), n, 1, k);
      returns (2**k*prod(n/(2*n - 1),n,1,k))/prod(2*n - 1,n,1,k) -- I doubt.
      Next try
      8: prod(n/(n-1)^2, n, 1, k);
      resultsprod(n,n,1,k)/prod(n - 1,n,1,k)**2, but
      9: prod(n/(n-1), n, 1, k);
      returns ***** Zero divisor -- why not #8 too?
      Like some more?
      10: prod(n/(n^2-1), n, 1, k);
      returns prod(n,n,1,k)/(prod(n - 1,n,1,k)*prod(n + 1,n,1,k)) -- smells funny,
      11: prod(m*n/(n^2-1), n, 1, k);
      returns (m**k*prod(n,n,1,k))/(prod(n - 1,n,1,k)**2*prod(n + 1,n,1,k)**2) -- but
      12: prod(n^2/(n^2-1), n, 1, k);
      returns ***** Zero divisor -- now, so suddenly.

      Obviously prod() is in trouble.


      Sent from sourceforge.net because you indicated interest in https://sourceforge.net/p/reduce-algebra/bugs/127/

      To unsubscribe from further messages, please visit https://sourceforge.net/auth/subscriptions/

       

      Related

      Bugs: #127


Log in to post a comment.

MongoDB Logo MongoDB