• Assignment. Sage uses = for assignment statements.
  • Comparison. Sage uses ==, <=, >=, < and > for comparison.
  • Basic Mathematical Operations. In additional to +, -, *, and /, Sage uses ^ or ** for exponentiation. // for integer division, and % for mod; i.e., remainder.
  • The Modulus Operator. The code a % b returns the remainder of $a$ divided by $b$.
  • Numerical Precision. To get a numerical approximation, use either the function n or the method n.
  • Rounding Up and Down. Sage uses the commands ceil(x) and floor(x) to round up and down to the nearest integer, respectively.
Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License