Keyword: ルジャンドル形式, 第1種楕円積分
概要
本サンプルはルジャンドル形式の第1種楕円積分を求めるC#によるサンプルプログラムです。 本サンプルは以下に示される第1種楕円積分を求めて出力します。
※本サンプルはnAG Library for .NETに含まれる関数 s21be() のExampleコードです。本サンプル及び関数の詳細情報は s21be のマニュアルページをご参照ください。
ご相談やお問い合わせはこちらまで
出力結果
(本関数の詳細はs21be のマニュアルページを参照)| この出力例をダウンロード |
s21be Example Program Results
phi dm s21be ifail
0.52 0.25 0.5294 0
1.05 0.50 1.1424 0
1.57 0.75 2.1565 0
- 3〜7行目にプログラムで生成した引数Φ、mの値、第1種楕円積分の値とエラーコードが出力されています。エラーコード"0"はエラーがなかったことを意味します。
ソースコード
(本関数の詳細はs21be のマニュアルページを参照)
※本サンプルソースコードは .NET環境用の科学技術・統計計算ライブラリである「nAG Library for .NET」の関数を呼び出します。
サンプルのコンパイル及び実行方法
| このソースコードをダウンロード |
// s21be Example Program Text
// C# version, nAG Copyright 2008
using System;
using NagLibrary;
namespace NagDotNetExamples
{
public class S21BEE
{
static void Main(String[] args)
{
StartExample();
}
public static void StartExample()
{
try
{
PrintManager.Warning = new PrintManager.MessageLogger(discardmessage);
double dm, f, phi, pi; int ix;
int ifail;
Console.WriteLine("s21be Example Program Results");
Console.WriteLine("");
Console.WriteLine(" {0}", " phi dm s21be ifail");
Console.WriteLine("");
//
pi = X01.x01aa();
//
for (ix = 1; ix <= 3; ix++)
{
phi = ix * pi / 6.00e0;
dm = ix * 0.250e0;
//
f = S.s21be(phi, dm, out ifail);
//
if (ifail >= 0)
{
Console.WriteLine(" {0,7:f2}{1,7:f2}{2,12:f4}{3,5}", phi, dm, f, ifail);
}
else
{
Console.WriteLine("** s21be failed with ifail = {0,5}", ifail);
}
}
//
}
catch (Exception e)
{
Console.WriteLine(e.Message);
Console.WriteLine("Exception Raised");
}
}
static void discardmessage(String message)
{
}
}
}
