Skip to content

Instantly share code, notes, and snippets.

@taroyabuki
taroyabuki / VennDiagram.m
Created December 23, 2017 13:58
I rewrote the code published in http://mathworld.wolfram.com/VennDiagram.html to work with the latest version of Mathematica.
VennDiagram[n_, ineqs_: {}] := Module[{i, r = .6, R = 1, v, x, y, f},
v = Table[Circle[r {Cos[#], Sin[#]} &[2 Pi (i - 1)/n], R], {i, n}];
{
If[ineqs == {}, {},
f = And @@ (v /. Circle[{xx_, yy_}, rr_] :> (x - xx)^2 + (y - yy)^2 < rr^2)[[ineqs]];
RegionPlot[ImplicitRegion[f,
{x, y}], Axes -> False,
DisplayFunction -> Identity][[1]]
],
v
@taroyabuki
taroyabuki / 100weightchars.md
Last active November 9, 2017 09:52
Twitterで0.5文字とカウントされる文字の一覧(参考:https://developer.twitter.com/en/docs/developer-utilities/twitter-text

� � � � � � � � �

@taroyabuki
taroyabuki / fcos.cpp
Last active June 8, 2017 15:00
(インテルCPUの)三角関数は不要 http://blog.unfindable.net/archives/8991
//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;
@taroyabuki
taroyabuki / MyCos.java
Created February 9, 2016 16:28
(インテルCPUの)三角関数は不要 http://blog.unfindable.net/archives/8991
/*
<dependencies>
<dependency>
<groupId>org.apfloat</groupId>
<artifactId>apfloat</artifactId>
<version>1.8.2</version>
</dependency>
</dependencies>
*/
import org.apfloat.*;
@taroyabuki
taroyabuki / quad.cpp
Last active February 8, 2016 12:55
(インテルCPUの)三角関数は不要 http://blog.unfindable.net/archives/8991
//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;
@taroyabuki
taroyabuki / cuda-cos-vs-fcos.cu
Last active February 8, 2016 12:55
(インテルCPUの)三角関数は不要 http://blog.unfindable.net/archives/8991
//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>
@taroyabuki
taroyabuki / cuda-cos.cu
Last active February 8, 2016 12:55
(インテルCPUの)三角関数は不要 http://blog.unfindable.net/archives/8991
//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>
@taroyabuki
taroyabuki / hello-2.w
Last active December 19, 2015 05:59
Literate Programming
@*The first C program.
``\.{hello, world!}''と出力するC言語のプログラムは以下のとおり。
@c
@<Header files to include@>@/
@<The main program@>
@ 標準入出力のためのライブラリを利用するようにコンパイラに指示する。
@taroyabuki
taroyabuki / hello-1.w
Last active December 19, 2015 05:59
Literate Programming
@ hello, world! と出力するC言語のプログラムは以下のとおり。
@c
@<Header files to include@>@/
@<The main program@>
@ 標準入出力のためのライブラリを利用するようにコンパイラに指示する。
@<Header files to include@>=
#include <stdio.h>
@taroyabuki
taroyabuki / hello-0.w
Last active December 19, 2015 05:59
Literate Programming
@ hello, world! と出力するC言語のプログラムは以下のとおり。
@c
#include <stdio.h>
main()
{
printf("hello, world\n");
}