symsum does not work with symprod

1 次查看(过去 30 天)
I'm trying to avaluate the following:
syms j k
double(symsum((-symprod((j+0.3-1)/(j), j, 1,k))^2, k, 2, Inf))
It returns: -0.0806, which is nonsensical, since this is a sum of squared numbers.
When I evaluate the same in Wolfram Alpha using "sum( (product (j+0.3-1)/j, j=1..k)^2, k, 2, infinity)", I get 0.226456, which seems to be correct, since Matlab seems to converge to this number up to k=100000 (and then it crushes). How can I make it work? Thanks.

采纳的回答

Walter Roberson
Walter Roberson 2023-3-1
syms j k
double(symsum((-symprod((j+0.3-1)/(j), j, 1,k))^2, k, 2, Inf))
ans = 0.2265
So it works in current releases.
I am checking back to see if I can figure out when it was fixed.
  3 个评论
Walter Roberson
Walter Roberson 2023-3-1
Works in R2018b.
It appears that R2018a is the last release that has this problem.
It is a problem with the symsum() part, by the way; it is returning a hypergeom() minus a constant when it should be returning an expression in gamma() minus that same constant.
Adam Golinski
Adam Golinski 2023-3-3
Walter, many thanks for your help. I've installed a new version and it works now indeed. Best wishes!

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Calculus 的更多信息

产品


版本

R2018a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by