User Tools

Site Tools


nth_root_of_x

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
nth_root_of_x [2014/04/08 01:56]
127.0.0.1 external edit
nth_root_of_x [2015/06/23 00:01] (current)
Jay.Tanner.x@PHPScienceLabs.us
Line 3: Line 3:
 Back to:  **[[Arbitrary-Precision Math]]** \\ Back to:  **[[Arbitrary-Precision Math]]** \\
 =====Nth Root of X===== =====Nth Root of X=====
-Sometimes we may want to compute a square root or a cube root or a fifth root some other root of a number to some specified degree of precision. The function below will compute the arbitrary-precision Nth root of argument X.  As with all BC math functions, the X argument should be given as a numerical string, between quotes, like "​1.2345"​ or '​1.2345',​ so as not to be misinterpreted as a standard floating point value.+Sometimes we may want to compute a square root or a cube root or a fifth root some other root of a number to some specified degree of precision. The function below will compute the arbitrary-precision Nth root of argument X.  As with all BC math functions, the X argument should be given as a numerical string, between quotes, like "​1.2345"​ or '​1.2345',​ so as not to be misinterpreted as a standard ​double-precision ​floating point value.
 \\ \\
 <​code>​ <​code>​
Line 23: Line 23:
  
 START: START:
-b = (a + X/(a^n)) / n+b = (a + X/(a^n)) / N
  
 If (a == b) to (d) decimals, then finished, (b) is the root value. If (a == b) to (d) decimals, then finished, (b) is the root value.
Line 169: Line 169:
  
  
-   ​function ​bcNth_Root_Of_X ​($N, $X, $NumDecimals=16)+   ​function ​bcNth_Root_of_X ​($N, $X, $NumDecimals=16)
 { {
    $a = sprintf("​%1.16f",​ pow($X, 1/$N)); // Compute first approximation    $a = sprintf("​%1.16f",​ pow($X, 1/$N)); // Compute first approximation
nth_root_of_x.1396936565.txt.gz ยท Last modified: 2015/06/22 23:47 (external edit)