tags:

views:

24

answers:

1

i'm using the below program but i keep getting error.What is wrong with my progam?

  real x
  complex y
  real m1,H0,Ms,P1,P2,P3,w0,wm,wh
  complex w1,w2,o1,o2
  integer i,n
  real pi
  n=4000000000  
  pi=4*atan(1.0)
  m1=4*pi*1e-7
  H0=39.79e3
  Ms=1400e3
  P1=0.7*0.12
  P2=0.3*0.12
  P3=P1-P2
  w0=m1*(1.76e11)*H0
  wm=m1*(1.76e11)*Ms
  wh=w0-P3*wm
  im=cmplx(0,1)
  w1=wm/2+wh-im*0.06*2*pi*x
  w2=wm/2-wh-im*0.06*2*pi*x
  o1=x**2-x*(2*wh-(P3*wm)/2)-w1*w2+(wm/2)*(P1*w2+P2*w1)
  o2=x**2+x*(2*wh-(P3*wm)/2)-w1*w2+(wm/2)*(P1*w2+P2*w1)

  do i=0,n
     x=i
     y=1+wm*(P1*w1*((w2)**2-x**2))/(o1*o2)
 &        +wm*(P2*w2*((w1)**2-x**2))/(o1*o2)
 &        -wm*((wm/2)*((P1*w2+P2*w1)**2)))/(o1*o2)
 &        +wm*((wm/2)*((P3*x)**2))/(o1*o2)
     write(10,*)x,y
  enddo
  return
  end
+1  A: 

This line (the third in the multiline statement):

-wm*((wm/2)*((P1*w2+P2*w1)**2)))/(o1*o2)
    ||    | ||           |   ||| |     |
    |+----+ |+-----------+   ||| +-----+
    |       +----------------+||
    +-------------------------+|
??? <--------------------------+

has one too many closing parentheses {tremble in fear at my awesome drawing skills :-) }. It should be:

-wm*((wm/2)*((P1*w2+P2*w1)**2))/(o1*o2)

The full list of problems I got from that source was:

source.f90:7.18: n=4000000000
                             1
                 Error: Integer too big for its kind at (1). This check can
                 be disabled with the option -fno-range-check.
source.f90:26.9: y=1+wm*(P1*w1*((w2)**2-x**2))/(o1*o2) &
                 1
                 Error: Unclassifiable statement at (1)

The second of those is the one you're probably having (and the one you can fix with the above solution). The first, if you're having it, will cause a problem but I suspect it's just because of my environment.

paxdiablo
Anybody that good at spotting unbalanced parentheses must also be a lisp programmer
NealB