Contact
CoCalc Logo Icon
StoreFeaturesDocsShareSupport News AboutSign UpSign In
| Download

Math 223a Class Demos

Project: Math 223a
Views: 1226
R2 = Zp(2); #construct the ring of 2-adic integers.
a = R2(8); a #convert the integer 8 to an element of R5
2^3 + O(2^23)
exp(a) #2-adic exponential of a=8 #Warning: sage uses the same notation for the p-adic exponential that it does for the normal exponential function. You need to make sure your objects belong to a p-adic ring before exponentiating.
1 + 2^3 + 2^5 + 2^8 + 2^12 + 2^13 + 2^18 + O(2^20)
exp(a)*exp(-a) #basic check that this is a homomorphism
1 + O(2^20)
b = R2(6); exp(b) #b=6 is not in the disk of convergence of the 2-adic exponential
Error in lines 1-1 Traceback (most recent call last): File "/cocalc/lib/python2.7/site-packages/smc_sagews/sage_server.py", line 1188, in execute flags=compile_flags) in namespace, locals File "", line 1, in <module> File "sage/symbolic/function.pyx", line 998, in sage.symbolic.function.BuiltinFunction.__call__ (build/cythonized/sage/symbolic/function.cpp:11922) res = super(BuiltinFunction, self).__call__( File "sage/symbolic/function.pyx", line 474, in sage.symbolic.function.Function.__call__ (build/cythonized/sage/symbolic/function.cpp:6649) return method() File "sage/rings/padics/padic_generic_element.pyx", line 2712, in sage.rings.padics.padic_generic_element.pAdicGenericElement.exp (build/cythonized/sage/rings/padics/padic_generic_element.c:19605) raise ValueError('Exponential does not converge for that input.') ValueError: Exponential does not converge for that input.
c = R2(3); log(c) # calculate the 2-adic logarithm of c = 3
2^2 + 2^4 + 2^5 + 2^6 + 2^7 + 2^11 + 2^13 + 2^14 + 2^15 + 2^17 + O(2^20)
log(c^2) #check log c^2 = 2 log c
2^3 + 2^5 + 2^6 + 2^7 + 2^8 + 2^12 + 2^14 + 2^15 + 2^16 + 2^18 + O(2^20)
d = R2(4); log(d) #d = 4 is not in the disk of convergence
Error in lines 1-1 Traceback (most recent call last): File "/cocalc/lib/python2.7/site-packages/smc_sagews/sage_server.py", line 1188, in execute flags=compile_flags) in namespace, locals File "", line 1, in <module> File "/ext/sage/sage-8.3_1804/local/lib/python2.7/site-packages/sage/functions/log.py", line 429, in log return ln(args[0], **kwds) File "sage/symbolic/function.pyx", line 998, in sage.symbolic.function.BuiltinFunction.__call__ (build/cythonized/sage/symbolic/function.cpp:11922) res = super(BuiltinFunction, self).__call__( File "sage/symbolic/function.pyx", line 474, in sage.symbolic.function.Function.__call__ (build/cythonized/sage/symbolic/function.cpp:6649) return method() File "sage/rings/padics/padic_generic_element.pyx", line 2264, in sage.rings.padics.padic_generic_element.pAdicGenericElement.log (build/cythonized/sage/rings/padics/padic_generic_element.c:16141) raise ValueError("You must specify a branch of the logarithm for non-units") ValueError: You must specify a branch of the logarithm for non-units
minusone = R2(-1); log(minusone) #as seen in class, the 2-adic log of -1 vanishes.
O(2^20)
x = R2(17); squarerootx = exp((1/2)*log(x)); squarerootx #construct a 2-adic square root of 17 using exp and log
1 + 2^3 + 2^5 + 2^6 + 2^7 + 2^9 + 2^10 + 2^13 + 2^16 + 2^17 + O(2^19)
squarerootx^2 #check that y^2 = 17
1 + 2^4 + O(2^20)
cuberootx = exp((1/3)*log(x)); cuberootx; cuberootx^3; #likewise can make a cube root (Remember from problem set 3 that x^3 - 17 has a unique root in Q_3?)
1 + 2^4 + 2^5 + 2^7 + 2^8 + 2^14 + 2^15 + 2^16 + 2^18 + O(2^20) 1 + 2^4 + O(2^20)
fourthrootx=exp((1/4)*log(x)); fourthrootx; fourthrootx^4 #and a 4th root
1 + 2^2 + 2^3 + 2^5 + 2^7 + 2^8 + 2^10 + 2^11 + 2^12 + 2^14 + 2^17 + O(2^18) 1 + 2^4 + O(2^20)
eighthrootx = exp((1/8)*log(x)); eighthrootx; eighthrootx^8 #but 8th root doesn't converge. Can in fact show that the 8-th powers in Z_2^times are all in U_5 = 1 + 32 Z_2, so x^8-17 has no roots in Q_2.
Error in lines 1-1 Traceback (most recent call last): File "/cocalc/lib/python2.7/site-packages/smc_sagews/sage_server.py", line 1188, in execute flags=compile_flags) in namespace, locals File "", line 1, in <module> File "sage/symbolic/function.pyx", line 998, in sage.symbolic.function.BuiltinFunction.__call__ (build/cythonized/sage/symbolic/function.cpp:11922) res = super(BuiltinFunction, self).__call__( File "sage/symbolic/function.pyx", line 474, in sage.symbolic.function.Function.__call__ (build/cythonized/sage/symbolic/function.cpp:6649) return method() File "sage/rings/padics/padic_generic_element.pyx", line 2712, in sage.rings.padics.padic_generic_element.pAdicGenericElement.exp (build/cythonized/sage/rings/padics/padic_generic_element.c:19605) raise ValueError('Exponential does not converge for that input.') ValueError: Exponential does not converge for that input.