2
$\begingroup$

I would like to do something very simple, i.e. replace the coefficients in a sum by a function:

c[1] + c[2] + c[3] /. {c[s] -> (s + 1)/(2 (2 s + 1))}

Unfortunately, this does not work. Any suggestion for something handy that would do the job?

$\endgroup$
0

1 Answer 1

6
$\begingroup$

I think you need to use RuleDelayed like this:

c[1] + c[2] + c[3] /. {c[s_] :> (s + 1)/(2 (2 s + 1))}
(* 193/210 *)

This replaces every coefficient with a formula and evaluates for the integer values.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.