`yacas`

comes with a number of rules all defined in the `yacas`

directory of the installed package:

`## [1] "/tmp/RtmpT01q0t/Rinst25785acc91ad/Ryacas/yacas"`

For example in the `sums.rep`

folder, a number of rules for sums are defined in the `code.ys`

file.

As an example, the fact that \[
\sum_{k = 1}^n (2k-1) = n^2
\] is defined in `yacas`

as

`SumFunc(_k,1,_n,2*_k-1, n^2 );`

and the geometric sum is defined as

`SumFunc(_k,0,_n,(r_IsFreeOf(k))^(_k), (1-r^(n+1))/(1-r) );`

These can be verified:

`## [1] "m^2"`

`## [1] "2^(m+1)-1"`

There are also rules in `yacas`

that are able to let the user change some limits of some sums, e.g. for the geometric sum:

`## [1] "2^(m+1)-2"`

But what about changing the limit of the first sum? I.e. instead of \[
\sum_{k = 1}^n (2k-1) = n^2
\] then know that \[
\sum_{k = 0}^n (2k-1) = -1 + \sum_{k = 1}^n (2k-1) = n^2 - 1 .
\] But what does `yacas`

say?

`## [1] "Sum(i,0,m,2*i-1)"`

We can then add our own rule by:

And then try again:

`## [1] "m^2-1"`

A good source of inspiration for writing custom rules is reading the included rules, but there is a lot to programming in `yacas`

and we refer to `yacas`

’s documentation, specifically the chapter Programming in Yacas.