4
$\begingroup$

Why does this ratio of products not Simplify to a[n]?

Clear[a,k,n]
$Assumptions={n>1}
Simplify[ Product[a[k], {k, 1, n}] / Product[a[k], {k, 1, n - 1}] ]

Setting an actual value of $n$, it works fine, e.g. set n=5 and you get a[5]. If you define a function a[k] it seems to sometimes work fine. It doesn't work for

Product[1 - 1/Sqrt[k], {k, 2, n}] / Product[1 - 1/Sqrt[k], {k, 2, n - 1}]
$\endgroup$
2
$\begingroup$

General properties of products and sums do not seem to be implemented in Mathematica. You can implement them through Simplify using the option TransformationFunctions, provided the property results in a "simpler" expression.

For example:

productProperties = {HoldPattern[
      Product[a_, {k_, k1_, k2_}]/Product[a_, {k_, k3_, k4_}]] /; 
     BooleanQ[Simplify[k1 <= k3]] && BooleanQ[Simplify[k2 < k4]] :>
      If[Simplify[k1 <= k3], Product[a, {k, k1, k3 - 1}], 
      1/Product[a, {k, k3, k1 - 1}]]*
     If[Simplify[k2 < k4], 1/Product[a, {k, k2 + 1, k4}], 
      Product[a, {k, k4 + 1, k2}]]};

Simplify[Product[a[k], {k, 1, n}]/Product[a[k], {k, 1, n - 1}], 
 TransformationFunctions -> {Automatic, # /. productProperties &}]

(*  a[n]  *)

You can add properties to productProperties as desired.

If you like the approach in Does Mathematica apply the additivity property in Sum?, you can also extend the definition of Product by translating the property above into a function definition:

Unprotect[Product];
Product /: Product[a_, {k_, k1_, k2_}]/Product[a_, {k_, k3_, k4_}] /; 
   BooleanQ[Simplify[k1 <= k3]] && BooleanQ[Simplify[k2 < k4]] :=
  If[Simplify[k1 <= k3], Product[a, {k, k1, k3 - 1}], 
    1/Product[a, {k, k3, k1 - 1}]]*
   If[Simplify[k2 < k4], 1/Product[a, {k, k2 + 1, k4}], 
    Product[a, {k, k4 + 1, k2}]];
Protect[Product];

Now the transformation happens automatically, without needing to apply Simplify:

Product[a[k], {k, 1, n}]/Product[a[k], {k, 1, n - 1}]
(*  a[n]  *)
$\endgroup$
0
$\begingroup$

It works for me. The result is 1 - 1/Sqrt[5].

Are you defining n before asking for the second ratio? (e.g. n=5).

$\endgroup$
  • $\begingroup$ Hi, no, n is not defined in the second one. It does work for 1-1/k (n undefined). Wierd. $\endgroup$ – Paul R. Dec 13 '18 at 23:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.