Lumio Posted June 14, 2007 Share Posted June 14, 2007 Hi! I set the first beta-version of my mathparser to the net: http://booja.rootzilla.de/math/ So brackets are allowed, also exponential, and all down to additions and substractions. To extract a root do x^(1/2) or x\2 (the 2. root) Link to comment https://forums.phpfreaks.com/topic/55632-mathparser/ Share on other sites More sharing options...
Lumio Posted June 15, 2007 Author Share Posted June 15, 2007 I do that without eval() Link to comment https://forums.phpfreaks.com/topic/55632-mathparser/#findComment-275144 Share on other sites More sharing options...
Lumio Posted June 20, 2007 Author Share Posted June 20, 2007 any suggestions? Link to comment https://forums.phpfreaks.com/topic/55632-mathparser/#findComment-278279 Share on other sites More sharing options...
$username Posted June 20, 2007 Share Posted June 20, 2007 Its fun, I tried it and it works fine. Link to comment https://forums.phpfreaks.com/topic/55632-mathparser/#findComment-278853 Share on other sites More sharing options...
Lumio Posted June 21, 2007 Author Share Posted June 21, 2007 What would you like, that I add? Link to comment https://forums.phpfreaks.com/topic/55632-mathparser/#findComment-279116 Share on other sites More sharing options...
$username Posted June 21, 2007 Share Posted June 21, 2007 What kind of PHP commands do you use for the processing of the math commands? are there defaults that PHP has? Brett Link to comment https://forums.phpfreaks.com/topic/55632-mathparser/#findComment-279581 Share on other sites More sharing options...
Lumio Posted June 22, 2007 Author Share Posted June 22, 2007 I'm parsing the text and fill an array. So for example I got the string x+12*(12+1) Now I replace the variables with numbers and then I fill the array like that: [0] => x [1] => + [2] => 12 [3] => * [4] => ( [5] => 12 [6] => + [7] => 1 [8] => ) Then I'm looking for the brackets and send the content for an extra calculation. Then there comes the rest: so multiplications and additions. For calculating I use the bcmath-functions (http://www.php.net/manual/en/ref.bc.php) Link to comment https://forums.phpfreaks.com/topic/55632-mathparser/#findComment-279952 Share on other sites More sharing options...
corbin Posted June 22, 2007 Share Posted June 22, 2007 500*(2^(1/2))/(5^(1/7)) = 561.8652131774970996729094261138143717061971343782478594820610457652 That was fun! lol Tried a bunch of random stuff, and everything worked fine ;p. Link to comment https://forums.phpfreaks.com/topic/55632-mathparser/#findComment-279985 Share on other sites More sharing options...
Lumio Posted June 22, 2007 Author Share Posted June 22, 2007 Okay! Then I think, I add a function to calculate equations. Link to comment https://forums.phpfreaks.com/topic/55632-mathparser/#findComment-280170 Share on other sites More sharing options...
Lumio Posted June 24, 2007 Author Share Posted June 24, 2007 I added a new function to the parser so you can now set more than only one unknown (just follow the description) http://booja.rootzilla.de/math Link to comment https://forums.phpfreaks.com/topic/55632-mathparser/#findComment-281467 Share on other sites More sharing options...
deadonarrival Posted July 12, 2007 Share Posted July 12, 2007 Some graph functions Differentiation and/or integration would be great no idea if that can even be coded in PHP though Link to comment https://forums.phpfreaks.com/topic/55632-mathparser/#findComment-295910 Share on other sites More sharing options...
AndyB Posted July 12, 2007 Share Posted July 12, 2007 Couldn't resist .. -1^0.5 = -1 Not quite Link to comment https://forums.phpfreaks.com/topic/55632-mathparser/#findComment-295999 Share on other sites More sharing options...
Lumio Posted July 12, 2007 Author Share Posted July 12, 2007 Some graph functions Differentiation and/or integration would be great no idea if that can even be coded in PHP though I've already done that Thanks AndyB ... I'll fix that... fixed Link to comment https://forums.phpfreaks.com/topic/55632-mathparser/#findComment-296145 Share on other sites More sharing options...
xenophobia Posted July 23, 2007 Share Posted July 23, 2007 Should truncate the string, because when I used a space between the number and operators like this: 2 + 1 it will equals to 2. But overall, great work! Keep it up!! Link to comment https://forums.phpfreaks.com/topic/55632-mathparser/#findComment-305131 Share on other sites More sharing options...
Recommended Posts