Sum of new values

So I have the following formula

I have found out that

c={0.308573, 0.404507, 0.356427, 0.652755, 0.402941}

I was just wondering if there is a easier way of computing this instead of having the following: Because when the time period gets bigger its going to take a while to write.

\[Beta]^0*Log[c[[1]]] + \[Beta]^1*Log[c[[2]]] + \[Beta]^2*
Log[c[[3]]] + \[Beta]^3*Log[c[[4]]] + \[Beta]^4*Log[c[[5]]]


Use scalar product of lists here

Beta^(Range[5] - 1) .Log[c]


Because Attributes are Listable

Attributes[{Log, Power}] // TableForm

• +1 I think Beta^Range[0, 4] . Log[c] is slightly more efficient (measured by RepeatedTiming). Commented Apr 4, 2022 at 13:06
• More generally, Beta^(Range[0,Length[c] - 1]) . Log[c] Commented Apr 4, 2022 at 14:05

While the answer of @Akku14 is certainly fine, especially as modified by @"Daniel Lichblau", the following might be more communicative in your context:

u[c_, t_] := \[Beta]^(t - 1) Log[c]
Sum[u[c[[t]], t], {t, Length[c]}]


It should perhaps be noted that the OP is evaluating a polynomial in β, and thus, one should use Horner's method for evaluating it; the built-in function that can do this happens to be named FromDigits[]:

c = {0.308573, 0.404507, 0.356427, 0.652755, 0.402941};
FromDigits[Reverse[Log[c]], β] // Expand
-1.1758 - 0.905086 β - 1.03163 β^2 - 0.426553 β^3 - 0.908965 β^4

• Or if the polynomial is already put together by, say, @DanielLichtblau 's approach: Beta^(Range[0, Length[c] - 1]) . Log[c] // HornerForm. Does FromDigits actually give Horner's method? It looks like it only partially does so as FromDigits[Reverse[Log[c]], β] results in -1.1758 - 0.905086 Beta + (-1.03163 - 0.426553 Beta) Beta^2 - 0.908965 Beta^4 rather than -1.1758 + Beta (-0.905086 + Beta (-1.03163 + (-0.426553 - 0.908965 Beta) Beta)).
– JimB
Commented May 17, 2022 at 21:18
• @Jim, it's supposed to do Horner (at least in the numerical case), but it looks like it's trying to be clever with symbolic arguments. Commented May 17, 2022 at 23:37
• Yep. What one sees and what's behind the curtain can be totally different. Mathematica is no different.
– JimB
Commented May 18, 2022 at 0:21

MapIndexed is another possibility (but not as efficient as the dot product method)

MapIndexed[(Beta^(First@#2-1)) Log[#1]&, c]//Total


In Operator form:

MapIndexed[(Beta^(First@#2-1)) Log[#1]&]@c//Total

• This is also Inner ('a generalization of Dot'): Inner[(Beta^#2) Log[#1]&, c, Range[0,Length@c-1], Plus] Commented Apr 5, 2022 at 12:23