Given a elliptic curve over $F_p$ with the equation $E : y^2 = x^3 + Ax + B$, I want to find an isomorphous curve (quadratic twist) which can be written in the form $E': y^2 = x^3 + A'x + B'$ where $A'$ is a given.
Following Wikipedia's description of quadratic twists, this seems to be easy: since $E' : y^2 = x^3 + Ad^3x +Bd^2$ where $d$ is the twisting parameter. Solving $A'=Ad^3$ gives $d = \sqrt[3]{\frac{A'}{A}}$.
Checking with SAGE, however, I get completely wrong results. Given: $$\begin{align} p &= \mathrm{0xC302F41D932A36CDA7A3463093D18DB78FCE476DE1A86297} \\ A &= \mathrm{0x6A91174076B1E0E19C39C031FE8685C1CAE040E5C69A28EF} \\ B &= \mathrm{0x469A28EF7C28CCA3DC721D044F4496BCCA7EF4146FBF25C9} \\ d &= 2 \end{align}$$ I would expect $$A' = Ad^3 = \mathrm{0x487CE98D68E62BD64340E8CDA4EDF73017C8E976AE2FBD1C}$$ However, SAGE says that the twist with $d = 2$ is $$\begin{align} A' &= \mathrm{0xBDE1643020DCF116CAC0BA0BFFCC9E119EAABCD9AE2D23B2} \\ B' &= \mathrm{0x472F7598F817AD1ABF3C4F83B6BE0FEE11D68A776B9C52E1} \end{align}$$ How is this calculation done?