Skip to content

Instantly share code, notes, and snippets.

Taro YABUKI taroyabuki

Block or report user

Report or block taroyabuki

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@taroyabuki
taroyabuki / VennDiagram.m
Created Dec 23, 2017
I rewrote the code published in http://mathworld.wolfram.com/VennDiagram.html to work with the latest version of Mathematica.
View VennDiagram.m
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 Nov 9, 2017
Twitterで0.5文字とカウントされる文字の一覧(参考:https://developer.twitter.com/en/docs/developer-utilities/twitter-text
View 100weightchars.md

� � � � � � � � �

View four-coloring.m
map = Import["http://mathforum.org/wagon/fall97/images/5colormap.gif"];
matrix = MorphologicalComponents[map];
vars = Flatten[Map[{p[#], q[#]} &, Rest[Union[Flatten[matrix]]]]];
f[r_] := Map[If[Length[Union[#]] > 2, Sort[Select[#, Positive]], Nothing] &,
Partition[r, 4, 1]];
neighbours = Union[Flatten[Map[f, Join[matrix, Transpose[matrix]]], 1]];
@taroyabuki
taroyabuki / MyCos.java
Created Feb 9, 2016
(インテルCPUの)三角関数は不要 http://blog.unfindable.net/archives/8991
View MyCos.java
/*
<dependencies>
<dependency>
<groupId>org.apfloat</groupId>
<artifactId>apfloat</artifactId>
<version>1.8.2</version>
</dependency>
</dependencies>
*/
import org.apfloat.*;
@taroyabuki
taroyabuki / cuda-cos-vs-fcos.cu
Last active Feb 8, 2016
(インテルCPUの)三角関数は不要 http://blog.unfindable.net/archives/8991
View cuda-cos-vs-fcos.cu
//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 Feb 8, 2016
(インテルCPUの)三角関数は不要 http://blog.unfindable.net/archives/8991
View cuda-cos.cu
//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 / quad.cpp
Last active Feb 8, 2016
(インテルCPUの)三角関数は不要 http://blog.unfindable.net/archives/8991
View quad.cpp
//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 / fcos.cpp
Last active Jun 8, 2017
(インテルCPUの)三角関数は不要 http://blog.unfindable.net/archives/8991
View fcos.cpp
//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;
View tupper
960939379918958884971672962127852754715004339660129306651505519271702802395266424689642842174350718121267153782770623355993237280874144307891325963941337723487857735749823926629715517173716995165232890538221612403238855866184013235585136048828693337902491454229288667081096184496091705183454067827731551705405381627380967602565625016981482083418783163849115590225610003652351370343874461848378737238198224849863465033159410054974700593138339226497249461751545728366702369745461014655997933798537483143786841806593422227898388722980000748404719
View primefactorization.nb
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[
You can’t perform that action at this time.