Macaulay2 » Documentation
Packages » Padic » PadicNumber » PadicNumber + PadicNumber » PadicNumber - PadicNumber
next | previous | forward | backward | up | index | toc

PadicNumber - PadicNumber -- subtract or negate p-adic numbers

Description

Subtract two $p$-adic numbers.

i1 : QQ_7 11 - QQ_7 3

o1 = 1 + 1*7^1

o1 : QQ  (of precision 20)
       7

If one of the arguments is an ordinary number, it is first promoted to the appropriate $p$-adic field.

i2 : QQ_7 11 - 3

o2 = 1 + 1*7^1

o2 : QQ  (of precision 20)
       7
i3 : 11 - QQ_7 3

o3 = 1 + 1*7^1

o3 : QQ  (of precision 20)
       7

The unary - operator negates a $p$-adic number.

i4 : -QQ_7 3

o4 = 4 + 6*7^1 + 6*7^2 + 6*7^3 + 6*7^4 + 6*7^5 + 6*7^6 + 6*7^7 + 6*7^8 +
     6*7^9 + 6*7^10 + 6*7^11 + 6*7^12 + 6*7^13 + 6*7^14 + 6*7^15 + 6*7^16 +
     6*7^17 + 6*7^18 + 6*7^19

o4 : QQ  (of precision 20)
       7

See also

Ways to use this method:


The source of this document is in /build/reproducible-path/macaulay2-1.26.05+ds/M2/Macaulay2/packages/Padic.m2:639:0.