⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 zeroj.cpp

📁 c++的数学物理方程数值算法源程序。这是"Numerical Methods for Physics"第二版的源程序。
💻 CPP
字号:
#include "NumMeth.h"

void bess( int m_max, double x, Matrix& jj ) ;

double zeroj( int m_order, int n_zero) {// Zeros of the Bessel function J(x)// Inputs//   m_order   Order of the Bessel function//   n_zero    Index of the zero (first, second, etc.)// Output//   z         The "n_zero"th zero of the Bessel function  //* Use asymtotic formula for initial guess  double beta = (n_zero + 0.5*m_order - 0.25)*(3.141592654);  double mu = 4*m_order*m_order;  double beta8 = 8*beta;  double z = beta - (mu-1)/beta8              - 4*(mu-1)*(7*mu-31)/(3*beta8*beta8*beta8);  //* Use Newton's method to locate the root  Matrix jj(m_order+2); 
  int i;  double deriv;  for( i=1; i<=5; i++ ) {    bess( m_order+1, z, jj );  // Remember j(1) is J_0(z)         // Use the recursion relation to evaluate derivative    deriv = -jj(m_order+2) + m_order/z * jj(m_order+1);    z -= jj(m_order+1)/deriv;  // Newton's root finding    }  return(z);}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -