-
Notifications
You must be signed in to change notification settings - Fork 249
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Simple example program computing the golden ratio
- Loading branch information
Raoul Bourquin
committed
May 26, 2023
1 parent
46762a1
commit aca86fe
Showing
1 changed file
with
65 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
/* This file is public domain. Author: Raoul Bourquin. */ | ||
|
||
#include <stdlib.h> | ||
#include "ca.h" | ||
|
||
|
||
void main_fexpr() | ||
{ | ||
fexpr_t Phi; | ||
fexpr_init(Phi); | ||
|
||
flint_printf("Evaluating Phi as fexpr:\n"); | ||
|
||
fexpr_set_symbol_str(Phi, "GoldenRatio"); | ||
|
||
fexpr_print(Phi); | ||
printf("\n\n"); | ||
|
||
fexpr_clear(Phi); | ||
} | ||
|
||
|
||
void main_ca() | ||
{ | ||
ca_ctx_t ctx; | ||
ca_t Phi; | ||
ca_ctx_init(ctx); | ||
ca_init(Phi, ctx); | ||
|
||
flint_printf("Evaluating Phi as ca:\n"); | ||
|
||
ca_phi(Phi, ctx); | ||
|
||
ca_print(Phi, ctx); | ||
printf("\n\n"); | ||
|
||
ca_clear(Phi, ctx); | ||
} | ||
|
||
|
||
void main_qqbar() | ||
{ | ||
qqbar_t Phi; | ||
qqbar_init(Phi); | ||
|
||
flint_printf("Evaluating Phi as qqbar:\n"); | ||
|
||
qqbar_phi(Phi); | ||
|
||
qqbar_printn(Phi, 50); | ||
printf("\n"); | ||
|
||
qqbar_clear(Phi); | ||
} | ||
|
||
|
||
int main(int argc, char *argv[]) | ||
{ | ||
main_fexpr(); | ||
main_ca(); | ||
main_qqbar(); | ||
|
||
flint_cleanup(); | ||
return EXIT_SUCCESS; | ||
} |