数学期望问题
symsum
- symsum文档
- 调用格式:
F = symsum(f,k,a,b)
returns the sum of the series with terms that expression f specifies, which depend on symbolic variable k. The value of k ranges from a to b. If you do not specify the variable, symsum uses the variable that symvar determines. If f is a constant, then the default variable is x.- 返回表达式f指定的一系列项的和,这些项依赖于符号变量k。k的值范围从a到b。如果不指定变量,symsum将使用symvar确定的变量。如果f是常数,那么默认变量是x。
F = symsum(f,k)
- 栗子:
1
2
3
4
5
6
7
8
9
10
11syms k x
S1 = symsum(k^2, k, 0, 10)
S2 = symsum(1/k^2, k, 1, Inf)
S3 = symsum(x^k/factorial(k), k, 0, Inf)%分母为阶乘
%answer
S1 =
385
S2 =
pi^2/6
S3 =
exp(x)