Skip to content

Instantly share code, notes, and snippets.

def integrand(t, q, f_args)
g = 9.80665
theta1, theta2 = q[0..1]
d_theta1_dt, d_theta2_dt = q[2..3]
m_mat = N[[(m1+m2)*l1*l1, m2*l1*l2*Math.cos(theta1-theta2)],
[m2*l1*l2*Math.cos(theta1-theta2), m2*l2**2]]
vec = N[[-m2*l1*l2*(d_theta2_dt**2)*Math.sin(theta1-theta2)-(m1+m2)*g*l1*Math.sin(theta1)],
[m2*l1*l2*(d_theta1_dt**2)*Math.sin(theta1-theta2)-m2*g*l2*Math.sin(theta2)]]
const int pins[16][4] = {
{LOW,LOW,LOW,LOW},
{LOW,LOW,LOW,HIGH},
{LOW,LOW,HIGH,LOW},
{LOW,LOW,HIGH,HIGH},
{LOW,HIGH,LOW,LOW},
{LOW,HIGH,LOW,HIGH},
{LOW,HIGH,HIGH,LOW},
{LOW,HIGH,HIGH,HIGH},
{HIGH,LOW,LOW,LOW},
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@domitry
domitry / hoge.md
Last active August 29, 2015 14:12

DataFrameの開発による科学用途のgem開発の促進 中間報告

助成金の期間の内、中間報告までに以下の3つのgemにそれぞれコミットした。

Mikon

データ可視化ライブラリNyaplotのモジュールだったNyaplot::DataFrameを分離し独立したgem、Mikonとして公開した。

データストレージの切り替え

Nyaplot::DataFrameではデータストレージとしてRuby標準のArrayを使っていたが、MikonではSciRubyで開発されている多次元配列ライブラリNMatrixに切り替え高速化を図った。 これによりMikonはNMatrix v0.1.0以上に依存することとなったが、NMatrixは未だ不安定でNyaplotなど他のライブラリに依存させるには不安がある。 そこで最終報告までにNMatrixへの依存をなくした軽量版のリリースを予定している。

<html>
<head>
<script>
window.onload = function(){
var obj = {hoge: "nya", nya: {hoge: 123}};
var content = JSON.stringify(obj);
var uriContent = "data:application/json," + encodeURIComponent(content);
var newWindow=window.open(uriContent, 'hoge.json');
};
</script>
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@domitry
domitry / interact.rb
Last active August 29, 2015 14:13
Draft version of Nyaplot v2.0
require 'nyaplot'
include Nyaplot
df = DataFrame.from_csv("hoge.csv")
df1 = df.clone
p1 = Plot.add(df1, :bar, :x, :y)
p2 = Plot.add(:scatter, x, y)
.add(:filter_x)
{|min, max|
D3.selectAll("rect")
.data([{x: 1, y: 2}, {x: 3, y: 10}])
.attr("x", lambda {|d| d[:x]})
.attr("y", lambda {|d| d[:y]})
.run
#-> <# D3::Selection>
#[
# {target: "a123-23a4-b345", name: "data", args: [{x: 1, y: 2}, {x: 3, y: 10}]},
# {target: "a123-23a4-b345", name: "attr", args: [{type: "Proc", uuid: "123-456-789"}