Keyword: ヤコビ楕円関数
概要
本サンプルはヤコビ楕円関数を求めるC言語によるサンプルプログラムです。 本サンプルは引数u、mを読み込み、以下に示されるヤコビ楕円関数を求めて出力します。
※本サンプルはnAG Cライブラリに含まれる関数 nag_real_jacobian_elliptic() のExampleコードです。本サンプル及び関数の詳細情報は nag_real_jacobian_elliptic のマニュアルページをご参照ください。
ご相談やお問い合わせはこちらまで
入力データ
(本関数の詳細はnag_real_jacobian_elliptic のマニュアルページを参照)このデータをダウンロード |
nag_real_jacobian_elliptic (s21cac) Example Program Data 0.2 0.3 5.0 -1.0 -0.5 -0.1 10.0 11.0
- 1行目はタイトル行で読み飛ばされます。
- 2〜5行目に引数u、mの値を指定しています。
出力結果
(本関数の詳細はnag_real_jacobian_elliptic のマニュアルページを参照)この出力例をダウンロード |
nag_real_jacobian_elliptic (s21cac) Example Program Results u m sn cn dn 2.000e-01 3.000e-01 1.983e-01 9.801e-01 9.941e-01 5.000e+00 -1.000e+00 -2.440e-01 9.698e-01 1.029e+00 -5.000e-01 -1.000e-01 -4.812e-01 8.766e-01 1.012e+00 1.000e+01 1.100e+01 2.512e-01 9.679e-01 5.528e-01
- 3〜6行目に引数u、mの値とヤコビ楕円関数sn、cn、dnの値が出力されています。
ソースコード
(本関数の詳細はnag_real_jacobian_elliptic のマニュアルページを参照)
※本サンプルソースコードはnAG数値計算ライブラリ(Windows, Linux, MAC等に対応)の関数を呼び出します。
サンプルのコンパイル及び実行方法
このソースコードをダウンロード |
/* nag_real_jacobian_elliptic (s21cac) Example Program. * * CLL6I261D/CLL6I261DL Version. * * Copyright 2017 Numerical Algorithms Group. * * Mark 26.1, 2017. */ #include <nag.h> #include <stdio.h> #include <nag_stdlib.h> #include <nags.h> int main(void) { Integer exit_status = 0; double u, m, sn, cn, dn; NagError fail; INIT_FAIL(fail); /* Skip heading in data file */ scanf("%*[^\n]"); printf("nag_real_jacobian_elliptic (s21cac) Example Program Results\n"); printf(" u m sn cn dn\n"); while (scanf("%lf %lf", &u, &m) != EOF) { /* nag_real_jacobian_elliptic (s21cac). * Jacobian elliptic functions sn, cn and dn of real * argument */ nag_real_jacobian_elliptic(u, m, &sn, &cn, &dn, &fail); if (fail.code != NE_NOERROR) { printf("Error from nag_real_jacobian_elliptic (s21cac).\n%s\n", fail.message); exit_status = 1; goto END; } printf("%12.3e %12.3e %12.3e %12.3e %12.3e\n", u, m, sn, cn, dn); } END: return exit_status; }