PDA

View Full Version : Expressing loops etc. in math.

sean
07-17-2002, 02:34 PM
Well I'm still working on that universal equation thing. I have a series of equations, all related - like a series of steps to take - one follows the other. I calculate the value of a variable, r, based on x. If r is equal to 1, then I finish up the calculation because I know everything is set up right. If not, then I want to increase d by 1, and then repeat the calculation. Is there a standard mathematical way of expressing this?

And one more question: In multivariable-differential calculus, if your calculating dy/dx as x->0, couldn't you just add one to the exponent of each x in the equation of change in y/change in x? It seems to work and is a lot simpler than waht my book says.

MethodMan
07-17-2002, 05:48 PM
Originally posted by Sean
Well I'm still working on that universal equation thing. I have a series of equations, all related - like a series of steps to take - one follows the other. I calculate the value of a variable, r, based on x. If r is equal to 1, then I finish up the calculation because I know everything is set up right. If not, then I want to increase d by 1, and then repeat the calculation. Is there a standard mathematical way of expressing this?

And one more question: In multivariable-differential calculus, if your calculating dy/dx as x->0, couldn't you just add one to the exponent of each x in the equation of change in y/change in x? It seems to work and is a lot simpler than waht my book says.

I dont know the answer to the first question, but the second one sounds familiar, what section is it under, so I can take a look, I may be able to help out a little more.

toaster
07-17-2002, 06:16 PM
express loops mathematically?

remember the "E" thingy as in:

n<stuff
E( stuff )
n=0

as to make a mathematical formula out of your problem, I'm unable to do right now since I'm currently brain dead. I'll try to respond again when my headache is over.

Xterria
07-17-2002, 07:52 PM
WHAT DOES THAT E(greek sigama) ACTUALLY DO IN MATH?!?!?! I'VE LOOKED EVERYWHERE AND THEY GIVE ME GARBAGE ANSWERS?!!!!!!!!!!!!!!

boo hooo

MethodMan
07-17-2002, 07:55 PM
Originally posted by Xterria
WHAT DOES THAT E(greek sigama) ACTUALLY DO IN MATH?!?!?! I'VE LOOKED EVERYWHERE AND THEY GIVE ME GARBAGE ANSWERS?!!!!!!!!!!!!!!

boo hooo

It symbolizes sum.
So
n = 0
E (n = n+1)
n = 10

so a sum from 0 to 10, substituting n into the equation in ()

Xterria
07-17-2002, 08:06 PM
wtf? 0+1 is not 10!
help?

MethodMan
07-17-2002, 08:09 PM
Originally posted by Xterria
wtf? 0+1 is not 10!
help?

You start with n = 0, and you go up to n = 10

so the equation is n = n+1, or u can say k = n +1
so k = 1 (n=0), 2 (n = 1), 3 (n = 2)

toaster
07-17-2002, 11:48 PM
Originally posted by Sean
Well I'm still working on that universal equation thing. I have a series of equations, all related - like a series of steps to take - one follows the other. I calculate the value of a variable, r, based on x. If r is equal to 1, then I finish up the calculation because I know everything is set up right. If not, then I want to increase d by 1, and then repeat the calculation. Is there a standard mathematical way of expressing this?

And one more question: In multivariable-differential calculus, if your calculating dy/dx as x->0, couldn't you just add one to the exponent of each x in the equation of change in y/change in x? It seems to work and is a lot simpler than waht my book says.

that's a hectic thing to follow. I should take back my words I said when I was in pain. first I do believe anything, but limited, expressed in programming can be translated into mathematical terms. however, making formulas can be quite fustrating at times. since I do not exactly know how the calculations are, I can try with the series and a function and play around with it and add other terms if necessary. maybe I can start by making the function control how the series goes (all those complex algorithms). I might as well not continue with the stuff I do not understand that I am saying.

anyway, with the limts that u were talking about, the values get closer and closer to a value (for when very precise values are needed). I forget but Dalton might be one of the first to start the idea with limits or something. the book is a reference telling you exactly how the thing works. shortcuts? I think there are plenty for this but sometimes they don't work for certain problems.

I think I need to rest before I continue (this is what vacation does to people). :(

reference I suggest:

http://mathworld.wolfram.com/

also, these guys (professionals) might help out at :

http://www.mathforum.org/dr.math/

sean
07-18-2002, 10:51 AM
Exterria - it symbolizes sum, but it's usually only used with differentiation. For example, if you have a series (pretend that any number preceded by a \ is subscript), you can get the sum. Say n is as follows: n \1 = 1, n\2 = 2 n\3 = 4, n\4 = 8 n\5 = 16.
En (with a superscript 1 and a subscript 5 below it) would equal 1 + 2 + 4 + 8 + 16 = 31.

I've considered using that in a variety of ways, but what I need to do is perform all the calulations with d=1, and if r != 1 then I need to increment d and do all the calculations again. It's a series of equations that all follow off from eachother.

Govtcheez
07-18-2002, 10:53 AM
> but it's usually only used with differentiation.

You mean integration? (since, AFAIK, the integral symbol's meant to look like an S, for Sum)

sean
07-18-2002, 10:54 AM
And also, no, 0+1 does not equal 10, but it would if we could get a mathematical loop in there - that's the kind of loop I'm talking about just to repeat I can just put another equation in there easily to increment d. (i.e. d=d+d) ^=delta. So does anyone know of any place they've seen of repeating a calculation? Sigma is close but it's just not quite solving the problem the ways I've tried it. Thanks for the help so far though.

Shiro
07-18-2002, 11:06 AM
You mean such like this?

Pre: true
Post: {r == 1}

d = ?
r = ?
while (r != 1) do
begin
r = f(x)
{(r == 1 || r != 1) <-> true}
if (r == 1)
{r == 1}
break;
else
{r != 1}
d = d + 1
end
{r == 1}

This is not complete, since there is no information available about variable d.

>In multivariable-differential calculus, if your calculating dy/dx as
>x->0, couldn't you just add one to the exponent of each x in the
>equation of change in y/change in x?

?

y = x^n
dy/dx = n x^(n-1)

sean
07-18-2002, 11:11 AM
First answer: I mean pure mathematical - no programming.

Second answer: My fault actually - I meant single-variable. I actually didn't need to post that - I had it right here in my book! Thanks anyway.

sean
07-21-2002, 08:31 AM
One other thing.... well two other things:

1) Are there just 4 degrees of equations, or is their an infinite amount?

2) If it is just four, I could write out the equation for times, and then have some way of testing the value of a variable, like the if statement, but again, it would have to be completely mathematical.

And in response to the original question's answers - I was thinking about the sum thing - if I summed all the possibilties, divided them by four (again - dependant on there only being four degrees), that would just be the average. But if I could get an equation that modified the average dependant on the degree, then it would work. Anyone?

salvelinus
07-21-2002, 12:27 PM
Shiro, I think you're mixing languages. No "begin" or "end" in C++, also need some ;'s at the end of statements.
As far as the math, no idea.

MethodMan
07-21-2002, 12:35 PM
Originally posted by Sean
Exterria - it symbolizes sum, but it's usually only used with differentiation.

Um. No. Its not only used with Differentiation. You dont know what you are talking about. Its used in sequences and series, as well as recursion.

Shiro
07-21-2002, 02:35 PM
>Shiro, I think you're mixing languages. No "begin" or "end" in
>C++, also need some ;'s at the end of statements.

I know, it was meant to be pseudocode, a mix of Pascal and C. But that was not the point, it was just the algorithm where it was about. And Pascal has some elements which makes algorithms more readable.

>1) Are there just 4 degrees of equations, or is their an infinite
>amount?

What do you mean by degree of equation? You mean higher order differential equations? In that case, this could be infinite, however, I've never seen the symbol infinite appearing as order in differential equations. You mean such like this?

d^n y
------- = ....
d^n x

fyodor
07-21-2002, 05:37 PM
but it's usually only used with differentiation.

No, it's used in pretty much all areas in math for very diverse purposes. And I don't recall ever seeing it in connection with differentiation.

Are there just 4 degrees of equations, or is their an infinite amount?

Well, only up to fourth degree polynomials can be solved analytically. Or rather, the general quintic cannot be solved algebraically, although there are some special cases I think.

And one more question: In multivariable-differential calculus, if your calculating dy/dx as x->0, couldn't you just add one to the exponent of each x in the equation of change in y/change in x? It seems to work and is a lot simpler than waht my book says.

Do you mean "as the change in x approaches 0"? And I'm not sure what you mean by "add one to the exponent of each x in the equation..." part?

sean
07-21-2002, 06:01 PM
Wow... considering I had to fish this out of page 5 in order to post that last post of mine, there's a lot of replies.

Fyodor and MethodMan - true, but I meant as opposed to integration. When they want the sum in integration they use that big S thing (what's that called anyway?) I guess that was badly worded - my fault sorry.

Shiro - I mean like there's linear (y=mx+b, the basic one), and then there's quadratics and cubics, which have more terms and involve exponents. Again - badly worded. I should've said degrees of curves. I've only ever heard of four, but just in case there are more, I need to make sure my equation allows for an infinite number of degrees. In my case, the degree will be a variable in the equation, so it's not a huge problem, I'd just like to know.

Fyodor - your first quote is answered above with MethodMan, but you probably already saw that. Your second - thanks - answers my question perfectly, and the third - if you'll scroll down to near the bottom on Page 1, you'll another post by me - I cancelled that question because I found it in my book, and yes, once again - badly worded on my part.

Sorry about all that! And thanks for the help!

golfinguy4
07-21-2002, 06:26 PM
It could be degree whatever.

y=4x^7
y=x^31

sean
07-21-2002, 09:30 PM
Bummer...

Well I guess I'll just have to look for ways other people have done this and ways that have kind of been accepted as standard. That average compensation equation thing might be a good idea. If I could just figure out some example data and solve that pattern.

Shiro
07-22-2002, 11:12 AM
>I should've said degrees of curves.

In theory, the degree can be any.

1-st order linear equation
y = a x + a

2-nd order linear equation
y = a x^2 + a x + a c

3-th order linear equation
y = a x^3 + a x^2 + a x + a

n-th order linear equation
y = a x^n + a x^(n-1) + ... + a[n] x + a[n+1]

What should the "universal equation thing" do?

BTW, I forgot what the purpose of the "universal equation thing" was. Wasn't it about curve fitting or something like that?

sean
07-22-2002, 04:00 PM
Well the original idea was to have a library that used the law of finite differences to find patterns and decode information, and eventually it turned into and equation that did the same thing but with least-squares regression. I got an applet from Bryan Lewis, a mathematician at Kent State and I made a flow-chart out of everything that it did, and if I can figure out this loop/decision thing, I'll be able to express it as an equation, that uses a series of series to hold the data, and a variable that is incremented by one each time, to calculate all the possible elements of the 4th degree equation. If it's lowerthe unused elements work out to be 1 or 0, and thus hav no effect on the equation. For example the equation of a straight line would calculated (eventually. There are other equations which work out the accuracy of it) to be Y=(equation for the slope)x+(equation for the y-intercept). Ideally it can take any numerical values and eventually find a pattern that explains it - very useful.