I would like to simplify an expression like $\sum _{i=1}^k \sqrt{a_i^2}$, with the condition $\forall _{i\in \mathbb{Z}_{>\, 0}}a_i\in \mathbb{R}_{>\, 0}$ and with $k$ being undefined, which should give the following result $\sum _{i=1}^k a_i$.
My best, yet unsuccessful, attempt was the following:
Refine[Sum[Sqrt[a[i]^2], {i, 1, k}], Element[a[__],PositiveReals]]
which doesn't seem to take into account the fact that $a_i$ is positive as the result obtained is $\sum _{i=1}^k |a_i|$ (with Abs[a[i]]
).
I have read (here) that assumptions will work with Element
but not with inequalities, so maybe the PositiveReal
assumption is split in Element[a[__],Reals]
and a[__]>0
, with the first statement working properly but the second doesn't?
Here is the code of other tries:
Refine[Sum[Sqrt[a[i]^2], {i, 1, k}], #] & /@ {Element[a[__],
PositiveReals], Element[a[__], Reals], a[__] > 0,
ForAll[i, PositiveIntegers, a[i] > 0]}
I have already looked at similar threads (1,2,3,4) but couldn't find any solution.
EDIT
The question here isn't about the specific function/sum, but rather the formulation of abstract assumptions with arbitrary number of elements.