Esempio n. 1
0
void gtmiso(gsl_matrix_complex * Tiso, gsl_complex eiso, double k0, double eta, double diso)
{
	double eta2 = pow(eta,2);
	gsl_complex rb = gsl_complex_rect(eta2,0);

	gsl_complex za = gsl_complex_sub_real(eiso,eta2);
	gsl_complex qiso = gsl_complex_sqrt(za);
	gsl_complex zb = gsl_complex_mul_real(qiso,k0);
	gsl_complex zc = gsl_complex_mul_real(zb,diso);
	gsl_complex zd = gsl_complex_div(rb,eiso);

	gsl_complex carg = gsl_complex_cos(zc);
	gsl_complex sarg = gsl_complex_sin(zc);

	gsl_complex i = gsl_complex_rect(0,1);
	gsl_complex one = gsl_complex_rect(1,0);

	gsl_matrix_complex_set_zero(Tiso);

	gsl_matrix_complex_set(Tiso,0,0,carg);
	gsl_matrix_complex_set(Tiso,1,1,carg);
	gsl_matrix_complex_set(Tiso,2,2,carg);
	gsl_matrix_complex_set(Tiso,3,3,carg);

	gsl_complex zd1 = gsl_complex_sub(one,zd);
	gsl_complex zd2 = eiso;
	gsl_complex zd3 = one;
	gsl_complex zd4 = gsl_complex_sub_real(eiso,eta2);

	gsl_complex zmult1 = gsl_complex_mul(zd1,i);
	gsl_complex zmult2 = gsl_complex_mul(zd2,i);
	gsl_complex zmult3 = gsl_complex_mul(zd3,i);
	gsl_complex zmult4 = gsl_complex_mul(zd4,i);

	gsl_complex zdiv1 = gsl_complex_div(zmult1,qiso);
	gsl_complex zdiv2 = gsl_complex_div(zmult2,qiso);
	gsl_complex zdiv3 = gsl_complex_div(zmult3,qiso);
	gsl_complex zdiv4 = gsl_complex_div(zmult4,qiso);

	gsl_complex zmult5 = gsl_complex_mul(zdiv1,sarg);
	gsl_complex zmult6 = gsl_complex_mul(zdiv2,sarg);
	gsl_complex zmult7 = gsl_complex_mul(zdiv3,sarg);
	gsl_complex zmult8 = gsl_complex_mul(zdiv4,sarg);

	gsl_matrix_complex_set(Tiso,0,1,zmult5);
	gsl_matrix_complex_set(Tiso,1,0,zmult6);
	gsl_matrix_complex_set(Tiso,2,3,zmult7);
	gsl_matrix_complex_set(Tiso,3,2,zmult8);

}
Esempio n. 2
0
gsl_complex theta1(gsl_complex z, gsl_complex q, gsl_complex q14)
{
  int n=0;
  gsl_complex accum = gsl_complex_rect(0.0,0.0);
  gsl_complex q2 = gsl_complex_mul(q,q);
  gsl_complex nextm = gsl_complex_negative(q2);
  gsl_complex qpower = gsl_complex_rect(1.0,0.0);
  gsl_complex term = gsl_complex_rect(1.0,0.0);

  while ((gsl_complex_abs(term) > 2.0*GSL_DBL_EPSILON) && (n < THETA_ITER_MAX)) {
    term = gsl_complex_mul(qpower, gsl_complex_sin(gsl_complex_mul_real(z,2*n+1)));
    accum = gsl_complex_add(accum, term);
    qpower = gsl_complex_mul(qpower, nextm);
    nextm = gsl_complex_mul(nextm, q2);
    n++;
  }
  if (n >= THETA_ITER_MAX)
    return(gsl_complex_rect(0.0,0.0));
  return gsl_complex_mul_real(gsl_complex_mul(q14,accum),2.0);
}
Esempio n. 3
0
gsl_complex gsl_complex_csc(gsl_complex a)
{				/* z = csc(a) */
    gsl_complex z = gsl_complex_sin(a);
    return gsl_complex_inverse(z);
}
Esempio n. 4
0
 /** Sine
 \ingroup complex
 \param[in] z Complex number
 \return \f$ \sin z \f$*/
 complex sin(const complex& z)
 {
   return complex(gsl_complex_sin(z.as_gsl_type()));
 }