User Tools

Site Tools


prime:cashome

This is an old revision of the document!


CAS vs Home

CAS is designed to calculate things symbolically, so sometimes we can be surprised with results for numerical calculations. e.g. SUM(1/x^2,x,1,100) tries to sum the expression (1/x^2) for x = 1 to 100. However, under CAS, it will result in a ratio of 2 very large integers. You'll have to run approx() to get the decimal result. If you try it with 5000 instead of 100, it will take quite a while and when complete will result in undef as it ran out of decimal digits for the numerator and denominator of the result. It's not trying to evaluate 1/x^2 in a loop and adding the result to a sum. It's trying to evaluate it in a way that it could do it with SUM(1/y^2,y,x,1000x) resulting in Psi(x,1)-Psi(1000*x+1,1).

To use a conventional numerical loop, don't use CAS. In this case, go to home mode and use the Σ symbol from the math template key….as in Σ(1/x^2,x,1,5000). This runs much faster than SUM() as it's not trying to solve symbolically, and will result in a numerical solution (1.6447… in this case).

Just remember the rule that CAS is trying to solve symbolically, Home solves numerically.

prime/cashome.1507719085.txt.gz · Last modified: 2017/10/11 03:51 by webmasterpdx