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
//On Ubuntu, you need to install CUDA and: | |
//sudo apt-get install libboost-dev | |
//On Windows, I don't know the way to build this code. | |
#include <iostream> | |
#include <iomanip> | |
#include <cmath> | |
#include <cuda_runtime.h> | |
#include <boost/multiprecision/cpp_dec_float.hpp> |
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
//On Ubuntu, you need to install CUDA and: | |
//sudo apt-get install libboost-dev | |
//On Windows, I don't know the way to build this code. | |
#include <iostream> | |
#include <iomanip> | |
#include <cmath> | |
#include <cuda_runtime.h> | |
#include <boost/multiprecision/cpp_dec_float.hpp> |
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
//Pre build: sudo apt-get install libboost-dev | |
//To build: g++ quad.cpp -lquadmath | |
#include <cmath> | |
#include <ctime> | |
#include <quadmath.h> | |
#include <boost/multiprecision/cpp_dec_float.hpp> | |
using namespace std; | |
namespace mp = boost::multiprecision; |
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
//On Ubuntu, you need: | |
//sudo apt-get install libboost-dev | |
#include <iostream> | |
#include <cmath> | |
#include <ctime> | |
#include <boost/multiprecision/cpp_bin_float.hpp> | |
using namespace std; | |
using namespace boost::multiprecision; |
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
960939379918958884971672962127852754715004339660129306651505519271702802395266424689642842174350718121267153782770623355993237280874144307891325963941337723487857735749823926629715517173716995165232890538221612403238855866184013235585136048828693337902491454229288667081096184496091705183454067827731551705405381627380967602565625016981482083418783163849115590225610003652351370343874461848378737238198224849863465033159410054974700593138339226497249461751545728366702369745461014655997933798537483143786841806593422227898388722980000748404719 |
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
factor[n_] := Reverse[Flatten[ | |
Map[Table[#[[1]], {#[[2]]}] &, FactorInteger[n]]]] | |
On[Assert]; | |
Assert[factor[24] == {3, 2, 2, 2}]; | |
draw[origin_, frame_, delta_, {p_, rest___}, start_] := { | |
Circle[origin, frame], | |
With[{r = If[p == 1, 1, frame Sin[Pi/p]/(1 + Sin[Pi/p])]}, | |
Table[ |
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
roll = 10; | |
surface[s_, t_] := | |
RotationMatrix[s, {0, 0, 1}].{3 + t Cos[t]/(roll Pi), 0, t Sin[t]/(roll Pi)} | |
donut[t_] := | |
ParametricPlot3D[surface[s, u], {s, 0, 2 Pi}, {u, 0, t}, | |
Axes -> False, Boxed -> False, Mesh -> None, PlotPoints -> 40] | |
bugs[t_, n_] := |
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
//Are Toy Problems Useful? | |
//in Selected Papers on Computer Science by Knuth (p.172) | |
#include <iostream> | |
#include <sstream> | |
#include <iomanip> | |
#include <vector> | |
#include <set> | |
#include <unordered_map> // faster than map | |
#include <algorithm> |
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
\documentclass[a4paper]{jsarticle} | |
\usepackage[top=5mm,right=0mm,bottom=0mm,left=4mm]{geometry} | |
\usepackage{otf} | |
\usepackage{color} | |
\usepackage{pgffor} | |
\pagestyle{empty} | |
\openup -0.2mm | |
\newlength{\unit} | |
\setlength\unit{1.4mm} | |
\newcount \i |
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
Manipulate[MandelbrotSetPlot[ | |
{center[[1]] - 10^scale + I (center[[2]] - 10^scale), | |
center[[1]] + 10^scale + I (center[[2]] + 10^scale)}, | |
MaxIterations -> iterations], | |
{{center, {-0.5, 0}}, Locator}, | |
{{scale, 0, "Scale"}, -9, 1}, | |
{{iterations, 20, "MaxIterations"}, 10, 2000, 10}] |