Trigonometry function in Igor

Hi everyone

I am using Igor to convert a wave from one factor to another using a sine function.

Igor can regonise e.g sin(pi/180) directly, but when I try to input the inverse of sin with sin^-1(pi/180), it doesn't work for this command.

Does anyone know how to input a function which includes a term for an inverse trigonometric function?

Many thanks!
johnweeks wrote:
It's called asin().

John Weeks
WaveMetrics, Inc.
support@wavemetrics.com


Problems,

The sine function is this

'Lamda'=2*'d'*sin('theta')

I have two Lamdas, 'Lamda_1' = 0.826026 & 'Lamda_2' =1.542515

and I have an original wave '2theta_1' which is 2*'theta_1' and is worked out in 'Lamda_1'.

Now, I want to convert the '2theta' into '2theta_2' which is worked out with 'Lamda_2'.

So, what i did was to rearrange the equation for '2theta_1' and get a set of values for 'd'.

duplicate '2theta_1' 'd_space'
'd_space' = 0.826026/2/sin('2theta_1'/2)


And then use this with 'Lamda_2' to get a new set of data for '2theta_2'.

duplicate 'd_space' '2theta_2'
'2theta_2' = 2*asin(1.542515/2/'d_space')

AppendToTable '2theta_2'


But then, what it appears is only a column header named with '2theta_2'. No data was actually displayed for this wave.

I tried to plot a graph using '2theta_2'. But what it comes out is not correct.

Can anyone tell if this is a command error?




>'2theta_2' = 2*asin(1.542515/2/'d_space')

If d_space contains zeros then 1.542515/2/'d_space' will be INF and asin(1.542515/2/'d_space') will be NaN (not-a-number which is displayed in a table as a blank cell.
hrodstein wrote:
>'2theta_2' = 2*asin(1.542515/2/'d_space')

If d_space contains zeros then 1.542515/2/'d_space' will be INF and asin(1.542515/2/'d_space') will be NaN (not-a-number which is displayed in a table as a blank cell.


I looked through the entire wave of 'd_space', some of the numbers are -ve and some are +ve, but none of them is zero.

In fact, the mathematics that I applied is correct, so it shouldn't come out with something which doesn't look like what it's supposed to be.

Anyway, is there an alternative way to get '2theta_2' in terms of the 'lambda_2'?
Is there a problem with radians and degress?
the sin-functions returns the sine of an angle in radians, your XRD(?) pattern will be in degrees.

Would this work?

function XRDConvert(TwoTheta)
    wave TwoTheta
   
    variable lambda1 = 0.82
    variable lambda2 = 1.54
   
    Duplicate/O TwoTheta d_spacing, newTwoTheta
   
    d_spacing = lambda1/ (2* sin( (TwoTheta*pi/180)/2 ) )
    newTwoTheta = asin( lambda2 / (2*d_spacing) ) * 180/pi 
   
    Killwaves/Z d_spacing
end


Christian