Search code examples
javascriptalgebra

javascript algegra solve for x


I have the equation:

((fp*t)/acres)+rt=v

I know:

fp=.25
acres=40
rt=13
v=13.3

I need to solve for t

To do this on paper, I'd: Simplify both sides of the equation.

0.00625t+13=13.3

Subtract 13 from both sides.

0.00625t+13−13=13.3−13

0.00625t=0.3

Divide both sides by 0.00625.

0.00625t/0.00625=0.3/0.00625

answer: t=48

How would I do that with javascript?


Solution

  • Just change around your equation so t is alone:

    var fp = .25;
    var acres = 40;
    var rt = 13;
    var v = 13.3;
    
    t = ((v - rt) * acres) / fp;
    
    console.log(t); // ~48