1

I wanted to know if I have to rewrite Math.pow(a, b) to make nth root. Or is there a code for nth root.

Currently I am using input so users can create a price calculator for mods on Warframe. And I made a formula so it can give a fair price on mods better than guessing.

It follows this formula

Max rank price divided by start unranked price. It will be called ratio.

Max rank root scale.

Ex 10/---- 20 = percent increase.

Percent increase times current rank times start unranked price.

Again I wanted to know if there is Math root or not

Peter O.
  • 32,158
  • 14
  • 82
  • 96
Gareth Compton
  • 159
  • 1
  • 12

1 Answers1

4

Math.pow can give you the nth root; just use a power of 1/n. For example: (at the javascript console)

> Math.pow(2, 1/2)
< 1.4142135623730951

This is very basic algebra.

Daniel Martin
  • 23,083
  • 6
  • 50
  • 70
  • thanks, it was coding to write the math down that i got confused. – Gareth Compton Mar 28 '16 at 00:18
  • 1
    for people who need to brush up on their math... a * a = a^2, a * a * a = a^3, then root is going in reverse. Sqrt of a^2 is = a.. or a^2/2 = a^1/1 = a^1 = a. also, when you multiply power is added therefore when you divide power is subtracted. (a * a = a^2), (a^2 / a = a), (1 / a^3 = a^-3) how? (1 (a^-3) / a^3 (a^-3) = 1/a^(3-3) = 1/a^0 = 1/1 = 1 – Muhammad Umer Oct 14 '20 at 23:22