The all mighty graph and the power of math
Moderator: General Moderators
-
Charles256
- DevNet Resident
- Posts: 1375
- Joined: Fri Sep 16, 2005 9:06 pm
The all mighty graph and the power of math
Okay..I've seen some utilities that graph like pie charts and stuff but are there programs out there that graph complex mathematrical functions? If no, would anyone be interested in such a program? I'm finely delving into the finer points of Cal. 3 and we have a lot of weird looking 3d functions and my teacher is praising this program that graphs them so I figured it might be fun to make something simliar or better in PHP and release it as freeware just to spite said company. 
Last edited by Charles256 on Fri Sep 30, 2005 1:51 pm, edited 1 time in total.
-
Charles256
- DevNet Resident
- Posts: 1375
- Joined: Fri Sep 16, 2005 9:06 pm
-
Charles256
- DevNet Resident
- Posts: 1375
- Joined: Fri Sep 16, 2005 9:06 pm
I was thinknig about it as I ate my double quarter pounder and I think I'm going to extend it to solve most math equations as well. With a little tweaking I should be able to switch it to solve all equations. for example when integrating and differentiating (used to come up with speed formulas and such) you occasionally run into a few rare examples where the rules don't apply and you have to use a slightly altered sense of the rules to get it to work but what are if statements for?:) Either way, as for graphing the 3d functions since I am working with 2d objects I was thinking have a button to change perspective, I.E. top/left/right/bottom and then your normal head on. If any of you have ever drawn a 3d graph then you kinda get a feel for what I'm saying. is there a function that draws 3d objects in PHP or would I have to start from scratch on that?If so I've been thinking about how to go about that and I see the possibilities forming..
: stops to breathe :
: stops to breathe :
-
Charles256
- DevNet Resident
- Posts: 1375
- Joined: Fri Sep 16, 2005 9:06 pm
You could probably use JPGraph to generate the graphs. That would cut down your work load to just calculate the data points.
PHP has no powerful math library, but this link says it provides some tips for creating math libraries in PHP:
http://www.opensourcetutorials.com/tuto ... page1.html
PHP has no powerful math library, but this link says it provides some tips for creating math libraries in PHP:
http://www.opensourcetutorials.com/tuto ... page1.html
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.
-
Charles256
- DevNet Resident
- Posts: 1375
- Joined: Fri Sep 16, 2005 9:06 pm
i don't really like the way that displays graphs to be honest :-/ doesn't do a good job of showing x,y, and z (in all fairness I might have just missed the relevant screen shot ) . I want users to be able to look at the graph and be able to tell due to ticking on the graph (tick for 1,tick for 2, you know:) ) that the graph is actually what they expected and is 100% accurate rather than a close enough. As for the math libraries, that's all ready what I had in mind by using classes and what not. Who knows if I do good enough maybe my "math library" will see some distribution. Though this will take mucho time but that's okay, learning process is worth it.
The only thing I'm not quite sure how I'll do is create lines, points is one thing but lines? oh well.I might just have the calculations run through close to every number in the range they provide so even if it isn't a solid line any dummy can tell what's going on:-D Changing the perspetive is going to be the annoying part I do believe.
- Maugrim_The_Reaper
- DevNet Master
- Posts: 2704
- Joined: Tue Nov 02, 2004 5:43 am
- Location: Ireland
Sounds like an interesting project. I'm currently 60% though redesigning a legacy PHP game (it's going very fast since I finished all my planning, class outlines and MVC work). One thing I keep running into are displaying 3D graphs, statistics, 3D map coordinates and such within 2D images, It's a problem I'm looking to tackle in the near future.
Sounds like there may be some overlap with your own ideas - be good to hear from you, I may have a few spare fingers to lend you...
Sounds like there may be some overlap with your own ideas - be good to hear from you, I may have a few spare fingers to lend you...
-
Charles256
- DevNet Resident
- Posts: 1375
- Joined: Fri Sep 16, 2005 9:06 pm
- n00b Saibot
- DevNet Resident
- Posts: 1452
- Joined: Fri Dec 24, 2004 2:59 am
- Location: Lucknow, UP, India
- Contact:
- Maugrim_The_Reaper
- DevNet Master
- Posts: 2704
- Joined: Tue Nov 02, 2004 5:43 am
- Location: Ireland
MODEL-View-Controller...
It's a pattern for dividing web applications into three layers (well, there's a fourth I use - Data Access). Each layer has responsibility for its own tasks. Taking an example - let's take a game with a character. I want to request the application to display the character's data. Typicaly I would issue a request ( game.php?action=character.display)
The controller (a FrontController, well, what I CALL a FrontController) parse the action. It includes the Character>Display Command (a class in the Model Layer) upon which the FC calls its execute() method. In this case the Command would make a few calls to the Database by calling methods in the Data Access Layer. The FC then grabs a View (e.g. a method for parsing a Smarty template, and assigning values to template variables the Command requested though the Data Access Layer) and sends the output to browser via the View's render() method.
I know it sounds all complex - but it's quite a useful pattern, that in turn uses other patterns (FrontController, Command, etc.) You separate out responsibility, allow layers to delegate to other layers (when a task to be performed is another layer's responsibility) and it's pretty easy to maintain.
It's nicest benefit is re-usability - I develop 3 games, so having such a re-useable framework is a huge time saver. Also let's me do a few other nifty things like centralising responsibilty for input filtering, etc to the FC.
Gotta stop rambling now...
http://java.sun.com/blueprints/guidelin ... arch2.html
http://en.wikipedia.org/wiki/Model_view_controller
http://msdn.microsoft.com/library/defau ... DesMVC.asp
You really should research design patterns - you will not regret it...
It's a pattern for dividing web applications into three layers (well, there's a fourth I use - Data Access). Each layer has responsibility for its own tasks. Taking an example - let's take a game with a character. I want to request the application to display the character's data. Typicaly I would issue a request ( game.php?action=character.display)
The controller (a FrontController, well, what I CALL a FrontController) parse the action. It includes the Character>Display Command (a class in the Model Layer) upon which the FC calls its execute() method. In this case the Command would make a few calls to the Database by calling methods in the Data Access Layer. The FC then grabs a View (e.g. a method for parsing a Smarty template, and assigning values to template variables the Command requested though the Data Access Layer) and sends the output to browser via the View's render() method.
I know it sounds all complex - but it's quite a useful pattern, that in turn uses other patterns (FrontController, Command, etc.) You separate out responsibility, allow layers to delegate to other layers (when a task to be performed is another layer's responsibility) and it's pretty easy to maintain.
It's nicest benefit is re-usability - I develop 3 games, so having such a re-useable framework is a huge time saver. Also let's me do a few other nifty things like centralising responsibilty for input filtering, etc to the FC.
Gotta stop rambling now...
http://java.sun.com/blueprints/guidelin ... arch2.html
http://en.wikipedia.org/wiki/Model_view_controller
http://msdn.microsoft.com/library/defau ... DesMVC.asp
You really should research design patterns - you will not regret it...