PHP Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsProgrammingPHP Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
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  
Old November 1st, 2002, 10:24 AM
cemlouis cemlouis is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Oct 2002
Posts: 49 cemlouis User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 6
Question how can i solve an equation in php???

We assume that we have a simple equation like the one in attachment. So how can we solve this equation writing a small script???
Attached Images
File Type: gif equation.gif (1.8 KB, 327 views)

Reply With Quote
  #2  
Old November 1st, 2002, 10:25 AM
AmericanD AmericanD is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Oct 2002
Posts: 81 AmericanD User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 6
you want it to produce results just like mathematica does ?
__________________
Hungry for Code

Programming works best with a team over one single person

Reply With Quote
  #3  
Old November 1st, 2002, 10:48 AM
cemlouis cemlouis is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Oct 2002
Posts: 49 cemlouis User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 6
Wink

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...

Reply With Quote
  #4  
Old November 1st, 2002, 01:00 PM
FrankieShakes FrankieShakes is offline
Frank The Tank!
Dev Articles Beginner (1000 - 1499 posts)
 
Join Date: Jun 2002
Location: Toronto, Canada
Posts: 1,246 FrankieShakes User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 8
Send a message via ICQ to FrankieShakes Send a message via MSN to FrankieShakes
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

Reply With Quote
  #5  
Old November 1st, 2002, 02:34 PM
AmericanD AmericanD is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Oct 2002
Posts: 81 AmericanD User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 6
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.

Reply With Quote
  #6  
Old November 2nd, 2002, 08:37 AM
kirk kirk is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Aug 2002
Location: LR, AR
Posts: 1 kirk User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via AIM to kirk
solution

The quadratic equation is used to solve polynomials such as the one you listed:

&nbsp;&nbsp;&nbsp;&nbsp; -b +/- sqrt[b^2-4ac]
x = --------------------------
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 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.

Reply With Quote
  #7  
Old November 2nd, 2002, 09:39 AM
cemlouis cemlouis is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Oct 2002
Posts: 49 cemlouis User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 6
thanx kirk i did it...

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingPHP Development > how can i solve an equation in php???


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 

Iron Speed




© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway