Function Repository Resource:

SequenceToProduct

Source Notebook

Turn a sequence of expressions into a symbolic product

Contributed by: Wolfram|Alpha Math Team

ResourceFunction["SequenceToProduct"][{e1,e2,},n]

attempts to return an inactive product representing e1×e2× where the user-supplied variable n is used in forming the generic term.

Details

If successful, ResourceFunction["SequenceToProduct"] returns an expression with head Inactive[Product]. Using Activate on this output will attempt to evaluate the product.
ResourceFunction["SequenceToProduct"] gives special treatment to the global symbol …, representing a sequence of ellided expressions. The ellipsis symbol … can be input with the keyboard shortcut .

Examples

Basic Examples (10) 

Convert a simple finite sequence to a product:

In[1]:=
ResourceFunction["SequenceToProduct"][{1, 2, 3, 4}, n]
Out[1]=

Convert an elided sequence to a product:

In[2]:=
ResourceFunction["SequenceToProduct"][{1, 2, 3, \[Ellipsis], 10}, n]
Out[2]=

Evaluate with Activate:

In[3]:=
% // Activate
Out[3]=

Convert an infinite sequence to a product:

In[4]:=
ResourceFunction["SequenceToProduct"][{1, 1/2, 1/3, \[Ellipsis]}, n]
Out[4]=

Convert an geometric sequence to a product:

In[5]:=
ResourceFunction["SequenceToProduct"][{1, 1/2, 1/4, \[Ellipsis]}, n]
Out[5]=

Convert another geometric sequence to a product and evaluate:

In[6]:=
ResourceFunction[
 "SequenceToProduct"][{1/3, 1/6, 1/12, \[Ellipsis]}, n]
Out[6]=
In[7]:=
% // Activate
Out[7]=

Convert an arithmetic sequence to a product:

In[8]:=
ResourceFunction["SequenceToProduct"][{5, 12, 19, 26, \[Ellipsis]}, n]
Out[8]=

Convert another arithmetic sequence to a product and evaluate:

In[9]:=
ResourceFunction["SequenceToProduct"][{5, 10, 15, \[Ellipsis], 50}, n]
Out[9]=
In[10]:=
% // Activate
Out[10]=

Convert an alternating sequence to a product and evaluate:

In[11]:=
ResourceFunction[
 "SequenceToProduct"][{1/2, -(1/4), 1/8, -(1/16), 1/32, \[Ellipsis], -(1/1024)}, n]
Out[11]=
In[12]:=
% // Activate
Out[12]=

Convert a rational sequence to a product:

In[13]:=
ResourceFunction[
 "SequenceToProduct"][{2, 5/2, 10/3, 17/4, 26/5, 37/6, 50/7, \[Ellipsis]}, n]
Out[13]=

Convert a hypergeometric sequence to a product:

In[14]:=
ResourceFunction["SequenceToProduct"][{1, 2, 6, 24, 120, 720, 5040},
  n]
Out[14]=
In[15]:=
ResourceFunction[
 "SequenceToProduct"][{1, 6, 54, 648, 9720, 174960, \[Ellipsis]}, n]
Out[15]=

Scope (1) 

The ellipsis symbol (…) can appear anywhere within the input sequence:

In[16]:=
ResourceFunction[
 "SequenceToProduct"][{\[Ellipsis], 1/2, 1/6, 1/18}, n]
Out[16]=
In[17]:=
ResourceFunction[
 "SequenceToProduct"][{\[Ellipsis], 1/3, 1/6, 1/9, \[Ellipsis]}, n]
Out[17]=

Properties and Relations (3) 

If successful, SequenceToProduct returns an expression with head Inactive[Product]:

In[18]:=
res = ResourceFunction[
  "SequenceToProduct"][{1, 1/2, 1/4, \[Ellipsis]}, n]
Out[18]=
In[19]:=
Head[res]
Out[19]=

If unable to infer the elided part of a sequence, SequenceToProduct will return unevaluated:

In[20]:=
ResourceFunction[
 "SequenceToProduct"][2, 3, 5, 7, 11, 13, 17, \[Ellipsis], 29]
Out[20]=

SequenceToProduct uses FindSequenceFunction to recognize patterns in the input sequence:

In[21]:=
seq1 = {1, 1, 2, 3, 5, 8, 13};
FindSequenceFunction[seq1, n]
Out[22]=
In[23]:=
ResourceFunction["SequenceToProduct"][seq1, n]
Out[23]=
In[24]:=
seq2 = {2, 3, 5, 7, 11};
FindSequenceFunction[seq2, n]
Out[25]=
In[26]:=
ResourceFunction["SequenceToProduct"][seq2, n]
Out[26]=

Publisher

Wolfram|Alpha Math Team

Version History

  • 3.0.0 – 23 March 2023
  • 2.1.0 – 20 May 2021
  • 2.0.0 – 24 January 2020
  • 1.0.0 – 16 October 2019

Related Resources

License Information