Error in procedure

Hi.

I try to plot a graph of a form factor and when i try to compile the procedure, I get a Syntax Error "expected right parenthesis." for this equation:

(2*Pi*L*(radius2/q_wave*BesselJ(1,radius2*q_wave)+(radius1/q_wave*BesselJ(1,radius1*q_wave)))^2

I have tried to change a few things but it still doesn't work. Can anyone please help me with this? Thank you in advance.
elle wrote:
Hi.

I try to plot a graph of a form factor and when i try to compile the procedure, I get a Syntax Error "expected right parenthesis." for this equation:

(2*Pi*L*(radius2/q_wave*BesselJ(1,radius2*q_wave)+(radius1/q_wave*BesselJ(1,radius1*q_wave)))^2


If this is literally the equation entered in your Igor function, then there is one fewer right ")" parenthesis than left. Looks like you need another after "^2".
jtigor wrote:
elle wrote:
Hi.

I try to plot a graph of a form factor and when i try to compile the procedure, I get a Syntax Error "expected right parenthesis." for this equation:

(2*Pi*L*(radius2/q_wave*BesselJ(1,radius2*q_wave)+(radius1/q_wave*BesselJ(1,radius1*q_wave)))^2


If this is literally the equation entered in your Igor function, then there is one fewer right ")" parenthesis than left. Looks like you need another after "^2".


Exactly. Or remove the leading parenthesis. But only you can know whether the formula is computing the right thing:

Function ConeFormFactor(radius1,radius2,L)     //radius1 = outer radius, radius2 = inner radius, L=Length
    Variable radius1,radius2,L             
    Make/O/D/N=201 FF_cone                 
    Wave q_wave, FF_cone
    FF_cone = 2*Pi*L*(radius2/q_wave*BesselJ(1,radius2*q_wave)+(radius1/q_wave*BesselJ(1,radius1*q_wave)))^2
End


--Jim Prouty
Software Engineer, WaveMetrics, Inc.
One trick to figure out if you have put in the parentheses correctly is to double click on the left parenthesis, and Igor will highlight the text until the matching right parenthesis. This is often useful to verify that you have all the right terms within parentheses. If there is no matching right parenthesis, then it just doesn't highlight anything, which is a huge tipoff that something is wrong.

Curiously, not in procedures, but when you use a wave dependency (as in "w := k0 * x^2", or whatever), then Igor doesn't seem to warn you that matching parentheses are missing, and you can get weird results.

-Matthew