|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
|
|
Free Web 2.0 Code Generator! Generate data entry and reporting .NET Web apps in minutes. Quickly create visually stunning, feature-rich apps that are easy to customize and ready to deploy. Download Now!
|
|
#1
|
|||
|
|||
|
We assume that we have a simple equation like the one in attachment. So how can we solve this equation writing a small script???
|
|
#2
|
|||
|
|||
|
you want it to produce results just like mathematica does ?
__________________
Hungry for Code Programming works best with a team over one single person
|
|
#3
|
|||
|
|||
|
Yes you are right but this is not my target. If anybody answer my post, this result will be my act point to advance to my real equation...
|
|
#4
|
|||
|
|||
|
Have you tried browsing through the PHP manual's Math functions?
It's full of all sorts of mathematical functions including the exponential function you're looking for. Hope that helps!
__________________
____________________________________________ Developer Shed Weekly Writer | DevArticles Forum Moderator Build Your Own KlipFolio Klip With PHP FrankManno.com - Under Construction Design Interactive Group - Under Construction |
|
#5
|
|||
|
|||
|
For me personally maths is not my thing.
Your equation is a 2 degree polynomial and if you just want that type of equations done it can be easier. and if you are sure you will put the same kind of syntax everytime and everytimme you will have some value for x^2 and x and a constant everytime, that can be the easiest. but if you need a complex program then i would suggest looking at the php manual math functions and finding your solution. |
|
#6
|
|||
|
|||
|
solution
The quadratic equation is used to solve polynomials such as the one you listed:
-b +/- sqrt[b^2-4ac] x = -------------------------- 2a where the equation is in the format: ax^2 + bx + c = 0 Assuming you only get equations in that format, you can use regex to identify the coefficients (a,b,c) and plug them into your formula. (Since you said you wanted to solve it like Mathematica, which does all the work behind the scenes after you give it the equation) You'll likely have to break the quadratic into parts, get values for the parts, then bring them all together for your solutions (remember, there can be two valid solutions). The only advanced math function you'll need is sqrt found here: URL hope this helped. Last edited by kirk : November 2nd, 2002 at 08:40 AM. |
|
#7
|
|||
|
|||
|
thanx kirk i did it...
|
![]() |
| Viewing: Dev Articles Community Forums > Programming > PHP Development > how can i solve an equation in php??? |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|