I'm not following what you're trying to do, or how the LEDs are arranged.
Are the LEDs arrayed in a line, a circle, or something else? Which LEDs do you expect to be lit at any given phase of the circle?
One thing that is unusual looking is the if block. Note that the LEDs for which
Code:
in <= pi * 2 * i / 24
Will be unchanged from whatever their previous state was. For most purposes of this type, you would have an else block to turn lights off or some such.
Edit: Also, did you really mean to have 24,000 calls to the cos() function per wave? That could take a while on an arduino.