jlawrence11 / eos Goto Github PK
View Code? Open in Web Editor NEWEquation Operating System
Equation Operating System
Hi,
I am trying to evaluate following code.
include('matheval/eos.class.php');
$tempArr = array('abc'=>11685,'xyz_pqr'=>1169778);
$eos = new eqEOS();
$expressionToEval = '($abc)*100/($xyz_pqr)';
It throws following fatal error.
PHP Fatal error: Uncaught exception 'Exception' with message 'Variable replacement does not exist for '$xyz' in ($abc)*100/($xyz_pqr)' in matheval/eos.class.php:365
Stack trace:
#0 temp.php(7): eqEOS->solveIF('($abc)*100...', Array)
#1 {main}
thrown in matheval/eos.class.php on line 365
So due to underscore it is creating an issue. I tried it with removing underscore and it worked.
Hi Jon,
Could you make one small change and make the visibility of replaceVars
"public" instead of protected - it's quite a handy method for debugging and display purposes.
Love the class - very helpful!
Cheers,
Numbers input in scientific notation are not interpreted as expected. For example:
eos->solveIF('100*2e-9')
will output 191 instead of the expected 2.0e-7
As a quick fix, I performed a string replace after the variable replacement in solveIF()
// fix up scientific notation
$infix = str_ireplace("e","*10^",$infix);
I'm not sure if this will work under all conditions but I need it working for the moment.
If I try to solve equation like this - 100-20% then I'm taking error message - Warning: Undefined array key -1 in /var/www/html/vendor/jlawrence/eos/src/Parser.php on line 290
The line with code what I used - $math_result = Parser::solve('100-20%');
Maybe I don't understand it library fully ?
5sin(1.5707963267) = 51
and
sin(1.5707963267)5 = 15
Hi jon,
Parser class replaceVars($infix, $vArray)
method, if $vArray has value scientific notation
(like Parser::solveIF('x(1+y)',['x'=>1,'y'=>0.00000008])
;
'y' will be convert into 8E-8 by php)
as follows code
if (in_array(strtolower($match[2]), array('pi', 'e'))) {
$t = (strtolower($match[2]) == 'pi') ? pi() : exp(1);
$infix = str_replace($match[0], $match[1] . $front . $t . $back . $match[3], $infix);
.....
}
will go wrong.
I am always getting these warnings/errors:
Notice (8): Undefined offset: 0 [APP\Vendor\eqEOS.php, line 170]
Notice (8): Undefined offset: 1 [APP\Vendor\eqEOS.php, line 167]
Notice (8): Undefined offset: 2 [APP\Vendor\eqEOS.php, line 170]
code:
$eq=new eqEOS();
$val_qty=$eq->solveIF('$width*5', 3);
sum(sum(1, 1, 2), 1, 2)
Trows a Mismatched parenthesis
There is no licence file in this repository.
Which licence is this software licensed under? Is it open source?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.