prime:cashome

**This is an old revision of the document!**

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, so use the appropriate CAS or Home function depending on which you are trying to do.

In CAS, it is best to always use * when you mean it. e.g. 2*x, a*x, etc.. You can get away with using 2x (a number multiplied by a variable), but never with 2 variables, as it will see ax as a single variable called 'ax', so you'd always have to use a*x.

Also, understand that when using variables in an expression, if that variable has a value assigned to it, CAS may be using that value, instead of solving it symbolically. You can remove the variable from being defined using the purge() function. The restart command purges all the CAS variables.

Some CAS functionality can be assisted by telling the system some characteristics about the variables involved, using the assume() and additionally() functions. The function about(var) returns any assumptions on the variable. Purging the variable removes any assumptions. e.g. To get the integral of e^(-a*x) from 0 to infinity will return undef unless you say assume(RE(a)>0) beforehand. Then it will return 1/a as the answer correctly.

Sometimes, CAS will state something cryptic about how it's answer may not be perfect and when you hit enter again, it then gives you it's answer. This is because some math can be complex and it's trying to tell you what it knows. Don't let these statements worry you. It's just the CAS system being complete.

Make sure you read the help docs for the about, purge, assume and additionally commands.

prime/cashome.1507964630.txt.gz · Last modified: 2017/10/14 00:03 by webmasterpdx