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

PadicNumber + PadicNumber -- add p-adic numbers

Description

Add two $p$-adic numbers.

i1 : QQ_7 3 + QQ_7 11

o1 = 2*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 3 + 4

o2 = 1*7^1

o2 : QQ  (of precision 20)
       7
i3 : 5 + QQ_7 6

o3 = 4 + 1*7^1

o3 : QQ  (of precision 20)
       7

When adding two $p$-adic numbers, the result has the smaller of the two precision values.

i4 : QQ_7(10, 3) + QQ_7(20, 4)

o4 = 1*7^1

o4 : QQ  (of precision 10)
       7

The unary + operator is the identity.

i5 : +QQ_7 3

o5 = 3

o5 : QQ  (of precision 20)
       7

Menu

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:604:0.