login  home  contents  what's new  discussion  bug reports     help  links  subscribe  changes  refresh  edit

Some demo involving the algebraic number \sqrt{3}.

fricas
t1 := (sqrt(3)-3)*(sqrt(3)+1)/6

\label{eq1}-{{\sqrt{3}}\over 3}(1)
Type: AlgebraicNumber?
fricas
tt1 := -1/sqrt(3)

\label{eq2}-{{\sqrt{3}}\over 3}(2)
Type: AlgebraicNumber?
fricas
t2 := sqrt(3)/6

\label{eq3}{\sqrt{3}}\over 6(3)
Type: AlgebraicNumber?
fricas
t1+t2

\label{eq4}-{{\sqrt{3}}\over 6}(4)
Type: AlgebraicNumber?
fricas
tt1+t2

\label{eq5}-{{\sqrt{3}}\over 6}(5)
Type: AlgebraicNumber?

Note that in PanAxiom the above are not generic expressions but of type AlgebraicNumber?.

Alternatively, we could also use Renaud Rioboo's RECLOS package, which has both mathematical equality and ordering. Unfortunately, it is not as easy to use - most importantly, you have to "name" your real roots, if you want simple answers:

fricas
RAN ==> RECLOS FRAC INT
Type: Void
fricas
x1 := (sqrt(3)$RAN-3)*(sqrt(3)$RAN+1)/6

\label{eq6}{{\left({{1 \over 6}\ {\sqrt{3}}}-{1 \over 2}\right)}\ {\sqrt{3}}}+{{1 \over 6}\ {\sqrt{3}}}-{1 \over 2}(6)
Type: RealClosure(Fraction(Integer))
fricas
xx1 := -1/sqrt(3)$RAN

\label{eq7}-{{1 \over 3}\ {\sqrt{3}}}(7)
Type: RealClosure(Fraction(Integer))
fricas
(x1=xx1)@Boolean

\label{eq8} \mbox{\rm true} (8)
Type: Boolean

It's preferable to give names to the roots:

fricas
s3 := sqrt(3)$RAN

\label{eq9}\sqrt{3}(9)
Type: RealClosure(Fraction(Integer))
fricas
(s3-3)*(s3+1)/6

\label{eq10}-{{1 \over 3}\ {\sqrt{3}}}(10)
Type: RealClosure(Fraction(Integer))

AlgebraicNumber? doesn't like the following:

fricas
f3 := sqrt(3,5)$RAN

\label{eq11}\root{5}\of{3}(11)
Type: RealClosure(Fraction(Integer))
fricas
f25 := sqrt(1/25,5)$RAN

\label{eq12}\root{5}\of{1 \over{25}}(12)
Type: RealClosure(Fraction(Integer))
fricas
f32 := sqrt(32/5,5)$RAN;
Type: RealClosure(Fraction(Integer))
fricas
f27 := sqrt(27/5,5)$RAN;
Type: RealClosure(Fraction(Integer))
fricas
expr1 := sqrt(f32-f27,3)

\label{eq13}\root{3}\of{-{\root{5}\of{{27}\over 5}}+{\root{5}\of{{32}\over 5}}}(13)
Type: RealClosure(Fraction(Integer))
fricas
expr2 := (1+f3-f3^2)

\label{eq14}-{{\root{5}\of{3}}^{2}}+{\root{5}\of{3}}+ 1(14)
Type: RealClosure(Fraction(Integer))
fricas
expr1 - f25*expr2

\label{eq15}0(15)
Type: RealClosure(Fraction(Integer))

Although the main point of RECLOS is supposed do be mathematical ordering and approximation, I could not find a convincing example. From the "examples" section of 'RECLOS':

fricas
s := sqrt(190)$RAN+sqrt(1751)$RAN-sqrt(208)$RAN-sqrt(1698)$RAN

\label{eq16}-{\sqrt{1698}}-{\sqrt{208}}+{\sqrt{1751}}+{\sqrt{190}}(16)
Type: RealClosure(Fraction(Integer))
fricas
approximate(s, 10^-15)::Float

\label{eq17}-{0.2341060678 \<u> 6455900874 E - 10}(17)
Type: Float

But we get the same without 'RECLOS':

fricas
t := sqrt(190)+sqrt(1751)-sqrt(208)-sqrt(1698)

\label{eq18}{\sqrt{1751}}-{\sqrt{1698}}+{\sqrt{190}}-{4 \ {\sqrt{13}}}(18)
Type: AlgebraicNumber?
fricas
digits(30);
Type: PositiveInteger?
fricas
numeric t - approximate(s, 10^-30)::Float

\label{eq19}-{0.5522026336 \<u> 5 E - 29}(19)
Type: Float




  Subject:   Be Bold !!
  ( 15 subscribers )  
Please rate this page: