跳转到内容

分形/mandelbrot-symbolics

来自维基教科书,开放的世界开放的书籍

库由 Claude Heiland-Allen 提供


"你需要在尝试任何与 mandelbrot-numerics 相关的事情之前,先 "make install" mandelbrot-symbolics lib"

依赖项

[编辑 | 编辑源代码]


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

下一步

[编辑 | 编辑源代码]

要将库安装到本地前缀 ~/opt/lib ~/opt/bin 等

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

然后运行

 export LD_LIBRARY_PATH=${HOME}/opt/lib

检查 

echo $LD_LIBRARY_PATH

结果 

 /home/a/opt/lib

或者

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

检查 

  echo $PATH

然后程序可以像这样运行

 m-binangle-from-rational 1/2

无需手动指定路径

要永久设置它,更改文件 .profile[1]

sudo gedit ~/.profile

从 mandelbrot-numerics 目录中打开的控制台 

 git pull

如果你做了一些本地更改,你可以撤销它们 

 git checkout -f

然后

 git pull

现在再次安装

如何使用

[编辑 | 编辑源代码]

二进制文件

[编辑 | 编辑源代码]
  • m-binangle-to-rational
  • m-binangle-from-rational
  • m-tipsy
  • m-conjugate

m-binangle-from-rational

[编辑 | 编辑源代码]

从控制台 

 m-binangle-from-rational 1/2

结果

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


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

m-binangle-to-rational

[编辑 | 编辑源代码]

从控制台

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

结果 

 1/7

请注意,输入格式没有被检查,因此错误的输入可能会导致错误的输出 !

例子 

./m-binangle-to-rational

什么也不显示

  • 无输出
  • 无错误
 ./m-binangle-to-rational 0.(001001001001001001001001001001001001001001001001001001001001001001001001010)

显示 bash 错误 

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

显示浮点错误

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

结果

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

错误 

  • "二进制角度解析中的错误,它没有检查有效输入,错误的输入可能会导致垃圾值。"

参考文献

[编辑 | 编辑源代码]
华夏公益教科书