Miguel Gomez
Miguel Gomez

Reputation: 107

Torque formula in Java?

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 ) );

Upvotes: 1

Views: 251

Answers (1)

Bill the Lizard
Bill the Lizard

Reputation: 405955

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 );

Upvotes: 2

Related Questions