Torque formula in Java?

230 Views Asked by At

I'm trying to calculate the torque in a java program but I having some problems on how to convert the formula to code

Here is the formula: enter image description here

and here is my code:

torque = CYLINDER_LOAD_FACTOR * ( ( Math.pow( (displacement / numberOfCylinders), 2) * Math.exp(TORQUE_CONSTANT) * 0.59 ) );

1

There are 1 best solutions below

0
Bill the Lizard On

This entire expression should be raised to the power of 0.59,

( Math.pow( (displacement / numberOfCylinders), 2) *  Math.exp(TORQUE_CONSTANT) )

but you're multiplying by that amount. Try the following:

torque = CYLINDER_LOAD_FACTOR * Math.pow( Math.pow( (displacement / numberOfCylinders), 2) *  Math.exp(TORQUE_CONSTANT), 0.59 );