LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 05-09-2005, 10:32 AM   #1
darknails
Member
 
Registered: Jul 2004
Location: Germany
Distribution: Debian
Posts: 46

Rep: Reputation: 15
gsl_sf_coulomb_wave_FG_e in gsl library


Hi,
I'm trying to test the function gsl_sf_coulomb_wave_FG_e and I want to
reproduce the result from gsl_sf_hydrogenicR using this function, but
I can't:

Command:
Code:
$ c++ -o run run.cc -lm -lgsl -lgslcblas
$ run
1.1     0.349982        0.183584
1.2     0.243029        0.155227
1.3     0.136783        0.1292
1.4     0.032991        0.105342
1.5     -0.0669617      0.0835034
1.6     -0.161994       0.0635447
1.7     -0.251279       0.0453342
1.8     -0.334207       0.0287488
1.9     -0.41035        0.0136734
2       -0.479431       -1.15521e-16
The program is below:

Code:
// calculate Rydberg wavefunction with given quantum defect.
#include <iostream>
#include <cmath>
#include <fstream>
#include <gsl/gsl_sf_coulomb.h>

using namespace std;

int main(void)
{
 double eta,x,L;
 int k=0;
 gsl_sf_result F,Fp,G,Gp,C_L;
 double exp_F,exp_G;
 double F_L,G_L;

 double kk,KE;
 double z1=1.0;
 double z2=-1.0;
 double wavefunc;

 int n=2;
 double r = 1.0;

 int imax = 10;
 double dr = 0.1;

 for( int i=0; i < 10 ; i++){
   r += dr;

   KE = -1.0/(2.0*n*n)+1.0/r;    //kinetic enegry
   kk = sqrt( 2.0*KE );             //impulse
   eta = z1*z2/kk;                   //conversion of variables
   x = kk*r;                            //conversion of variables

   int status1 = gsl_sf_coulomb_wave_FG_e (eta, x, L, k, &F, &Fp, &G, &Gp, &exp_F, &exp_G);

   int status2 = gsl_sf_coulomb_CL_e (L, eta, &C_L);

   F_L = F.val * exp(exp_F);
   G_L = G.val * exp(exp_G);

   wavefunc = C_L.val*F_L;

   double R_nl = gsl_sf_hydrogenicR ( n, (int)trunc(L), 1.0, r);

   cout << r << '\t' << wavefunc << '\t' << R_nl << endl;

 }//i-loop

 return 0;
}
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
GD Library 2.0 jacven Linux - Software 2 09-07-2005 08:05 AM
Which library? hylke Programming 15 01-03-2005 05:03 AM
adding a bulit in library to my library lg3 Linux - Software 1 10-17-2004 08:19 AM
howto compile bin with my library using all-static and shared linked standart library stpg Programming 4 06-29-2004 04:20 AM
what is the function library of the basic graphics library in rethat9.0? zerwolve Red Hat 0 04-29-2004 09:18 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 07:30 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration