BESSELK.php 902 B

1234567891011121314151617181920212223242526272829
  1. <?php
  2. use PhpOffice\PhpSpreadsheet\Calculation\Calculation;
  3. use PhpOffice\PhpSpreadsheet\Spreadsheet;
  4. require __DIR__ . '/../../Header.php';
  5. $category = 'Engineering';
  6. $functionName = 'BESSELK';
  7. $description = 'Returns the modified Bessel function, which is equivalent to the Bessel functions evaluated for purely imaginary arguments';
  8. $helper->titles($category, $functionName, $description);
  9. // Create new PhpSpreadsheet object
  10. $spreadsheet = new Spreadsheet();
  11. $worksheet = $spreadsheet->getActiveSheet();
  12. for ($n = 0; $n <= 5; ++$n) {
  13. for ($x = 0; $x <= 5; $x = $x + 0.25) {
  14. Calculation::getInstance($spreadsheet)->flushInstance();
  15. $worksheet->setCellValue('A1', "=BESSELK({$x}, {$n})");
  16. $helper->log(sprintf(
  17. '%s = %f',
  18. $worksheet->getCell('A1')->getValue(),
  19. $worksheet->getCell('A1')->getCalculatedValue()
  20. ));
  21. }
  22. }