Questions tagged [products]

Questions about the use of `Product`, `NProduct`, and other types of multiplication, like `Dot`.

Filter by
Sorted by
Tagged with
1
vote
1answer
66 views

Series of a product of series

I am writing a code where I have to multiply large series truncated at some order, say 100. As a result I want again a series up to order 100, and I want to get it in the fastest way. I have tried a ...
10
votes
1answer
187 views

How to calculate $\displaystyle \prod_{p}\frac{p^2+1}{p^2-1}$?

When I input $$ \prod _{p=2}^{\infty } \text{If}\left[\text{PrimeQ}[p],\frac{p^2+1}{p^2-1},1\right] $$ in Mathematica 12.0, it gives out the value $1$. The result is ridiculous, for that according to ...
0
votes
1answer
50 views

Return last value of While function

I want to make a function that performs a multiplication with Inner i number of times using a ...
0
votes
1answer
32 views

Set default product

I want to set a default product in Mathematica in place of the standard product. Specifically, I want to change the standard product for CenterDot so that when I ...
1
vote
3answers
77 views

Summation and product term expressed in Mathematica [duplicate]

I have the following term which I would like to express correctly in Mathematica: $$\sum_{i=1}^{m}\frac{1}{\prod_{j=1,j\neq i}^m(\rho_i-\rho_j)}$$ This means that for $m=3$ for example you should ...
5
votes
2answers
122 views

How to write down a product with omitted terms?

I have the following term which I would like to express correctly in Mathematica: $$ \prod_{j=1,j\neq i}^m(\rho_i-\rho_j) $$ Can you please help?
2
votes
1answer
54 views

Outer (dyadic) product between vectors of the same index in two lists

I have two lists of vectors and I want to take the outer product between elements in the lists of the same index. Using either Outer or TensorProduct works for e.g. the first two indices: ...
1
vote
2answers
85 views

Where is the “mistake in the recursion” while there is no recursion? [closed]

So my code is as follows xi = Exp[2*Pi I/13] tauA = xi + xi^(-1) sigma[tau_, n_] := tau^n Product[(x - sigma[tauA, i]), {i, 3, 8}] // FullSimplify This should ...
0
votes
1answer
55 views

How to create a dot product version of the product function

I would like to create a function to matrix multiply (dot product) n matrices together, where n is large, for example M1*M2*M3*M4*M5*...*Mn I know there is the 'product' function that can do this ...
1
vote
1answer
36 views

How to PowerExpand a generic Product?

I have: PowerExpand[Log[Product[f[i], {i, 1, n}]]] // InputForm (* Output: Log[Product[f[i], {i, 1, n}]] *) However, I would expect to get the following as the ...
2
votes
4answers
186 views

Dot product result has wrong dimension [closed]

I'm doing a small project and I've encountered a problem while using Mathematica. I should mention that I'm kinda new to this software, so maybe it's just something I haven't grasped yet. Anyway, I ...
4
votes
2answers
150 views

Why does this simple ratio of products not simplify?

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}] ] ...
2
votes
2answers
140 views

Sums of products with $ n $ variables

I want to be able to compute a function of $ n $ indices which looks as follows if $ n>2 $: $$ \sum_{(i=1,j=1,k=1,l=1,...), (i\neq j\neq k \neq l \neq ...)}^{n} x_{i}x_{j}(x_{k}^2+y_{k}^2)(x_{l}^...
0
votes
0answers
21 views

Product works, but not when I add a condition : Product[ If[…] ]

I am trying to create a product loop where each term is taken from a list, i.e. (x[[2]]-x[[1]])*(x[[2]]-x[[3]])*(x[[2]]-x[[4]])... The following code gives what ...
1
vote
2answers
173 views

Calculating the series expansion of a theta function

I have defined the q-theta function as follows: $$\theta(x;q) = \prod_{k=0}^{\infty} (1-q^k x)(1-q^{k+1}/x)$$ I want to calculating, using this, the series expansion of the following series: $$\...
1
vote
1answer
86 views

Calculate the product

I have the following problem: Wolfram calculates the product incorrectly. In addition, lots of errors appears. Is it possible to improve the code? Thanks in advance! Define functions: ...
4
votes
2answers
92 views

Expanding Log[Product[…]]

I'm trying to get the log-likelihood of a Gaussian in the form $$ p(\textbf{x}|u,\sigma^2)=\prod_{n=1}^{N}\mathcal{N}(x_n|\mu,\sigma^2) \quad (1) $$ $$ \ln\ p(\textbf{x}|\mu,\sigma^2)=-\frac{1}{2\...
3
votes
2answers
230 views

How to get vector a from known inner product?

Assuming that a.b=z,where b={b1,b2,b3} and z=x b1+y b2+z b3, obviously ...
0
votes
1answer
38 views

hermitian matrix-vector product does not give real result

Background : If $H$ is a Hermitian matrix, then for any complex vector $\psi$ it holds that $\psi^* \cdot H\cdot \psi$ gives a real number. The problem I am creating a 16x16 Hermitian matrix in ...
11
votes
3answers
1k views

François Viète's approximation to π

How do I program the approximation to π devised by François Viète, which is given by 2 * 2/Sqrt[2] * 2/Sqrt[2 + Sqrt[2]] * 2/Sqrt[2 + Sqrt[2 + Sqrt[2]]] * ... ...
0
votes
1answer
59 views

Product of matrices with symbolic bounds

Before this is closed for duplicate, know that I have read the following posts: A product function for matrix products Taking the product of a list of matrices [duplicate] I need to multiply a ...
0
votes
2answers
81 views

Defining a recursive product function

I have defined a non-commutative product: ...
6
votes
1answer
99 views

Infinite product with the Catalan numbers

During the analysis of OEIS sequence A179381 I got the following expression with an infinite product: $$\prod _{k=1}^{\infty } \left(1-4^{-k} C_{k-1}\right)$$ ...
0
votes
1answer
86 views

Sum over permuted and unpermuted indices

I would like to write a code to evaluate the following (up to $N=20$) $\sum_{s_1,...,s_N=\pm 1;s_1 \cdot \cdot \cdot s_N=1}\sum_{\sigma\in S_N}\prod_{i=1}^N x_{\sigma(i)}^{s_i \lambda_i}$ There are ...
1
vote
1answer
24 views

User-defined Product with blocked variable and syntax hightlighting

I want to define a new Product but for NonCommutativeMultiply, which I do something like this: ...
1
vote
1answer
69 views

Summation and production using hold

Let's take a sum and an example production $z_{1}=\sum_{k=1}^{3}(k!+(k+1)!)$ and $z_{2}=\prod_{k=1}^{3}(k!+(k+1)!)$ I wish to get in z1 a result like that $...
1
vote
1answer
99 views

Can I split products into list [closed]

Is there a way to take a term that is a product like xyz and split it into {x,y,z}?
1
vote
1answer
261 views

How can I multiply all elements of a list together with user-defined multiplicatoin? [closed]

so currently I have my own definition of multiplication between elements but it can only multiply two elements. MyMult[a_,b_]:=... I want to multiply all ...
2
votes
2answers
83 views

Product over several previous primes

I'd like to evaluate $$\prod_p\left(1-\frac1p\right)$$ over the $k$ largest previous primes $p\le n/2$, where $n$ is the parameter. E.g., if $n=20$ and $k=3$, I'd like the product to be over the 3 ...
0
votes
3answers
127 views

Listing products of prime powers

Given a positive integer $n$, what is the code to list $2^{a_2}3^{a_3}\cdots p^{a_p}$, where $a_i\ge 0$ are integers, with respect to the lexicographic ordering on $(a_2,a_3,\ldots, a_p)$? The only ...
5
votes
2answers
144 views

Series expansion of a certain infinite product

I wanted to find Series[Product[Cos[t/n], {n, 1, Infinity}], {t, 0, 5}] but failed. Then, I tried ...
7
votes
1answer
129 views

Cross product without reordering (noncommutative)

Not related to question I assume this question (as it is of very general structure) might have been asked before, unfortunately I did not find an answer to it - despite what I used as search queries. ...
3
votes
1answer
425 views

Multiply lists of matrices

Hello I would like to multiply a list of matrices by another list of matrices and return all elements. I.e. K={A,B,C} L={X,Y} And the result should be ...
11
votes
1answer
429 views

multiplication of vector spaces

Original Question Disclaimer: The question motivated by the product of Hilbert spaces which arises from separate degrees of freedom which a system might contain in quantum technical system. Examples ...
4
votes
1answer
91 views

N[Product] and NProduct give different results

I have some trouble. I've been using finite product to study a certain function (see below). However, when I wanted to compute it precisely, I decided to use ...
2
votes
1answer
94 views

Net Present Value Calculation for a Changing Variable

I have a list of 1000 lists, each comprising 100 pairs of numbers, with the first of these numbers running from 1 to 100, and the second being an output from an equation, dependent upon variable G. ...
1
vote
0answers
201 views

Creating a scalar product function [closed]

I'm new to Mathematica and I'm struggling a bit with it. I need to make a function that returns me the scalar product $a\cdot b$ of two vectors $a$ and $b$, without using the ...
0
votes
0answers
88 views

Expressing the output product using dot

I have an expression of the form Hbar.H where H and Hbar are vectors. How can I get the ...
10
votes
1answer
186 views

TensorReduce and Dot

I'm manipulating abstract tensors with Mathematica. I have a question. With the assumptions $Assumptions = (R | r) ∈ Arrays[{4}]; I can do two operations: ...
2
votes
1answer
154 views

How to put conditions on indices of product

I'm trying to solve for the Lagrangian form of the interpolation polynomial. Right now, I'm just trying to solve for the $l_i(x)$ values which are equal to $l_i(x)=\prod_{j\neq i, j=1}^{n}{\frac{x-x_j}...
5
votes
0answers
72 views

TensorContract applied twice

I have a very simple question about TensorContract command: I'm declaring ...
2
votes
1answer
170 views

To what extent can one simplify these products of gamma functions?

I have these three expressions ...
2
votes
1answer
234 views

Multiply all matrices in an array

Disclaimer: I'm new to Mathematica. I have an array $\gamma[i]$ of length $n$, each element of which holds an $m\times m$-matrix. I would like to multiply all of them, $$\prod_{i=1}^n \gamma[i].$$ I ...
0
votes
0answers
291 views

Non commutative products and scalars

Say I have an expression such as $$a.(\alpha b)$$ where $a$ and $b$ are non-commutative operators, but $\alpha$ is simply a scalar. How do I tell Mathematica to treat $\alpha$ as a scalar and "pull" ...
3
votes
2answers
3k views

How to compute the partial trace of a 4x4 matrix?

I want to compute a partial trace using formula $\rho_A=\sum\langle B|\rho_{AB}|B\rangle$ . Example, $\rho_{AB}= $$ \begin{pmatrix} a & b & c & d\\ e & f & g & h\\ i &...
1
vote
1answer
155 views

How to multiply two tensor with arbitrary ranks, on one index only (like GR)?

I am writing a function which take two tensors with the same dimensions but with arbitrary ranks and multiplies them over one index, just like this example from GR: See, I couldn't use ...
1
vote
0answers
176 views

`QPochhammer` function simplification?

Consider the function $$(a;q)_n=\begin{cases} 1&n=0,\\ (1-a)(1-aq)\cdots(1-aq^{n-1})&n=1,2,\dots,\\ [(1-aq^{-1})(1-aq^{-2})\cdots(1-aq^n)]^{-1}&n=-1,-2,\dots \end{cases}$$ which in ...
0
votes
2answers
218 views

Conditions on a product

I want to impose specific conditions on a product I am trying to take. I found this previous question asked here but when I use this I get zero. My expression is $$ \prod_{(i,j)=(-a+1,-b+1)}^{(a,b)}\...
0
votes
1answer
236 views

Iterating KroneckerProduct[] and returning the result from a function

I am trying to write a function which will take a matrix m and an integer i as inputs. Then it will compute the Kronecker product of m with itself i times and return the result. The code is as follows....
2
votes
0answers
389 views

Outer product using the quantum mathematica package

I am using the quantum Mathematica package and am trying to do computations that require me to use the outer (tensor) products of Pauli matrices. I would define this as, for example, ...