kidjapa / php-goalseek
A simple goalseek function for PHP. Using the goalseek function from Libre Office
1.0
2020-11-05 12:52 UTC
Requires
- php: ^7.1
This package is auto-updated.
Last update: 2025-06-23 02:53:54 UTC
README
-
Php function to simulate Goal Seek from libre office using the Regula Falsi method.
-
In most cases the result is equal of the Excel formula. Because the Excel do not show what formula are used in goal seak we need to use the similar function in Libre Office.
-
Install
composer require kidjapa/php-goalseek
In Libre office
- Function in archive: core/sc/source/coredata/dcoumen4.cxx
bool ScDocument::Solver(SCCOL nFCol, SCROW nFRow, SCTAB nFTab, SCCOL nVCol, SCROW nVRow, SCTAB nVTab, const OUString& sValStr, double& nX )
Sample
$goalSeek = new SolveGoalSeek(); $getValue = 0; $getValue = $goalSeek->seekGoal( function($value, $data){ return sqrt($value); }, 16, // The Actual Value 20 // The Goal Value ); echo "------------- results ------------- \n"; echo "Result: ".$getValue."\n"; // Expect: 400