HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Polynomial Equations in war3. Do you think I should release this?

12-20-2003, 01:24 AM#1
weaaddar
So StarcraftFreak and I were talking about how worthless fyredaugs contest was a while back. And he read my last post about polynomial differentation & integration. And he was telling me it simply can't be done. I explained to him that if one were to use an array and store the coeffecients by thier powers. Its a simple task of using the power rule (if f(x)=c*x^N then f'(x)=N*c*x^(n-1))


An hour later I created a simple test map that would 'polynomalize'. Which take a string, rips it up into using the delimiter "+" (negative is not a delimiter as theres another function that takes a string and formats it correctly for polynomialize and also will check if the string isn't broken or is using too high of a power this also takes the simplified x and replaces it with x^1 and replaces a constant with constantX^0), then rips each token for "x^" so it defines the first token to an array at element second token. Its rather ugly. I eventually added support for negative exponents.

Right now the features are as fallows:
-Takes polynomials in this format (although decending order is recommended its not required) CnX^N+Cn-1X^(N-1)...C1X^1+C0X^0
-Supports exponents in the range of X^-49 to X^50
-Allows storage of up to 80 polynomial functions
-Can take deravatives of a stored function.
-Can take integrals of a stored function
-Can add with using the to string method to concanate the two polynomails together then sending it through polynomialize
-Can probably implement a subtraction function pretty easily. (replace every instance of + with - and visa verse in the equation thats being subtracted then polynomialize then to string again)
-Requires only 1 Global variable
Limitations (what it can't do):
-Non-constant integral exponents
-Multiplication or devision
-Factoring
-Expanding
-Fraction

The question at hand is should I unleash this monster to the world and would you find use of it?
12-20-2003, 01:38 AM#2
HEZZA
What the f00k are u on about emote_sweat
12-20-2003, 01:42 AM#3
ObsidianTitan
Man, half that stuff went right over my head. Seeming as though i havent taken a math course in about 2 and a half years, would you mind refreshing my memory. I honestly dont even know if i was even tough any of that.
12-20-2003, 02:08 AM#4
weaaddar
A polynomial equation is a function which is written like so
Code:
f(x)=c*x^n
For those who've not been in a math course in a long time i'll read you the equation in english. F is a function of variable x whose value is a constant times variable x raised to the nth power.
Our Function f is considered a single polynomial 'unit'. Polynomials are written in chain formed from highest to lowest power.
Code:
f(x)=c(0)*x^n+c(1)*x^(n-1)+c(2)*x^(n-2)+...+c(n-1)*x+c(n)
you'll notice that c is also a function. (C(x)=(n)NCR(x). NCR is a just pascals triangle.
Code:
    1
  1 2 1
 1 3 3 1
1 4 6 4 1


Sorry, I'm probably not the best explainer now is pure text the easiest method to explain such things.


Anyway a polynomial is the expanded form of a factored equation.
Code:
factored:
f(x)=(x+y)^n
expanded:
f(x)=c(0)X^n+c(1)x^(n-1)*y^1+c(2)x^(n-2)*y^2...+c(n-1)x^1*y^(n-1)+c(n)*y

You can use this to solve such an equation like f(x)= (3+4)^2=?
Though obviously when constants are avialable this is much easier but just to show the method I'll do it by hand.

I go to my pascal triangle to find out my constants for my function, I also identify my x (3), my y(4), and my n (2)
Code:
   1
1 2 1
i come up with this
Code:
f(x)=1*3^2+2*3^(1)*4^1+4^2
f(x)=9+24+16
f(x)=49
This is also a primary method used to solve zeroes of functions writen like (x+y)^(odd power) with the aid of synthentic division.
12-20-2003, 02:15 AM#5
HEZZA
Quote:
Originally posted by weaaddar
A polynomial equation is a function which is written like so
Code:
f(x)=c*x^n
For those who've not been in a math course in a long time i'll read you the equation in english. F is a function of variable x whose value is a constant times variable x raised to the nth power.
Our Function f is considered a single polynomial 'unit'. Polynomials are written in chain formed from highest to lowest power.
Code:
f(x)=c(0)*x^n+c(1)*x^(n-1)+c(2)*x^(n-2)+...+c(n-1)*x+c(n)
you'll notice that c is also a function. (C(x)=(n)NCR(x). NCR is a just pascals triangle.
Code:
    1
  1 2 1
 1 3 3 1
1 4 6 4 1


Sorry, I'm probably not the best explainer now is pure text the easiest method to explain such things.


Best way to descibe is say is u would to a child.......and also for us who dont know.......what woudl you use that for.....what does it enable you to do
12-20-2003, 02:15 AM#6
Phil_123
http://mathworld.wolfram.com/Polynomial.html
http://mss.math.vanderbilt.edu/~pscr...solvepoly.html
12-20-2003, 02:27 AM#7
weaaddar
I love this site http://mathworld.wolfram.com/Polynomial.html
just because how hillariously hard it is to read and how they use things liek its a simple subsitution and its not hard to see that...
12-20-2003, 02:59 AM#8
ObsidianTitan
Thanks for clearing the cobwebs, i think i remember doing that at some point in time.

I dont know weather releasing that would be a good or a bad thing, I say go for it because those who know how to use it will put it to good use, and those who dont will simpily ignore it.
12-20-2003, 03:45 AM#9
Darimus
I'm doing polynomials in math class right now... we had a test on them today... uhh...

I don't understand how they could be used in a map... it's kinda pointless
12-20-2003, 10:17 AM#10
Balthamos
The way I see it, a lot of people may not use it, but some people who actually understand it really well and it's uses would use it. So basically:
A) There's no harm in releasing it, it's not like footman wars where by releasing an unprotected version, 5000 bad mapmakers suddenly release their own versions because most bad mapmakers won't understand it.
B) On the positive side, good mapmakers may be able to make their maps even better.

In the end I figure, yes you should release it, I personally probably won't use it because I don't intend to make any warcraft maps complicated enough that they require polynomials. But I'm sure there's some who'll find this useful. I thankyou for contributing this to the community well done.
12-20-2003, 12:48 PM#11
Ligature
OK so I skipped over the part where you explained what polynomials were... But I think I remember that bit of calculus class.

By all means, release the damn thing.

Situations where it would be handy to find differentials/integrals:
  • Population growth models - people seem to use these a lot for "Sim City" type maps.
  • Calculating areas of oddly-shaped territories
  • Complex game physics - oh weaaddar, can your script do a "best fit" from discrete points?
Situations where you'd need to have the player enter a polynomial:

Never mind, this one's too tough.
12-20-2003, 01:51 PM#12
weaaddar
Well the thing is basic at best. It can only do indefinite Integrals & Deravatives from straight polynomials using the power rules. (f(x)=c*x^n then f'(x)=n*c*x^(n-1) and if f(x)=c*x^n then F(x)=(cx^(n+1))/(n+1)).
It does not know the chain rule, nor multiplication or devision rule. It does not know ANY rules of integrals...

As far as graphing the polynomial or factoring or even solving the polynomail will be quite difficult.

I'll be releasing the code as is, as the functions are hideous to look upon at best.
12-20-2003, 03:05 PM#13
Vexorian
I am sure that you made an incredibly good work with them, but I can't find any use for that stuff in wc3 modding. Of course release them since they can have teaching purposes
12-20-2003, 03:23 PM#14
Darimus
There's no reason not to release it... cuz if u don't u spent alot of time doing pointless work for no reason...

Besides... if someone really needs to use it... I doubt they would spend all that time making on their own, and just use a different mathimatical operation..
12-20-2003, 07:09 PM#15
chemo
weaaddar u seem to understand the basic in math :)
so please tell me how make an example of this in the world editor:
_
V16 = 4 ( everybody knows that, but how does the calculator gets to the correct result ?)
____________
how would u set up an equation for: V0.324394883 = ?

because ive never seen anybody who actually made a solid prove of the
_
V before... so maybe u could be the first one to prove for me =?