Power Factor Correction Methods In Javascript