Jump to content

Fractals/mandelbrot-symbolics

From Wikibooks, open books for an open world

Libraries by Claude Heiland-Allen


Install

[edit | edit source]

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

Dependencies

[edit | edit source]


  pkg-config --version


#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 | edit source]
git clone https://code.mathr.co.uk/mandelbrot-symbolics.git

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]

sudo gedit ~/.profile

update

[edit | edit source]

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 | edit source]

binaries

[edit | edit source]
  • m-binangle-to-rational
  • m-binangle-from-rational
  • m-tipsy
  • m-conjugate

m-binangle-from-rational

[edit | edit source]

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 | edit source]

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. "

References

[edit | edit source]