PHPSL Function: Spherical_Properties |
Spherical_Properties ($KnownRCAV, $Decimals=16)
Dependencies: NONE The basic sphere has four properties:
Given any single one of the four spherical $('R~C~A~V')$ properties, this function will compute the other three unknown related spherical property values to up to $100$ decimals precision. Default = $16$ decimals, unless otherwise specified. The returned string will contain all four numerical $('R~C~A~V')$ values, including the input argument, separated by spaces or an error message if something is wrong, such as an invalid argument. The Relevant Spherical Equations: Given the radius $(R)$: $ \begin{align*} C ~=~ 2\pi R ~~~~~~~~~~~~~~~~~~~~~~~~ A ~=~ 4\pi R^2 ~~~~~~~~~~~~~~~~~~~~~~~~ V ~=~ \frac{4\pi R^3}{3} \end{align*} $ To obtain the radius $R$ from the $C$, $A$ or $V$ values: $ \begin{align*} R ~=~ \frac{C}{2\pi} ~~~~~~~~~~~~~~~~~~~~~~~~ R ~=~ \sqrt{\frac{A}{4\pi}} ~~~~~~~~~~~~~~~~~~~~~~~~ R ~=~ \sqrt[\large3]{\frac{3V}{4\pi}} \end{align*} $ NOTES:
Below is the PHP source code for the spherical properties function. Double-Click to select ALL code Double-Click to select ALL code Some example call results are demonstrated below. NOTE: Within the input argument string, the $('R~C~A~V')$ symbols are NOT case sensitive and any spaces within the argument string are ignored as if they do not exist. The user supplies a single known spherical parameter argument to the function and it computes the other three related unknown values and returns a string consisting of all four values in $('R~C~A~V')$ order, separated by spaces as shown in the examples below. print Spherical_Properties ('r =1.75'); // Default = 16 decimals // =--> '1.7500000000000000 10.9955742875642763 38.4845100064749671 22.4492975037770641' // -------------------------- print Spherical_Properties ('C= 125.3025', 10); // =--> '19.9425122567 125.3025000000 4997.6932840722 33222.1865242790' // -------------------------- print Spherical_Properties ('a = 13.032125', 12); // =--> '1.018363175085 6.398564539071 13.032125000000 4.423812064371' // -------------------------- print Spherical_Properties ('V=7.5', 6); // =--> '1.214295 7.629640 18.529268 7.500000' References: http://mathworld.wolfram.com/Sphere.html https://en.wikipedia.org/wiki/Sphere |
Jay Tanner - 2024 |