Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- documentclass{article}
- usepackage{pgfplots}
- begin{document}
- begin{tikzpicture}
- begin{axis}[xmin=0, xmax=30, ymin=2, ymax=3]
- addplot[samples at={1,2,...,30}, only marks] expression {<Add Fibonacci sequence here>};
- end{axis}
- end{tikzpicture}
- end{document}
- documentclass[tikz,border=3.14mm]{standalone}
- usetikzlibrary{math}
- begin{document}
- tikzmath{
- % Adapted from http://www.cs.northwestern.edu/academics/courses/110/html/fib_rec.html
- function fibonacci(n) {
- if n == 0 then {
- return 0;
- } else {
- return fibonacci2(n, 0, 1);
- }; };
- function fibonacci2(n, p, q) {
- if n == 1 then {
- return q;
- } else {
- return fibonacci2(n-1, q, p+q);
- };
- };
- }
- begin{tikzpicture}
- foreach X in {0,1,...,8}{
- node[circle,fill,label=above:{pgfmathparse{int(fibonacci(X))}
- pgfmathresult}] at (X,{fibonacci(X)}) {};}
- end{tikzpicture}
- end{document}
- documentclass[tikz,border=7pt]{standalone}
- begin{document}
- tikz
- foreach[
- remember=g as h (initially 1),
- remember=f as g (initially 0),
- evaluate=f using int(g+h)
- ] n in {1,...,7}
- fill[green,draw=black] (n,0) rectangle +(1,f) node[black,scale=2,above left]{f};
- end{document}
- documentclass[tikz,border=7pt]{standalone}
- usepackage{xintexpr}
- begin{document}
- begin{tikzpicture}[xscale=.35]
- foreach[
- remember=g as h (initially 1),
- remember=f as g (initially 0)
- ] n in{1,...,30}{
- edeff{thexintexpr g + h relax}
- edefff{thexintfloatexpr f/10000 relax}
- fill[green,draw=black] (n,0) rectangle +(1,ff);
- }
- end{tikzpicture}
- end{document}
Add Comment
Please, Sign In to add comment