Skip to content

Commit 4bfa911

Browse files
author
Raoul Bourquin
committed
Implement Tetranacci constant in ca
Note: Represent ca_tetranacci_constant in Q(a) where a^4-a^3-a^2-a-1 = 0.
1 parent 1dc606c commit 4bfa911

File tree

4 files changed

+34
-0
lines changed

4 files changed

+34
-0
lines changed

doc/source/ca.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -349,6 +349,11 @@ Special values
349349
Sets *res* to Euler's constant `\gamma`. This creates an element
350350
of the (transcendental?) number field `\mathbb{Q}(\gamma)`.
351351

352+
.. function:: void ca_tetranacci_constant(ca_t res, ca_ctx_t ctx)
353+
354+
Sets *res* to the Tetranacci constant `T_t`. This creates an element
355+
of the algebraic number field `\mathbb{Q}(T_t)`.
356+
352357
.. function:: void ca_unknown(ca_t res, ca_ctx_t ctx)
353358

354359
Sets *res* to the meta-value *Unknown*.

src/ca.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -314,6 +314,8 @@ void ca_pi(ca_t res, ca_ctx_t ctx);
314314
void ca_pi_i(ca_t res, ca_ctx_t ctx);
315315
void ca_euler(ca_t res, ca_ctx_t ctx);
316316

317+
void ca_tetranacci_constant(ca_t res, ca_ctx_t ctx);
318+
317319
void ca_unknown(ca_t x, ca_ctx_t ctx);
318320

319321
void ca_undefined(ca_t x, ca_ctx_t ctx);

src/ca/set_fexpr.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,9 @@ _ca_set_fexpr(ca_t res, fexpr_vec_t inputs, ca_vec_t outputs, const fexpr_t expr
7979
ca_add_ui(res, res, 1, ctx);
8080
ca_div_ui(res, res, 2, ctx);
8181
return 1;
82+
case FEXPR_TetranacciConstant:
83+
ca_tetranacci_constant(res, ctx);
84+
return 1;
8285
case FEXPR_Infinity:
8386
ca_pos_inf(res, ctx);
8487
return 1;

src/ca/tetranacci.c

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
/*
2+
Copyright (C) 2022 Raoul Bourquin
3+
4+
This file is part of Calcium.
5+
6+
Calcium is free software: you can redistribute it and/or modify it under
7+
the terms of the GNU Lesser General Public License (LGPL) as published
8+
by the Free Software Foundation; either version 2.1 of the License, or
9+
(at your option) any later version. See <http://www.gnu.org/licenses/>.
10+
*/
11+
12+
#include "ca.h"
13+
14+
void
15+
ca_tetranacci_constant(ca_t res, ca_ctx_t ctx)
16+
{
17+
qqbar_t tc;
18+
qqbar_init(tc);
19+
qqbar_tetranacci_constant(tc);
20+
21+
ca_set_qqbar(res, tc, ctx);
22+
23+
qqbar_clear(tc);
24+
}

0 commit comments

Comments
 (0)