Skip to content
3 changes: 3 additions & 0 deletions ca.h
Original file line number Diff line number Diff line change
Expand Up @@ -317,6 +317,9 @@ void ca_pi(ca_t res, ca_ctx_t ctx);
void ca_pi_i(ca_t res, ca_ctx_t ctx);
void ca_euler(ca_t res, ca_ctx_t ctx);

void ca_tribonacci_constant(ca_t res, ca_ctx_t ctx);
void ca_tetranacci_constant(ca_t res, ca_ctx_t ctx);

void ca_unknown(ca_t x, ca_ctx_t ctx);

void ca_undefined(ca_t x, ca_ctx_t ctx);
Expand Down
6 changes: 6 additions & 0 deletions ca/set_fexpr.c
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,12 @@ _ca_set_fexpr(ca_t res, fexpr_vec_t inputs, ca_vec_t outputs, const fexpr_t expr
ca_add_ui(res, res, 1, ctx);
ca_div_ui(res, res, 2, ctx);
return 1;
case FEXPR_TribonacciConstant:
ca_tribonacci_constant(res, ctx);
return 1;
case FEXPR_TetranacciConstant:
ca_tetranacci_constant(res, ctx);
return 1;
case FEXPR_Infinity:
ca_pos_inf(res, ctx);
return 1;
Expand Down
24 changes: 24 additions & 0 deletions ca/tetranacci.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
/*
Copyright (C) 2022 Raoul Bourquin

This file is part of Calcium.

Calcium is free software: you can redistribute it and/or modify it under
the terms of the GNU Lesser General Public License (LGPL) as published
by the Free Software Foundation; either version 2.1 of the License, or
(at your option) any later version. See <http://www.gnu.org/licenses/>.
*/

#include "ca.h"

void
ca_tetranacci_constant(ca_t res, ca_ctx_t ctx)
{
qqbar_t tc;
qqbar_init(tc);
qqbar_tetranacci_constant(tc);

ca_set_qqbar(res, tc, ctx);

qqbar_clear(tc);
}
24 changes: 24 additions & 0 deletions ca/tribonacci.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
/*
Copyright (C) 2022 Raoul Bourquin

This file is part of Calcium.

Calcium is free software: you can redistribute it and/or modify it under
the terms of the GNU Lesser General Public License (LGPL) as published
by the Free Software Foundation; either version 2.1 of the License, or
(at your option) any later version. See <http://www.gnu.org/licenses/>.
*/

#include "ca.h"

void
ca_tribonacci_constant(ca_t res, ca_ctx_t ctx)
{
qqbar_t tc;
qqbar_init(tc);
qqbar_tribonacci_constant(tc);

ca_set_qqbar(res, tc, ctx);

qqbar_clear(tc);
}
4 changes: 3 additions & 1 deletion doc/source/bibliography.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Bibliography

(In the PDF edition, this section is empty. See the bibliography listing at the end of the document.)

All referenced works: [BBK2014]_, [BF2020]_, [BFSS2006]_, [Boe2020]_, [Car2004]_, [Cho1999]_, [Coh1996]_, [Coh2000]_, [Fie2007]_, [GCL1992]_, [Har2010]_, [Har2015]_, [Har2018]_, [Joh2017]_, [JR1999]_, [Mos1971]_, [MP2006]_, [RF1994]_, [Ric1992]_, [Ric1995]_, [Ric1997]_, [Ric2007]_, [Ric2009]_, [Ste2002]_, [Ste2010]_, [Str1997]_, [Str2012]_, [vdH1995]_, [vdH2006]_, [vHP2012]_, [Zip1985]_.
All referenced works: [BBK2014]_, [BF2020]_, [BFSS2006]_, [Boe2020]_, [Car2004]_, [Cho1999]_, [Coh1996]_, [Coh2000]_, [Fie2007]_, [GCL1992]_, [Har2010]_, [Har2015]_, [Har2018]_, [Joh2017]_, [JR1999]_, [Mos1971]_, [MP2006]_, [RF1994]_, [Ric1992]_, [Ric1995]_, [Ric1997]_, [Ric2007]_, [Ric2009]_, [Ste2002]_, [Ste2010]_, [Str1997]_, [Str2012]_, [Wol1998]_, [vdH1995]_, [vdH2006]_, [vHP2012]_, [Zip1985]_.

.. [BBK2014] \D. H. Bailey, J. M. Borwein and A. D. Kaiser. "Automated simplification of large symbolic expressions". Journal of Symbolic Computation Volume 60, January 2014, Pages 120-136. https://doi.org/10.1016/j.jsc.2013.09.001

Expand Down Expand Up @@ -61,6 +61,8 @@ All referenced works: [BBK2014]_, [BF2020]_, [BFSS2006]_, [Boe2020]_, [Car2004]_

.. [Str2012] \A. Strzebonski. "Real root isolation for exp-log-arctan functions". Journal of Symbolic Computation 47 (2012) 282–314. https://doi.org/10.1016/j.jsc.2011.11.004

.. [Wol1998] \D. A. Wolfram. "Solving Generalized Fibonacci Recurrences". The Fibonacci Quarterly 36 (1998) 129-145.

.. [vHP2012] \M. van Hoeij and V. Pal. "Isomorphisms of algebraic number fields". Journal de Théorie des Nombres de Bordeaux, Vol. 24, No. 2 (2012), pp. 293-305. https://doi.org/10.2307/43973105

.. [vdH1995] \J. van der Hoeven, "Automatic numerical expansions". Proc. of the conference Real numbers and computers (1995), 261-274. https://www.texmacs.org/joris/ane/ane-abs.html
Expand Down
10 changes: 10 additions & 0 deletions doc/source/ca.rst
Original file line number Diff line number Diff line change
Expand Up @@ -349,6 +349,16 @@ Special values
Sets *res* to Euler's constant `\gamma`. This creates an element
of the (transcendental?) number field `\mathbb{Q}(\gamma)`.

.. function:: void ca_tribonacci_constant(ca_t res, ca_ctx_t ctx)

Sets *res* to the Tribonacci constant `T_c`. This creates an element
of the algebraic number field `\mathbb{Q}(T_c)`.

.. function:: void ca_tetranacci_constant(ca_t res, ca_ctx_t ctx)

Sets *res* to the Tetranacci constant `T_t`. This creates an element
of the algebraic number field `\mathbb{Q}(T_t)`.

.. function:: void ca_unknown(ca_t res, ca_ctx_t ctx)

Sets *res* to the meta-value *Unknown*.
Expand Down
8 changes: 8 additions & 0 deletions doc/source/fexpr_builtin.rst
Original file line number Diff line number Diff line change
Expand Up @@ -326,6 +326,14 @@ Particular numbers

``GoldenRatio`` is the golden ratio `\varphi`.

.. macro:: TribonacciConstant

``TribonacciConstant`` is the Tribonacci constant `T_c`.

.. macro:: TetranacciConstant

``TetranacciConstant`` is the Tetranacci constant `T_t`.

.. macro:: Euler

``Euler`` is Euler's constant `\gamma`.
Expand Down
10 changes: 9 additions & 1 deletion doc/source/qqbar.rst
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,14 @@ Special values

Sets *res* to the golden ratio `\varphi = \tfrac{1}{2}(\sqrt{5} + 1)`.

.. function:: void qqbar_tribonacci_constant(qqbar_t res)

Sets *res* to the Tribonacci constant `T_c = \tfrac{1}{3}(1 + \sqrt[3]{19 + 3\sqrt{33}} + \sqrt[3]{19 - 3\sqrt{33}})`.

.. function:: void qqbar_tetranacci_constant(qqbar_t res)

Sets *res* to the Tetranacci constant `T_t`.

Input and output
-------------------------------------------------------------------------------

Expand Down Expand Up @@ -811,7 +819,7 @@ Symbolic expressions and conversion to radicals
* Arithmetic operations with algebraic operands
* Square roots of algebraic numbers
* Powers with algebraic base and exponent an explicit rational number
* NumberI, GoldenRatio, RootOfUnity
* NumberI, GoldenRatio, TribonacciConstant, TetranacciConstant, RootOfUnity
* Floor, Ceil, Abs, Sign, Csgn, Conjugate, Re, Im, Max, Min
* Trigonometric functions with argument an explicit rational number times Pi
* Exponentials with argument an explicit rational number times Pi * NumberI
Expand Down
64 changes: 64 additions & 0 deletions examples/tetranacci.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
/* This file is public domain. Author: Raoul Bourquin. */

#include "ca.h"


void main_fexpr()
{
fexpr_t T;
fexpr_init(T);

flint_printf("Evaluating Tt as fexpr:\n");

fexpr_set_symbol_str(T, "TetranacciConstant");

fexpr_print(T);
printf("\n\n");

fexpr_clear(T);
}


void main_ca()
{
ca_ctx_t ctx;
ca_t T;
ca_ctx_init(ctx);
ca_init(T, ctx);

flint_printf("Evaluating Tt as ca:\n");

ca_tetranacci_constant(T, ctx);

ca_print(T, ctx);
printf("\n\n");

ca_clear(T, ctx);
}


void main_qqbar()
{
qqbar_t T;
qqbar_init(T);

flint_printf("Evaluating Tt as qqbar:\n");

qqbar_tetranacci_constant(T);

qqbar_printn(T, 50);
printf("\n");

qqbar_clear(T);
}


int main(int argc, char *argv[])
{
main_fexpr();
main_ca();
main_qqbar();

flint_cleanup();
return EXIT_SUCCESS;
}
64 changes: 64 additions & 0 deletions examples/tribonacci.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
/* This file is public domain. Author: Raoul Bourquin. */

#include "ca.h"


void main_fexpr()
{
fexpr_t T;
fexpr_init(T);

flint_printf("Evaluating Tc as fexpr:\n");

fexpr_set_symbol_str(T, "TribonacciConstant");

fexpr_print(T);
printf("\n\n");

fexpr_clear(T);
}


void main_ca()
{
ca_ctx_t ctx;
ca_t T;
ca_ctx_init(ctx);
ca_init(T, ctx);

flint_printf("Evaluating Tc as ca:\n");

ca_tribonacci_constant(T, ctx);

ca_print(T, ctx);
printf("\n\n");

ca_clear(T, ctx);
}


void main_qqbar()
{
qqbar_t T;
qqbar_init(T);

flint_printf("Evaluating Tc as qqbar:\n");

qqbar_tribonacci_constant(T);

qqbar_printn(T, 50);
printf("\n");

qqbar_clear(T);
}


int main(int argc, char *argv[])
{
main_fexpr();
main_ca();
main_qqbar();

flint_cleanup();
return EXIT_SUCCESS;
}
Loading