ASKSAGE: Sage Q&A Forum - RSS feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Thu, 25 Feb 2021 14:38:56 +0100Finite sums and multiplicationhttps://ask.sagemath.org/question/55904/finite-sums-and-multiplication/ Am I right in assuming that Sage has no meaningful way to translate mathematical notation as
" for i in I, take the product of c_i" ,
" for i in I, take the sum of a_i",
" for i in I, take the cartesian product of the sets B_i " ?
If this is true isn't this a very big problem of a language that's supposed to be about mathematics?Alain NgalaniThu, 25 Feb 2021 14:38:56 +0100https://ask.sagemath.org/question/55904/Working with sums/products of listshttps://ask.sagemath.org/question/44906/working-with-sumsproducts-of-lists/I need to work symbolically with expressions such as this
$L(x; a,b) = \prod_{i=1}^n{abx_i^{a-1}(1-x_i^a)^{b-1}}$
where $x$ would be a random sample of size $n$.
I don't know of any way to express the indexing of the sample $x$ by each element...
The closest I got was defining the variables $n$ and $i$ and representing $x$ as a function
var('a','b','x','n','i')
assume(x>0,a>0,b>0,i>0,n>0)
X = function('X',nargs=1)
L = product(a*b*X(i)^(a-1)*(1-X(i)^a)^(b-1), i, 1, n)
But this seems to inmediately assume that $X(i) = i$ and $L$ is represented as:
$-\frac{\left(-1\right)^{n} a^{n} b^{n} X\left(0\right) X\left(-1\right) X\left(-2\right) X\left(-3\right) X\left(-4\right) X\left(-5\right) X\left(-6\right) X\left(-7\right) X\left(-8\right) X\left(-9\right) {\prod_{i=1}^{n} {\left(-X\left(i\right)^{a} + 1\right)}^{b}} {\prod_{i=1}^{n} X\left(i\right)^{a}}}{X\left(n - 1\right) X\left(n - 2\right) X\left(n - 3\right) X\left(n - 4\right) X\left(n - 5\right) X\left(n - 6\right) X\left(n - 7\right) X\left(n - 8\right) X\left(n - 9\right) X\left(n\right) {\prod_{i=1}^{n} X\left(i\right)^{a} - 1} {\prod_{i=1}^{n} X\left(i - 10\right)}}$
I don't know how to deal with this expression, and it seems to me like it should be straight forward.
In case it's meaningful, after defining the expression, I will be differentiating it with respect to both $a$ and $b$.galioSat, 05 Jan 2019 15:23:28 +0100https://ask.sagemath.org/question/44906/