/*------------------------------------------------------------------------------------
ローレンツ方程式のリアプノフスペクトラムの計算
calculating the Lyapunov spectrum of the Lorenz equations
dx/dt = SIGMA * (y - x)
dy/dt = -y - x * z + R * x
dz/dt = x * y - B * z
lorenz_lyap.h
------------------------------------------------------------------------------------*/
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#define ITERATION 10000000
#define SKIP 100000
#define DELTA_T 0.001 /* step size of the fourth-order Runge-Kutta method */
// 初期値
// initial values
#define X0 1.00
#define Y0 1.01
#define Z0 1.02
/*------------------------------------------------------*/
/* Wolf */
/*
#define SIGMA 16.0
#define RR 45.92
#define B 4.0
*/
/* Lyapunov spectrum (log with base-e) 1.50, 0, -22.46 */
/*------------------------------------------------------*/
/* Lorenz */
#define SIGMA 10.0
#define RR 28.0
#define B 8.0/3.0
/* Lyapunov spectrum (log with base-e) 0.90563, 0, -14.57219 */
/*------------------------------------------------------*/
/* Shimada and Nagashima */
/*
#define SIGMA 16.0
#define RR 40.0
#define B 4.0
*/
/* Lyapunov spectrum (log with base-e) 1.37, 0, -22.37 */
/*------------------------------------------------------------------------*/
// 変数の数
// number of variables
#define DIM 3
/*------------------------------------------------------------------------*/
extern void solve_lorenz_eqs_using_RK4( double v[DIM], double dfQ[DIM][DIM], double Q[DIM][DIM] );
extern void lorenz_eqs( double v[DIM], double dfu[DIM][DIM], double dvdt[DIM], double df_k[DIM][DIM] );
extern void householder_QR_decomp( double X[DIM][DIM], double Q[DIM][DIM], double R[DIM][DIM] );
extern double calc_lyap_dim( double lambda[DIM] );
extern double log2( double x );