Post Reply 
Cubic and Quartic Formulae
08-06-2015, 12:01 PM
Post: #6
RE: Cubic and Quartic Formulae
If you are showing exact formula for 3rd or 4th order equations to your students, you should really emphasize that they should in fact never be used. Numerically, it's much more precise to run iteratives methods to find root approximations. Symbolically, it's way more efficient to use algebraic extensions of Q (rootof in Xcas, unfortunately not available to the user on the Prime, not my choice...).
Xcas has a small user program (comments are in French) to demonstrate Cardan formula that should be easy to adapt to the Prime
Code:

cardan(P,x):={
  local b,p,q,d,V,u,v,x1,x2,x3,n,j;
  j:=exp(2*i*pi/3);
  V:=symb2poly(P,x);
  n:=size(V);
  if (n!=4){
    throw(afficher(P)+" n'est pas de degre 3");
  }
  // Reduction de l'equation
  V:=V/V[0];
  b:=V[1];
  V:=ptayl(V,-b/3);
  p:=V[2];
  q:=V[3];
  // on est ramen← ¢ x^3+p*x+q=0
  // x=u+v -> u^3+v^3+(3uv+p)(u+v)+q=0
  // On pose uv=-p/3 donc u^3+v^3=-q et u^3 et v^3 sont solutions
  // de u^3 v^3 = -p^3/27 et u^3+v^3=-q
  // donc de x^2+q*x-p^3/27=0
  d:=q^2/4+p^3/27;
  if (d==0){
    // racine double
    return solve(P,x); 
  }
  d:=sqrt(d);
  u:=(-q/2+d)^(1/3);
  v:=-p/3/u;
  x1:=u+v-b/3;
  x2:=u*j+v*conj(j)-b/3;
  x3:=u*conj(j)+v*j-b/3;
  return [x1,x2,x3];
}:;
BTW, there is a Galois Field command on the Prime. Try GF(2,8) for example, then you can work in the non-prime field with 256 elements.
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
Cubic and Quartic Formulae - LCieParagon - 08-06-2015, 05:35 AM
RE: Cubic and Quartic Formulae - parisse - 08-07-2015, 06:08 AM
RE: Cubic and Quartic Formulae - Gerald H - 08-06-2015, 09:07 AM
RE: Cubic and Quartic Formulae - parisse - 08-06-2015 12:01 PM
RE: Cubic and Quartic Formulae - parisse - 08-08-2015, 06:20 AM



User(s) browsing this thread: 1 Guest(s)