I am trying to program a swerve drive, and I need to use atan(), but netbeans always says it doesn’t exist in my class. Yes I know there is getDirection() on the joystick, but I need to manipulate numbers after taking them from the joystick.

Take a look in the com.sun.squawk.util.MathUtils package. There are implementations of many of the J2SE math functions, including atan() and atan2(), in there.

What is the import line I need to use? I tried ‘import com.sun.squawk.util.MathUtils;’ and that did not work. I have yet to learn what Taylor series are in detail, so that would be a project for down the road.

I am using it to calcluate the desired angle of a wheel in a swerve configuration. I calculate the x and y components of the vector representing each wheel. Getting the magnitude (speed) is easy, but without atan, the angle was going to be a challenge.

I spent the summer porting a fixed point math library to Arm’s Thumb2 assembly, and learned a lot when I hit the arc-trig functions. At the high school level, suffice it to say that these functions are very-not-polynomials and therefore hate Taylor series expansions. At the college level, suffice it to say that if I ever teach numerical approximations the final exam will be to approximate arcsine.