예제 #1
0
double annihilation_total(double E)
{
	const gsl_integration_glfixed_table *gl_table;
	gl_table = gsl_integration_glfixed_table_alloc(pts);
	gsl_function F;
	F.function = &annihilation;
	F.params = (void*) &E;

	return gsl_integration_glfixed (&F, 0.0, M_PI, gl_table);
}
예제 #2
0
static VALUE rb_gsl_integration_glfixed(VALUE obj, VALUE aa, VALUE bb, VALUE tt)
{
  gsl_function *f;
  double a, b;
  gsl_integration_glfixed_table *t;
  double res;
  if (!rb_obj_is_kind_of(tt, cgsl_integration_glfixed_table)) {
    rb_raise(rb_eTypeError, "Wrong arugment type (%s for GSL::Integration::Glfixed_table)",
             rb_class2name(CLASS_OF(tt)));
  }
  Data_Get_Struct(tt, gsl_integration_glfixed_table, t);
  a = NUM2DBL(aa);
  b = NUM2DBL(bb);
  Data_Get_Struct(obj, gsl_function, f);
  res = gsl_integration_glfixed(f, a, b, t);
  return rb_float_new(res);
}