math3d-react icon indicating copy to clipboard operation
math3d-react copied to clipboard

Sums and products

Open Zaq-Xander opened this issue 4 years ago • 0 comments

Hello, another suggestion!

It'd be nice if we could get sums and products implemented. By this, I don't mean the current sum and product functions, which accept a pre-set number of inputs, I mean something analogous to the stuff produced from the LaTeX \sum_{n=a}^{b} \left( u_n \right) and \prod{n=a}^{b} \left( u_n \right).

Supposing we call these Sum and Product, I suggest we have the following syntax: Sum(integer lowerBound, integer upperBound, function function) Product(integer lowerBound, integer upperBound, function function) or, Sum(integer lowerbound, integer upperBound, expressionInvolving "variableName", variable variableName) Product(integer lowerbound, integer upperBound, expressionInvolving "variableName", variable variableName)

To be explicit, it'd be nice to see the following automatically compute: Sum(a, b, f) = f(a) + f(a+1) + ... + f(b) Product(a, b, f) = f(a) * f(a+1) * ... * f(b) or, in the other proposed notation, Sum(a, b, f(n), n) = f(a) + f(a+1) + ... + f(b) Product(a, b, f(n), n) = f(a) * f(a+1) * ... * f(b)

For explicit examples, having definined f(x) = 2x elsewhere, Sum(0, 20, f) = 0 + 2 + 4 + ... + 40 = 420 Product(1, 20, f) = 2 * 4 * 8 * ... * 40 = 2551082656125828464640000 or, Sum(0, 20, 2n, n) = 0 + 2 + 4 + ... + 40 = 420 Product(1, 20, 2n, n) = 2 * 4 * 8 * ... * 40 = 2551082656125828464640000

This isn't by any means necessary, but I do reackon it'd be a nice change for users. We could more easily visualise Taylor or Fourier series without having to manually type out a 100-term approximation, for example (these have become more realistic to do in this program since the implementation of complex numbers!).

Cheers, and thanks for the amazing tool!

Zaq-Xander avatar May 24 '21 07:05 Zaq-Xander