ONLY DO WHAT ONLY YOU CAN DO

こけたら立ちなはれ 立ったら歩きなはれ

2013-11-01から1ヶ月間の記事一覧

Clojure で 連分数展開を使って π を求める

πの求め方 こう書いてもおk ;自作の逆正接関数 (defn myAtan [x x2 n t] (def m (quot n 2)) (def denom (/ (* (* m m) x2) (+ n t))) (def nume (- n 2)) (if (<= nume 1) (/ x (+ 1 denom)) (myAtan x x2 nume denom))) (doseq [degree (map #(- (* % 15)…

Haskell で 連分数展開を使って π を求める

πの求め方 こう書いてもおk import Text.Printf import Control.Monad -- 自作の逆正接関数 myAtan::Double->Double->Int->Double->Double myAtan x x2 n t = let m = (fromIntegral (n `div` 2)) denom = (m * m * x2) / ((fromIntegral n) + t) num = n -…

C# で 連分数展開を使って π を求める

πの求め方 こう書いてもおk using System; public class CS0512 { public static void Main() { for (int i = 11; i <= 31; i += 2) { double radian = 1; double x2 = radian * radian; // 自作の逆正接関数 double d1 = myAtan(radian, x2, i, 0.0); // i…

Objective-C で 積分(台形則)して π を求める

πの求め方 積分(台形則) #import <Foundation/Foundation.h> #import <math.h> double f(double x) { return 4 / (1 + x * x); } int main() { const double a = 0; const double b = 1; // 台形則で積分 int n = 2; int i, j; for (j = 1; j <= 10; j++) { double h = (b - a) / n; double s </math.h></foundation/foundation.h>…

Java で 積分(台形則)して π を求める

πの求め方 積分(台形則) public class Java0601 { public static void main(String []args) { final double a = 0; final double b = 1; // 台形則で積分 int n = 2; for (int j = 1; j <= 10; j++) { double h = (b - a) / n; double s = 0; double x = a; …

C# で 積分(台形則)して π を求める

πの求め方 積分(台形則) using System; public class CS0601 { public static void Main() { const double a = 0; const double b = 1; // 台形則で積分 int n = 2; for (int j = 1; j <= 10; j++) { double h = (b - a) / n; double s = 0; double x = a; f…

D言語で 積分(台形則)して π を求める

πの求め方 積分(台形則) import std.stdio; import std.math; void main(string[] args) { const double a = 0; const double b = 1; // 台形則で積分 int n = 2; for (int j = 1; j <= 10; j++) { double h = (b - a) / n; double s = 0; double x = a; for…

Go言語で 積分(台形則)して π を求める

πの求め方 積分(台形則) package main import "fmt" import "math" func main() { const a = 0 const b = 1 // 台形則で積分 var n int = 2 for j := 1; j <= 10; j++ { var h float64 = (b - a) / float64(n) var s float64 = 0 var x float64 = a for i :=…

Dart に printf はないのんか?

"TRY DART!" というページを見つけました。 Dartの環境を作らなくても Online で、試せます。 http://try.dartlang.org/以前紹介した、CompileOnline でも、Dart を試せますが。 http://www.compileonline.com/execute_dart_online.phpで、"Dart API Referen…

Access で 画面の全項目の定義を出力

Dim fs: Set fs = CreateObject("Scripting.FileSystemObject") Dim tso: Set tso = fs.OpenTextFile("C:\xxx\AllFormsControls.txt", 2, True) Dim ct As DAO.Container For Each ct In CurrentDb.Containers If ct.Name = "Forms" Then Dim doc As DAO.Doc…

Access で 帳票の全項目の定義を出力

Dim fs: Set fs = CreateObject("Scripting.FileSystemObject") Dim tso: Set tso = fs.OpenTextFile("C:\xxx\AllReportsControls.txt", 2, True) Dim ct As DAO.Container For Each ct In CurrentDb.Containers If ct.Name = "Reports" Then Dim doc As DAO…

Amazon Top100 入り

さまざまな言語で数値計算 第1巻 級数展開・連分数展開作者: 山岡直樹出版社/メーカー: ForNext発売日: 2013/11/01メディア: Kindle版この商品を含むブログ (5件) を見る

ようやく出版

さまざまな言語で数値計算 第1巻 級数展開・連分数展開作者: 山岡直樹出版社/メーカー: ForNext発売日: 2013/11/01メディア: Kindle版この商品を含むブログ (5件) を見るプレビューしてみたらレイアウトがガタガタで悲しい...こちらが、calibre で mobi に…