Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

How do you define a symbolic multiplicative function?

I would like to define a symbolic function $f$ from $\mathbb{Z}$ which takes values in $-1,1$. This function $f$ is completely multiplicative (i.e: $f(mn) = f(m) f(n)$ for all $m,n \in \mathbb{Z}$). I know how to define a symbolic function in Sage:

f = function('f')

But I don't know:

  1. How do I specify to Sage that I want $f$ to be multiplicative? For example, I want $f(6) = f(2)f(3)$ to hold true, and so on.
  2. How do I specify to Sage that $f$ takes values in $-1,1$? That is, I need $f(n)^2 = 1$ for all $n \in \mathbb{N}$. How do I specify this?