0
$\begingroup$

I have a number that has the form $x=\sum_{k=1}^n c_k3^{q_k}$, where $q_k\in\mathbb{Q}$ and $0\neq c_k$ is in $\mathbb{Z}$ or $i\mathbb{Z}$. We may define the $3$-adic valuation of $c_k3^{q_k}$ as $v_3(c_k3^{q_k})=v_3(c_k)+q_k$, where $v_3(c_k)=\begin{cases}v_3(c_k),& if c_k\in\mathbb{Z}\\v_3(c_k/i),& if c_k\in i\mathbb{Z}\end{cases}$. Now, how can I output $x$ in the form $$d_13^{r_1}+d_23^{r_2}+\cdots+d_n3^{r_n},$$ where $d_k\in\mathbb{Z}$ or $i\mathbb{Z}$ with $v_3(d_k)=0$, $r_k\in\mathbb{Q}$ with $r_1\leq r_2\leq\cdots\leq r_n$?

For example, if $x=5i\cdot3^{1/2}-18\cdot3^{4/7}+2\cdot3^{1/2}+3\cdot3^{1/2}$, the expected output should be something like $$2\ i\ 3^{1/2}+5\ 3^{1/2}+3^{3/2}-2\ 3^{18/7}.$$

$\endgroup$
3
  • $\begingroup$ How would the number $27$ be decomposed: $1\times 3^3$, or something else entirely? $\endgroup$ May 17, 2020 at 9:27
  • $\begingroup$ @J.M. You are right. It should be $1\cdot 3^3$, or simply $3^3$. $\endgroup$
    – Yijun Yuan
    May 17, 2020 at 9:31
  • 1
    $\begingroup$ This will be easier to canonicalize if you work with a list of pairs of the form {d,e} where the oair denoted d*3^e. If the output formatting is critical maybe make the outer wrapper a symbol and use Format to display it. $\endgroup$ May 17, 2020 at 22:26

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.