The C Code that works is: double complex c_snellius_beta(double alpha_r, double alpha_im, double n_in, double k_in, double n_out, double k_out){
double complex c_alpha, N_in, N_out;
c_alpha = alpha_r + I*alpha_im;
N_in = n_in + I*k_in;
N_out = n_out + I*k_out;
return casin(N_in*csin(c_alpha)/N_out);
}
And my C++ Code is: complex<double> snellius_beta(double alpha_real, double alpha_imag, double n_in, double k_in, double n_out, double k_out){
complex<double> alpha(alpha_real,alpha_imag), N_in(n_in,k_in), N_out(n_out,k_out);
return sin(N_in*sin(alpha)/N_out); //but it has to calc arcsin!!!!!
}
That really limits me and it's my first real disappointment with Cpp compared to that old C99 lib - any suggestions?
complex.h was introduced in C99, and the current C++ standard is C++98. Unless you were hoping for the C++ committee to be composed mainly of clairvoyants, this is to be expected.
I'm unfamiliar with complex trigonometric functions, but surely you can still do the calculation yourself by stringing together several math functions.