-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathlogistic_arb.c
More file actions
59 lines (50 loc) · 1.61 KB
/
logistic_arb.c
File metadata and controls
59 lines (50 loc) · 1.61 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
//******************************************************************************
// logistic_arb.c : logistic map with Arb
// Copyright (C) 2019 Tomonori Kouya
//
// This program is free software: you can redistribute it and/or modify it
// under the terms of the GNU Lesser General Public License as published by the
// Free Software Foundation, either version 3 of the License or any later
// version.
//
// This program is distributed in the hope that it will be useful, but WITHOUT
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
// for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
//******************************************************************************
#include <stdio.h>
#include "arb.h"
int main()
{
int i;
slong prec;
arb_t x[102];
// initialize arb variables
for(i = 0; i < 102; i++)
arb_init(x[i]);
printf("prec(bits) = "); while(scanf("%ld", &prec) < 1);
// set a initial value
arb_set_str(x[0], "0.7501", prec);
for(i = 0; i <= 100; i++)
{
if((i % 10) == 0)
{
printf("%5d, ", i);
arb_printd(x[i], 17);
printf("\n");
}
//x[i + 1] = 4 * x[i] * (1 - x[i]);
arb_sub_ui(x[i + 1], x[i], 1UL, prec);
arb_neg(x[i + 1], x[i + 1]);
arb_mul(x[i + 1], x[i + 1], x[i], prec);
arb_mul_ui(x[i + 1], x[i + 1], 4UL, prec);
}
// delete arb variables
for(i = 0; i < 102; i++)
arb_clear(x[i]);
return 0;
}