|
Global math static class
|
|
12-04-2009, 11:44 AM
Post: #1
|
|||
|
|||
|
Global math static class
Anybody want to help build a global math class. We will add useful functions that are common. For example isPrime, isPerfectNumber, Factorial etc... Anything people can come up with, and will just build and build off it.
|
|||
|
12-04-2009, 11:04 PM
Post: #2
|
|||
|
|||
|
RE: Global math static class
Well very good idea. You have almost everything made in Pascal and C++ here.
You can make this for Java and include all Pascal and C++ functions and make that for that two languages ! There's a fine line between genius and insanity. I have erased this line. Oscar Levant There's a fine line between an administrator and black hat hacker. I have erased this line. Dr DEBCOL |
|||
|
12-05-2009, 12:43 AM
(This post was last modified: 12-16-2009 09:17 AM by codecaine.)
Post: #3
|
|||
|
|||
|
RE: Global math static class
Yea I will start the class and post a couple functions. Then anybody can add on or revise it to make it more efficient. Here is was I got so far.
Code: import java.util.*;Here I am testing the functions Code: public class MathTestsource code attached to the bottom |
|||
|
12-05-2009, 03:33 AM
Post: #4
|
|||
|
|||
|
RE: Global math static class
Very good, but i have one improvement.
When you search for primes in this line : for(int x = 3; x < HALF_MAX; x = x + 2 ) except HALF_MAX you should find an square root of the number and count to floor() of that square root. Think about that ! There's a fine line between genius and insanity. I have erased this line. Oscar Levant There's a fine line between an administrator and black hat hacker. I have erased this line. Dr DEBCOL |
|||
|
12-05-2009, 04:42 AM
Post: #5
|
|||
|
|||
|
RE: Global math static class
Yea I was trying that but for some reason wasn't getting correct results.
|
|||
|
12-15-2009, 03:51 PM
Post: #6
|
|||
|
|||
|
RE: Global math static class
I added some fibonacci functions to the java math class
|
|||
|
12-16-2009, 09:18 AM
Post: #7
|
|||
|
|||
|
RE: Global math static class
updated the global math class with a factorial function that returns the factions as a list and is even or odd function checker
|
|||
|
12-17-2009, 04:50 AM
Post: #8
|
|||
|
|||
|
RE: Global math static class
You can also add some geometry functions for example :
Euclidean distance http://en.wikipedia.org/wiki/Euclidean_distance There's a fine line between genius and insanity. I have erased this line. Oscar Levant There's a fine line between an administrator and black hat hacker. I have erased this line. Dr DEBCOL |
|||
|
04-11-2010, 10:59 AM
Post: #9
|
|||
|
|||
|
RE: Global math static class
Here is a basic function:
Code: public static int Geo_Polygon_angles(int side){"Character is determined more by the lack of certain experiences than by those one has had." Friedrich Nietzsche |
|||
|
« Next Oldest | Next Newest »
|





