Square or any Root programatically?

Ever wondered how to programatically get the root of any number programatically?

A square root of any number in excel can be found using the function “=SQRT(#);” where # is the number you want to have the root from. When you test this with the number 3 (commonly used to calculate complex “real” power consumption of a three fase system) You should get this as an result.


Because a “square” root is the opposite of a square power from that number you can use the following to find the same root using that same power ^ sign.

Square Root = 3^(1/2) = SQRT(#) = 3^0.5

If you add this example in excel as a check value.


You will notice that the answer is also


Using the formula for complex power calculation in PHP will give you

$Cosphi = ($Cosphi > 1) ? "1" : $Cosphi;
$Phases = ($Phases < 2) ? "2" : $Phases;

$Pw = $U . $I . $Cosphi . ($Phases^(1/2));

Yea! Its that easy!! šŸ˜‰


About Chris Gralike

Momenteel ben ik manager van de afdeling business continuity bij de zakelijke IT dienstverlener AMIS Services BV. Sinds 2003 ben ik actief in de ICT branche. Tussen 2003 en nu heb ik verschillende rollen vervuld. In de rollen: systeem- en netwerkbeheer, system engineer, servicemanager en nu practice manager ben ik in contact gekomen met uiteenlopende technologieƫn, methodologieƫn, ideeƫn, oplossingen en innovaties. Een rijke ervaring waarmee ik de klanten van Conclusion en AMIS elke dag probeer te ondersteunen. Mijn credo: 'Altijd opzoek een win-win tussen business en technologie.'

Posted on January 14, 2010, in Linux, Linux Commands, Perl, PHP and tagged , , , , , . Bookmark the permalink. Leave a comment.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: