Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


[VB.net} Linear, Quadratic, & Cubic Expressions

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
Jorg hi
I post too much
Reputation: 7

Joined: 24 Dec 2007
Posts: 2276
Location: Minnesota

PostPosted: Tue Oct 27, 2009 4:14 pm    Post subject: [VB.net} Linear, Quadratic, & Cubic Expressions Reply with quote

Hello I've created a program that can find the equation to a pattern just by comparing and bruteforcing the values of a data set.



I've only done the Linear Part so far, I'm a 9th grader and I'm currently learning Geometry. Can anybody help me on the Quadratic & Cubic, or at least show me how I would I do it?

Thanks.

_________________
CEF will always stay alive.
Back to top
View user's profile Send private message
Flyte
Peanuts!!!!
Reputation: 6

Joined: 19 Apr 2006
Posts: 1887
Location: Canada

PostPosted: Tue Oct 27, 2009 4:29 pm    Post subject: Reply with quote

Needs more linear algebra: http://en.wikipedia.org/wiki/Least_squares
Back to top
View user's profile Send private message
&Vage
Grandmaster Cheater Supreme
Reputation: 0

Joined: 25 Jul 2008
Posts: 1053

PostPosted: Tue Oct 27, 2009 4:36 pm    Post subject: Reply with quote

Not hard...
Code:

for(int i = 0; i<10; i++){
printf("%d %d\n", i, (7*i)+23);
}
Back to top
View user's profile Send private message
Flyte
Peanuts!!!!
Reputation: 6

Joined: 19 Apr 2006
Posts: 1887
Location: Canada

PostPosted: Tue Oct 27, 2009 4:38 pm    Post subject: Reply with quote

&Vage wrote:
Not hard...
Code:

for(int i = 0; i<10; i++){
printf("%d %d\n", i, (7*i)+23);
}


Thanks for showing you don't even understand basic algebra, nor do you understand what the OP is even asking. Get out.
Back to top
View user's profile Send private message
Jorg hi
I post too much
Reputation: 7

Joined: 24 Dec 2007
Posts: 2276
Location: Minnesota

PostPosted: Tue Oct 27, 2009 5:12 pm    Post subject: Reply with quote

Athaem wrote:
&Vage wrote:
Not hard...
Code:

for(int i = 0; i<10; i++){
printf("%d %d\n", i, (7*i)+23);
}


Thanks for showing you don't even understand basic algebra, nor do you understand what the OP is even asking. Get out.


Well, forget what I meant about Bruteforcing, it actually doesn't at all. For the linear part it find the slope & the Y intercept and creates the equation from there. But the Quadratic part solving method is much harder and BruteForcing isn't an option.

Edit: Idea. I'll just find the differences of the 2nd values example:

2y|4|10|20|34|52
x=1|2|3|4|5|
y=2|5|10|17|26|
diff1=3|5|7|9|
diff2=2|2|2|
diff3=0|0

2 * 2 = 4 Difference = 1
2 * 5 = 10 Difference = 3
2 * 10 = 20 Difference = 5
2 * 17 = 34 Difference = 7
2 * 26 = 52 Difference = 9

Solution: Y = X² + 1


This would be too insane for me to program if the equation was like this
Y = X² + aX + B

Any Ideas?

_________________
CEF will always stay alive.
Back to top
View user's profile Send private message
&Vage
Grandmaster Cheater Supreme
Reputation: 0

Joined: 25 Jul 2008
Posts: 1053

PostPosted: Tue Oct 27, 2009 7:19 pm    Post subject: Reply with quote

Athaem wrote:
&Vage wrote:
Not hard...
Code:

for(int i = 0; i<10; i++){
printf("%d %d\n", i, (7*i)+23);
}


Thanks for showing you don't even understand basic algebra, nor do you understand what the OP is even asking. Get out.
You're fucking ignorant in the worst way possible, I was showing what OP did, I never said it was right.

Correct way would be

0, 23
1, 30
2, 37... and so on.

Slope would be 7, so th so y would be for example if the value of y would increase +7 for every time x would increase by 1.

Y intercept would be 23 btw, that means that the location of y on the grid would be 27 when x is on 0. Get @ me.
Back to top
View user's profile Send private message
Flyte
Peanuts!!!!
Reputation: 6

Joined: 19 Apr 2006
Posts: 1887
Location: Canada

PostPosted: Tue Oct 27, 2009 7:30 pm    Post subject: Reply with quote

&Vage wrote:
You're fucking ignorant in the worst way possible, I was showing what OP did, I never said it was right.

Correct way would be

0, 23
1, 30
2, 37... and so on.

Slope would be 7, so th so y would be for example if the value of y would increase +7 for every time x would increase by 1.

Y intercept would be 23 btw, that means that the location of y on the grid would be 27 when x is on 0. Get @ me.


I honestly can't believe people as retarded as you even exist on this earth, I would have thought natural selection would have killed you off by now.

You weren't even close to showing what the OP did. The code you posted simply looped through the variables to display the corresponding (hard-coded) function. That's the exact opposite of what he is asking; nice try covering up with a shitty explanation though.
Back to top
View user's profile Send private message
&Vage
Grandmaster Cheater Supreme
Reputation: 0

Joined: 25 Jul 2008
Posts: 1053

PostPosted: Tue Oct 27, 2009 7:38 pm    Post subject: Reply with quote

Athaem wrote:
&Vage wrote:
You're fucking ignorant in the worst way possible, I was showing what OP did, I never said it was right.

Correct way would be

0, 23
1, 30
2, 37... and so on.

Slope would be 7, so th so y would be for example if the value of y would increase +7 for every time x would increase by 1.

Y intercept would be 23 btw, that means that the location of y on the grid would be 27 when x is on 0. Get @ me.


I honestly can't believe people as retarded as you even exist on this earth, I would have thought natural selection would have killed you off by now.

You weren't even close to showing what the OP did. The code you posted simply looped through the variables to display the corresponding (hard-coded) function. That's the exact opposite of what he is asking; nice try covering up with a shitty explanation though.
Compared to linking a freshman to equations that he hasn't even learn till he's a junior? Actually I take back you being ignorant, there's no word that can comprehend your stupidity. Thought idiots like you don't exist anymore.

OP: Maybe this will help; http://library.thinkquest.org/2647/algebra/ftpolyno.htm
Back to top
View user's profile Send private message
Jorg hi
I post too much
Reputation: 7

Joined: 24 Dec 2007
Posts: 2276
Location: Minnesota

PostPosted: Wed Oct 28, 2009 2:38 pm    Post subject: Reply with quote

The thing is, how can I create the equation from a pattern. I'll check more on that stuff tommarrow. Pss. I'm a freshman doing Algebra ll & Geometry which is suppose to be for advanced juniors in my school.

Edit:CAN ANYONE HELP.. I don't want to waste time using a bruteforcer, anyone know what I can do????

EDIT: SEXY! I've made a quadratic auto solver that detects from a pattern Cool . SEXY!!!! Time to do cubic. Lol I don't even know what that is yet...

Edit: Bruteforcing takes a long time to find a cubic pattern. If any mathematician or something can help me create a method of doing THIS.

EDIT: FUCKING SEXY!!!
I'm going to get an A on every homework assignment now XD

Whats next after cubic? I wonder if I can make this pseudo so it can go for all of them!




Edit:Yes you see a 1, the textbox's font is too large.

Edit:It takes 15.932 seconds to find this equation from a pattern.

Code:
Y = 9x³ + 5x² + 16x + 100


Edit:SOMETHING is wrong. I tested this with a cubic function that has a decimal for the yintercept and my program showed "Y = 9x³ + 5x² + 16x + 1" when its suppose to be "Y = 9x³ + 5x² + 16x + 1.1".

Is there something with the For i = 0 to 100 loop??? I declared the i as a Decimal...???

_________________
CEF will always stay alive.
Back to top
View user's profile Send private message
TanLiHao
Grandmaster Cheater Supreme
Reputation: 0

Joined: 26 Jan 2007
Posts: 1220
Location: Singapore

PostPosted: Fri Oct 30, 2009 10:04 pm    Post subject: Reply with quote

Jorg Hi so you managed to complete the quadratic equation right?


But anyway I will give you the formulaes for all three types you said.

For a linear equation, it is extremely simple

The equation can be gotten like this,

Code:
y - y1 = m(x - x1)
m is the gradient.

So you sub in a one x1 value and one y1 value into the general equation above. Then you find the gradient by using two coordinates.

As for a quadratic equation, it is a little more complicated, you form three equations to obtain the expression.

Because this is more complicated, I will give an example for this.

Say the equation is y = 2x² + - x - 6
So let's pick out some random coordinates, we need at least three coordinates, so say we x = 3, x = 5 and x = 6.

So the coordinates are (3, 9), (5,39) and (6,60)

We let f(x) = ax² + bx + c

So we do f(3) = a(3)² + b(3) + c = 9
9a + 3b + c = 9 - (1)

f(5) = a(5)² + b(5) + c = 39
25a + 5b + c = 39 - (2)

f(6) = a(6)² + b(6) + c = 60
36a + 6b + c = 60 - (3)

We minus equation (2) with equation (1), that will cancel out the constant c, this will always happen, so it's always done as the first step.

So now we get 16a + 2b = 30
Rearranging the formula, we get b = (30 - 16a) / 2 - (4)

Now we sub (4) into (1), you can sub it into (2) also but it's the same anyway.

We now get 9a + 45 - 24a + c = 9
Rearranging the formula, we get c = -36 + 15a - (5)

We now sub (4) and (5) into (3)

36a + 90 - 48a - 36 + 15a = 60
So we solve for a, and get a = 2

Now we sub a = 2 into (4)

b = (30 - 16(2)) / 2
= -1

Sub a = 2 into (5)

c = -36 + 15(2)
= -6

So now since we know a,b,c, y = ax² + bx + c
y = 2x² - x - 6

Did you see we just got back our equation.

Likewise this can be done for cubic equations, but you need four equations instead and it will be y = ax³ + bx² + c + d.

There may be other methods but this is the easiest to understand and implement I suppose.
Back to top
View user's profile Send private message
igoticecream
Grandmaster Cheater Supreme
Reputation: 0

Joined: 23 Apr 2006
Posts: 1807
Location: 0x00400000

PostPosted: Sun Nov 08, 2009 9:36 am    Post subject: Reply with quote

The Jorg hi wrote:

This would be too insane for me to program if the equation was like this
Y = X² + aX + B

Any Ideas?


(-b ± (b² - 4ac)½)/2a


note: ½ <-> root
note2: this will throw 2 values, this is the way of resolving quadractic expressions

more info: http://en.wikipedia.org/wiki/Quadratic_equation

_________________
+~
Back to top
View user's profile Send private message
TanLiHao
Grandmaster Cheater Supreme
Reputation: 0

Joined: 26 Jan 2007
Posts: 1220
Location: Singapore

PostPosted: Sun Nov 08, 2009 10:10 pm    Post subject: Reply with quote

He's not trying to solve an equation, he is trying to get an expression for an equation based on the values.
Back to top
View user's profile Send private message
Chaosis13
Master Cheater
Reputation: 0

Joined: 14 Aug 2007
Posts: 372

PostPosted: Mon Nov 09, 2009 4:45 pm    Post subject: Reply with quote

You should look into neuron networks. I have recently gotten very interested in them, and it seems like they could be used to easily solve any polynomial.

EDIT:
I don't know if you are still doing this, but I made a neuron network today that can effectively solve certain patterns.
Back to top
View user's profile Send private message
kitterz
Grandmaster Cheater Supreme
Reputation: 0

Joined: 24 Dec 2007
Posts: 1268

PostPosted: Wed Nov 18, 2009 9:44 pm    Post subject: Reply with quote

Dim X1 as integer
Dim X2 as integer
Dim Y1 as integer
Dim Y2 as integer

Dim m as double = (Y2 - Y1) / (X2 - X1)

Dim y as String = m.ToString + "x" + (- m*x1 + y1).ToString

_________________
Back to top
View user's profile Send private message Send e-mail
WaffleMaster
Grandmaster Cheater Supreme
Reputation: 0

Joined: 19 Oct 2006
Posts: 1237

PostPosted: Wed Nov 18, 2009 11:54 pm    Post subject: Reply with quote

Try looking at the source code for microsoft math 2007 if you want to know how to quickly solve for the equation. It's made in C#, so you can just use reflector to disassemble it (MS didn't even pack it or anything).
_________________
Problem, CEF?

Buying zhelms/leech in Windia. PM me.
Back to top
View user's profile Send private message AIM Address
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites