I want to write a function say BaseExponent that will output the base and exponent of a number. In particular it should do the following:
BaseExponent[(1 + I Sqrt[3])^(1/72)] = {(1 + I Sqrt[3]), 1/72}
BaseExponent[72] = {72, 1}
BaseExponent[1/4] = {1/4, 1}
BaseExponent[Sqrt[-3]] = {-3, 1/2}
BaseExponent[I Sqrt[3]] = {-3, 1/2}
BaseExponent[(3/4)^(1/4)] = {3/4, 1/4}
I started by doing the following:
BaseExponent[a_] /; (! FreeQ[a, Power]) := {a[[1]], a[[2]]}
BaseExponent[a_Integer] := {a, 1}
BaseExponent[a_Rational] := {a, 1}
What I have supplied takes care of the first three examples but definitely not rest. Any ideas on how to extend this to cover all the cases I have provided in the example above?
I Sqrt[3]is to give{-3, 1/2}, does it follow that2 Sqrt[3]is to give{12, 1/2}? Further, what you to get from expressions such asSurd[12, 2]andCubeRoot[12]? – m_goldberg Nov 06 '15 at 21:35