Fractals/mandelbrot-symbolics

From Wikibooks, open books for an open world
Jump to navigation Jump to search

Install[edit]

"you need to "make install" mandelbrot-symbolics lib before trying anything with mandelbrot-numerics"

Dependencies[edit]

#include <stdbool.h>
#include <stdlib.h>
#include <gmp.h>
#include <pari/pari.h>
 gcc -shared -ggdb  -std=c99 -Wall -Wextra -pedantic -fPIC -O3 -pipe -ggdb -MMD -I../include -c  -lpari -lmpc -lmpfr -lgmp -lm

clone[edit]

git clone https://code.mathr.co.uk/mandelbrot-symbolics.git

next[edit]

To install library to local prefix ~/opt/lib ~/opt/bin and so on:

make -C mandelbrot-symbolics/c/lib prefix=${HOME}/opt install
make -C mandelbrot-symbolics/c/bin prefix=${HOME}/opt install

then to run do:

 export LD_LIBRARY_PATH=${HOME}/opt/lib

check :

echo $LD_LIBRARY_PATH

result :

 /home/a/opt/lib

or

 export PATH=${HOME}/opt/bin:${PATH}

check :

  echo $PATH

then the programs can be run like

 m-binangle-from-rational 1/2

no manual path specification necessary

To set it permanently change file .profile[1]

update[edit]

git[edit]

From console opened in the mandelbrot-numerics directory :

 git pull

If you made some local changes you can undu them :

 git checkout -f

then

 git pull

Now install again

How to use[edit]

binaries[edit]

m-binangle-from-rational[edit]

from console :

 ./m-binangle-from-rational 1/2

result

  .1(0)
 ./m-binangle-from-rational 7/96
 .00010(01)


 ./m-binangle-from-rational 33877456965431938318210482471113262183356704085033125021829876006886584214655562/237142198758023568227473377297792835283496928595231875152809132048206089502588927
 .(001001001001001001001001001001001001001001001001001001001001001001001001001001001001001001001001001001001001001001001001001001001001001001001001001001001001001001001001001001001001001001001001001001001001001001001001001001001001001001001001001001001001001001001001010)

m-binangle-to-rational[edit]

from console

 ./m-binangle-to-rational ".(001)"

result :

 1/7

Note that the input format isn't checked, so bad input can give bad output !

Examples :

./m-binangle-to-rational

gives nothing:

  • no output
  • no errors
 ./m-binangle-to-rational 0.(001001001001001001001001001001001001001001001001001001001001001001001001010)

gives bash error :

 bash: błąd składni przy nieoczekiwanym znaczniku `('
./m-binangle-to-rational "0.(001001001001001001001001001001001001001001001001001001001001001001001001010)"

gives floating point error

 Błąd w obliczeniach zmiennoprzecinkowych
./m-binangle-to-rational ".(001001001001001001001001001001001001001001001001001001001001001001001001010)"

Result:

 5396990266136737387082/37778931862957161709567
 ./m-binangle-to-rational ".(001001001001001001001001001001001001001001001001001001001001001001001010001)"
 5396990266136737387089/37778931862957161709567

Bugs :

  • "bug in the parsing of binary angles, it doesn't check for valid input, and bad input can give garbage values. "

www[edit]

Code[edit]

References[edit]