英文:
Summation in Sheets
问题
我在Google表格中生成数学求和公式方面遇到了问题;具体来说,假设我有单元格中的输入,我们称它们为E2和F2,我尝试执行从i = E2到i = E2+F2的求和。如果LaTeX通过,那就是:
\sum_{i=E2}^{E2+F2}i
或者
在QuickLaTeX中呈现
特别是我尝试将这个公式放入一个框中,因为我需要多次执行它 - 那个'2'将成为我的表格中垂直值的大多数。不出所料,这个公式将放在G2中。
到目前为止,我已经尝试了一些SERIESSUM公式,但我仍然不确定如何将线性级数转化为幂级数 - 如果可能的话。
英文:
I'm having trouble generating a mathematical summation in Google Sheets; specifically, assuming I have inputs in cells, we'll call them E2 and F2, I'm trying to perform the sum from i = E2 to i = E2+F2 of i. If LaTeX goes through, that's:
\sum_{i=E2}^{E2+F2}i
or
rendered in QuickLaTeX
Particularly I'm trying to get this into one box, because I need to do it a lot of times - that '2' is going to be most vertical values of my sheet. Unsurprisingly, this formula will go in G2.
So far I've tried a few SERIESSUM formulae, but I'm still not sure how to convert a linear series into a power series - if that's even possible.
答案1
得分: 1
Edit:
我最初误解了问题。
如果我理解正确,您要搜索的内容是:
=(E2+1)+(E2+2)+(E2+3)+...+(E2+F2)
(我认为原始问题中还有一个 E2+0
项,这就是您在评论中尝试的公式错误的原因)
您可以从每个项中提取出 E2
,然后得到 =F2*E2+1+2+3...+F2
因此,最终的公式是
=E2*F2+F2*(F2+1)/2
Original answer:
如果我理解您的问题正确,您想要找到从E2值到F2值的数字之和。
标准公式是 =(F2-E2+1)*(E2+F2)/2
简而言之:将E2和F2之间的元素数量乘以两个端点的平均值。
英文:
Edit:
I originally misunderstood the question.
If I understand correctly, what you're searching for is:
=(E2+1)+(E2+2)+(E2+3)+...+(E2+F2)
(I think the original question had an E2+0
term also, that's why the formula you tried in the comments was wrong)
you can pull out E2
from each term and you'll get =F2*E2+1+2+3...+F2
So the final formula is
=E2*F2+F2*(F2+1)/2
Original answer:
If I understood your question right, you want to find the sum of numbers from the value in E2 to the value in F2.
The standard formula is =(F2-E2+1)*(E2+F2)/2
In short: multiply the number of elements between E2 and F2 by the average of the two endpoints
答案2
得分: 0
=LET(Σ, LAMBDA(第一个, 最后一个, 表达式, ARRAYFORMULA(SUM(MAP(SUBSTITUTE(表达式, "n", SEQUENCE(最后一个-第一个+1)), LAMBDA(_, INDEX(QUERY( , "select " & _), 2)))))), Σ(E2, F2, "n"))
英文:
Try this out:
=LET(Σ,LAMBDA(first,last,expression,ARRAYFORMULA(SUM(MAP(SUBSTITUTE(expression,"n",SEQUENCE(last-first+1)),LAMBDA(_,INDEX(QUERY(,"select "&_),2)))))),Σ(E2,F2,"n"))
答案3
得分: 0
尽管已经找到了解决方案,但我可以提出另一种更适用于"表格特定"的方法:
=SUM(SEQUENCE(F2, 1, E2 + 1))
有时候我们不知道一个现成的求和公式,或者所需的公式根本不存在。那么我们可以采用更通用的方法,即(1)生成一个序列,然后(2)计算成员的总和。Google表格有一种直接的方法来实现这个,我们应该了解它。
英文:
Although the solution is already found, I can suggest another one which is more "sheets-specific":
=SUM(SEQUENCE(F2; 1; E2 + 1))
Sometimes we don't know a ready-to-use summation formula or the required formula does not exist et all. Then we may use a more general approach, i.e. (1) generate a sequence and (2) calculate a sum of members. Google sheets have a direct way to do it and we should know about it.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论