scidavis  2.3.0
About: SciDAVis is a free application for Scientific Data Analysis and Visualization (a fork off of QtiPlot).
  Fossies Dox: scidavis-2.3.0.tar.gz  ("unofficial" and yet experimental doxygen-generated source code documentation)  

planck_wavelength.c File Reference
#include <gsl/gsl_vector.h>
#include <gsl/gsl_matrix.h>
#include <math.h>
Include dependency graph for planck_wavelength.c:

Go to the source code of this file.

Classes

struct  data
 

Functions

char * name ()
 
char * function ()
 
char * parameters ()
 
double function_eval (double x, double *params)
 
int function_f (const gsl_vector *params, void *void_data, gsl_vector *f)
 
int function_df (const gsl_vector *params, void *void_data, gsl_matrix *J)
 
int function_fdf (const gsl_vector *params, void *void_data, gsl_vector *f, gsl_matrix *J)
 
double function_d (const gsl_vector *params, void *void_data)
 

Function Documentation

◆ function()

char* function ( )

Definition at line 47 of file planck_wavelength.c.

47 { return "a/(x^5*(exp(b/x)-1))"; }

◆ function_d()

double function_d ( const gsl_vector *  params,
void *  void_data 
)

Definition at line 88 of file planck_wavelength.c.

89 {
90  struct data * d = (struct data*) void_data;
91  gsl_vector * f = gsl_vector_alloc(d->n);
92  double result = 0;
93  size_t i;
94 
95  function_f(params, void_data, f);
96  for (i=0; i<d->n; i++)
97  result += pow(gsl_vector_get(f, i), 2);
98 
99  gsl_vector_free(f);
100  return result;
101 }

References function_f(), and data::n.

Here is the call graph for this function:

◆ function_df()

int function_df ( const gsl_vector *  params,
void *  void_data,
gsl_matrix *  J 
)

Definition at line 67 of file planck_wavelength.c.

68 {
69  struct data * d = (struct data*) void_data;
70  double a = gsl_vector_get(params, 0);
71  double b = gsl_vector_get(params, 1);
72  size_t i;
73  for (i=0; i<d->n; i++) {
74  double x = d->X[i];
75  gsl_matrix_set(J, i, 0, 1.0/(pow(x,5)*(exp(b/x)-1.0)));
76  gsl_matrix_set(J, i, 1, a/(pow(x,3)*pow(exp(b/x)-1, 2)*exp(b/x)*b));
77  }
78  return GSL_SUCCESS;
79 }

References data::n, and data::X.

Referenced by function_fdf().

Here is the caller graph for this function:

◆ function_eval()

double function_eval ( double  x,
double *  params 
)

Definition at line 51 of file planck_wavelength.c.

52 {
53  return params[0]/(pow(x,5)*(exp(params[1]/x)-1.0));
54 }

◆ function_f()

int function_f ( const gsl_vector *  params,
void *  void_data,
gsl_vector *  f 
)

Definition at line 56 of file planck_wavelength.c.

57 {
58  struct data * d = (struct data*) void_data;
59  double a = gsl_vector_get(params, 0);
60  double b = gsl_vector_get(params, 1);
61  size_t i;
62  for (i=0; i<d->n; i++)
63  gsl_vector_set(f, i, (a/(pow(d->X[i],5)*(exp(b/d->X[i])-1.0)) - d->Y[i])/d->sigma[i]);
64  return GSL_SUCCESS;
65 }

References data::n, data::sigma, data::X, and data::Y.

Referenced by function_d(), and function_fdf().

Here is the caller graph for this function:

◆ function_fdf()

int function_fdf ( const gsl_vector *  params,
void *  void_data,
gsl_vector *  f,
gsl_matrix *  J 
)

Definition at line 81 of file planck_wavelength.c.

82 {
83  function_f(params, void_data, f);
84  function_df(params, void_data, J);
85  return GSL_SUCCESS;
86 }

References function_df(), and function_f().

Here is the call graph for this function:

◆ name()

char* name ( )

Definition at line 45 of file planck_wavelength.c.

45 { return "PlanckWavelength"; }

◆ parameters()

char* parameters ( )

Definition at line 49 of file planck_wavelength.c.

49 { return "a,b"; }
function_df
int function_df(const gsl_vector *params, void *void_data, gsl_matrix *J)
Definition: planck_wavelength.c:67
data
Definition: exp_saturation.c:37
function_f
int function_f(const gsl_vector *params, void *void_data, gsl_vector *f)
Definition: planck_wavelength.c:56
data::X
double * X
Definition: exp_saturation.c:40
data::sigma
double * sigma
Definition: exp_saturation.c:42
data::Y
double * Y
Definition: exp_saturation.c:41
data::n
size_t n
Definition: exp_saturation.c:38