Author Topic: Sums, Pascal, and Equations for Sets  (Read 12580 times)

0 Members and 1 Guest are viewing this topic.

Offline Xeda112358

  • they/them
  • Moderator
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 4704
  • Rating: +719/-6
  • Calc-u-lator, do doo doo do do do.
    • View Profile
Sums, Pascal, and Equations for Sets
« on: March 31, 2011, 12:14:48 am »
So pretty much, this is a direct copy/paste from my post on UTI:
Okee dokey then, so I have been working for the past two days on forming equations for finite sets of data. For example, if I have {0,-33,i,27,6}, I would want to find an equation where if x=0, then the result is 0, and if x=1, the result is -33, et cetera. I have a method that accomplishes this and I have explored it much in the past few days, but I get the feeling there is either an easier way or this method is just something I haven't gotten to, yet. Anyway, here is what I do...
First, to make things simpler, I want to make two sets (one real and the other imaginary), so I end up with:
{0,-33,0,27,6}+i{0,0,1,0,0}. I want to tackle one at a time, so I arrange the first list into a column like so:
Code: [Select]
  0
-33
  0
 27
  6
Now from there, you make a second column that is the difference of Un+1 and Un:
Code: [Select]
  0
-33   -33-0=-33
  0   0--33=33
 27    27-0=27
  6    6-27=-21
And from then you add another column using the same idea until you reach one element in the column:

Now from there, fill the last column space with 30. From there, you can work your way backwards to fill in the rest of the columns:

At this point, we should denote the column spaces in this manner:
a-First column space (the original numbers)
b-Second column space
c-Third column space
d-Fourth column space
e-Last column space

So, looking at the matrix, e follows the equation y=30. Now we move to d which must be -162+sum(e,n,0,x) or -162+30x. c is going to be 300+sum(d,x,0,n) which can be represented as 300-162x+30(x2+x)/2). This can be simplified, but for the sake of making the concept clear, I will not simplify it. As we continue with the last two, we get:
b=-201+300x-162(x2+x)/2+30(x3+3x2+2x)/6
a=-201x+300(x2+x)/2-162(x3+3x2+2x)/6+30(x4+6x3+11x2+6x)/24

And that is the equation for the real part of the original set of numbers. Applying the same method, we get for the imaginary part:
ai=i(-10x+25(x2+x)/2-21(x3+3x2+2x)/6+6(x4+6x3+11x2+6x)/24)

And now we simply need to combine the two equations to get the ridiculously large equation:
-201x+300(x2+x)/2-162(x3+3x2+2x)/6+30(x4+6x3+11x2+6x)/24+i(-10x+25(x2+x)/2-21(x3+3x2+2x)/6+6(x4+6x3+11x2+6x)/24)

Anyway, that is the method I have used and explored and that is the long, tedious way of obtaining results. The faster way will require the use or knowledge of Pascal's Triangle and by knowledge... hehehe, this ties into some of my other explorations that I haven't gotten into here...
For a quick way to obtain the diagonals, let us represent those as {a,z,y,x,w,...} and we can look at it in this form:
Code: [Select]
[[a l m n o ...
  b z
  c   y
  d     x
  e       w
...         ]]
a=a
z=b-a
y=c-2b+a
x=d-3c+3b-a
w=e-4d+6c-3b+a
...
If you notice those coefficients, you will note the relationship to Pascal's Triangle. There is another relationship you may not have noticed in the first example. Firstly, it should be pretty clear that taking the values in row 1, we have the coefficients required for the end equation. Those coefficients go along with some polynomial and those polynomials are the equations to the diagonals of Pascal's Triangle. So, if the first diagonal (all 1s) is represented as P0, then the equations are as follows:
P0=1
P1=x
P2=(x2+x)/2
P3=(x3+3x2+2x)/6
P4=(x4+6x3+11x2+6x)/24
...
The pattern is fairly easy:
P0=1
P1=Σ1
P2=ΣΣ1
P3=ΣΣΣ1
P4=ΣΣΣΣ1
So P4 should be read as the sum of the sum of the sum of the sum of 1. SO using the above notation (in the code box), the equation that hits {a,b,c,d,e,...} would be a*P0+l*P1+m*P2+n*P3+o*P4...

So it would be nice to have {a,l,m,n,o,...}, right? Well that, too, makes use of Px as well as an alternating negative sign. As examples:
a=a
l=z-y+x-w...
m=y-2x+3w-4v...
n=x-3w+6v-10u...
o=w-4v+10u...
...
If you notice the coefficients there, you will note that:
a= uses 0 for its coefficients
l= uses P0 for its coefficients
m= uses P1 for its coefficients
n= uses P2 for its coefficients
o= uses P3 for its coefficients
...

So now with that in mind, we can model this simple set of data: {π²,-3,6,2}
a=π²
b=-3
c=6
d=2

So:
Code: [Select]
a=a         = π²        = π²
z=b-a       = -3-π²     = -3-π²
y=c-2b+a    = 6+6+π²    = 12+π²
x=d-3c+3b-a = 2-18-9-π² = -25-π²

Code: [Select]
a=a         = π²                  = π²
l=z-y+x     = -3-π²-12-π²-25-π²   = -40-3π²
m=y-2x      = 12+π²+50+2π²         = 62+3π²
n=x         = -25-π²              = -25-π²
And finally the equation:
π²P0+(-40-3π²)P1+(62+3π²)P2+(-25-π²)P3
Which turns to:
π²+(-40-3π²)x+(62+3π²)(x2+x)/2+(-25-π²)(x3+3x2+2x)/6

So anywho, there are probably a few things I missed and maybe a few mistakes, but is there an easier approach to this?

Offline AngelFish

  • Is this my custom title?
  • Administrator
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3242
  • Rating: +270/-27
  • I'm a Fishbot
    • View Profile
Re: Sums, Pascal, and Equations for Sets
« Reply #1 on: March 31, 2011, 02:01:35 am »
I hope I'm not the only person whose eyes glazed over and skipped straight to the last line :P

Now to read the thing for real to figure out what you were doing that could be done more efficiently.

EDIT: What you're talking about is known as Interpolation. It's actually a very well developed field, but I've never seen an approach quite like yours. In any case, for any set of N points, there is at least one function of degree N-1 that fits all of those points exactly.  So, I'd recommend looking at Gaussian Interpolation. Just be warned that problems can arise with Interpolation because the functions may not behave realistically in the intervening interval.
« Last Edit: March 31, 2011, 02:05:26 am by Qwerty.55 »
∂²Ψ    -(2m(V(x)-E)Ψ
---  = -------------
∂x²        ℏ²Ψ

Offline phenomist

  • LV4 Regular (Next: 200)
  • ****
  • Posts: 132
  • Rating: +46/-3
    • View Profile
Re: Sums, Pascal, and Equations for Sets
« Reply #2 on: March 31, 2011, 02:04:29 am »
I believe this is Newton interpolation. Note that the non-coefficients can be reexpressed as x/0!, x(x+1)/1!, x(x+1)(x+2)/2!, etc. Unless you already noticed that :P
Level Designer for Graviter

[Disclaimer: I can't program for my life.]

Offline AngelFish

  • Is this my custom title?
  • Administrator
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3242
  • Rating: +270/-27
  • I'm a Fishbot
    • View Profile
Re: Sums, Pascal, and Equations for Sets
« Reply #3 on: March 31, 2011, 02:06:41 am »
Darn it, ninja'd by a post after my own :P

Also, that should be Polynomial interpolation in my previous post, not Gaussian.
∂²Ψ    -(2m(V(x)-E)Ψ
---  = -------------
∂x²        ℏ²Ψ

Offline Xeda112358

  • they/them
  • Moderator
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 4704
  • Rating: +719/-6
  • Calc-u-lator, do doo doo do do do.
    • View Profile
Re: Sums, Pascal, and Equations for Sets
« Reply #4 on: March 31, 2011, 10:19:49 am »
Ah, cool! And how exactly might I go about finding these coefficients besides using the Riemann Zeta function+Horowitz Zeta function? Right now, I am simply using my knowledge of the equations, so I only have up to 47 degree polynomials readily available. I was pretty curious about what I was doing after a friend challenged me to model {0,1,0,1,0,1}... We compared it to sine and since he didn't know about Taylor's series, I showed him that. Although, though the two equations matched certain parts of the sine curve, the Taylor series matched a slightly different part and is used for estimating sine. The one I used was only meant to hit the points that sine happened to hit XD Anywho, I will check out this Interpolation stuff...

But yeah, the main thing I want to attack is finding those polynomials! :D There are some very obvious patterns like with those summation equations I was working on and it uses those (or at least I used those to find the Pascal's diagonals).

Not an EDIT: Wait, do those coefficients follow like x(x+1)(x+2)(x+3)...(x+n)/n! ? Because I used the whole sum of the sum of the (et cetera) idea and I was simply using some notes on other ventures I made...
The image:
http://www.omnimaga.org/index.php?action=dlattach;topic=5618.0;attach=4841;image
The topic:
http://ourl.ca/8215/150613

The last one includes a bunch of my notes, too :)

EDIT:
Also:
In any case, for any set of N points, there is at least one function of degree N-1 that fits all of those points exactly.
Actually, so long as the set is finite, there are infinitely many equations that pass through those points. That was another thing I was trying to show with this. All you need to do is add any number to the end of the set and you change the equation. It will still pass through the set of numbers that you want :) And then you can add some other arbitrary number and so on :)

Offline AngelFish

  • Is this my custom title?
  • Administrator
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3242
  • Rating: +270/-27
  • I'm a Fishbot
    • View Profile
Re: Sums, Pascal, and Equations for Sets
« Reply #5 on: March 31, 2011, 01:30:24 pm »
Quote
Actually, so long as the set is finite, there are infinitely many equations that pass through those points. That was another thing I was trying to show with this. All you need to do is add any number to the end of the set and you change the equation. It will still pass through the set of numbers that you want Smiley And then you can add some other arbitrary number and so on

True, but the existence of at least one distinct solution is a sufficient condition ;)

Also, the set {0,1,0,1,0,1,0,1,...} could probably be described by Sine or Cosine, but I think the function (2)^(x mod 2)-1 is much simpler.
∂²Ψ    -(2m(V(x)-E)Ψ
---  = -------------
∂x²        ℏ²Ψ

Offline Xeda112358

  • they/them
  • Moderator
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 4704
  • Rating: +719/-6
  • Calc-u-lator, do doo doo do do do.
    • View Profile
Re: Sums, Pascal, and Equations for Sets
« Reply #6 on: March 31, 2011, 02:26:38 pm »
Oh, yeah, I know, but my friend wanted to see how the equation handled a 5th degree polynomial approximation of a sin equation :D Again, he had never heard of Taylor series, so he was fairly excited when he saw me working with these. I guess he thought it would be a challenge xD. Anywho, here is a comparison...

EDIT: Cool! I just checked and the diagonals in Pascal's Triangle do seem to follow the pattern where:
Pn=x(x+1)(x+2)...(x+n-1)/n!

Cool! That will be mightily useful!

Offline phenomist

  • LV4 Regular (Next: 200)
  • ****
  • Posts: 132
  • Rating: +46/-3
    • View Profile
Re: Sums, Pascal, and Equations for Sets
« Reply #7 on: March 31, 2011, 06:28:09 pm »

Also, the set {0,1,0,1,0,1,0,1,...} could probably be described by Sine or Cosine, but I think the function (2)^(x mod 2)-1 is much simpler.


How about the function (x mod 2)? :P


@Xeda: might help: http://en.wikipedia.org/wiki/Newton_polynomial. If you independently worked all of that out, that's pretty impressive :P
« Last Edit: March 31, 2011, 06:28:51 pm by phenomist »
Level Designer for Graviter

[Disclaimer: I can't program for my life.]

Offline Xeda112358

  • they/them
  • Moderator
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 4704
  • Rating: +719/-6
  • Calc-u-lator, do doo doo do do do.
    • View Profile
Re: Sums, Pascal, and Equations for Sets
« Reply #8 on: March 31, 2011, 10:09:17 pm »
Disclaimer: I have had coffee for the first time this year and coffee=drugs for Zedas :w00t:. Read the following at your own risk because I am completely buzzed on coffee and I cannot keep my thoughts in order... I'ma go do some maths for now  :crazy:
Not an Edit: Cool, I can use emoticons!

Hehe, I cannot seem to get things like Linear Algebra (!_!) or things like that, but all of the stuff I work on I do independently. :/ The problem with that is that before this semester of college, I was never exposed to formal stuff (or at least rarely exposed), so my notation tends to be a little on the questionable side :D The other problem is that whenever I go to Wolfram to see if my ideas already exist, I cannot find answers because I cannot read any of it and I don't know what to look for. For example, back in ninth grade I got super excited because I was playing around on my calc with this really cool sine function thingamabob and I started noticing a pattern. By the end of the night I found a way to do things like finding the exact value of sin(171pi/1024)! That November, I was going to a math competition and I showed off my cool formula to a professor and they didn't recognise it, but they said "Here's my e-mail and check Wolfram.com for" and he used a term I forgot, but it described taking the square root of the square root of the... you get the idea. Eventually I found out it was just some random and obscure pattern. Since then I found another method, but I cannot find it on wolfram x.x Another example is last year (26 January 2010) I cracked open an old trig book that a friend gave me in seventh grade when a little slip of paper fell out that said N=.5A2+.5A and I had a drawing of bricks next to it and I remembered, "Oh, that was the day my mother had to take me to the bank with her and I decided to count bricks..." I then got distracted and I counted at the top in the center 1 brick. Then there were two bricks below that touched that brick. Then three and four and five, et cetera. I spent that day finding a way to make an equation for it (I felt special because I taught myself Algebra using an old TI-99 in fourth grade... there is a nice story, there, too). Back on topic... I eventually worked out that if I took the number of bricks there were (heightwise) and divided it by two, I could add .5 and multiply by the number of bricks tall it was to get all of the bricks! Anywho, I found that slip of paper and I was waiting to take my French midterm so I thought "Huh, what if I had a pyramid that had one brick on top, 4 below that and 9 below that, and so on..." So I got to working on that and I found the equation for that. It that hit me after the exam that I was finding an equation for the sum of X2! Then I tried doing that with X3 and I found that and then I got home and for the rest of that week I worked my way up to X6. So blah, blah, blah, I worked at it for a long time and then put it aside for the month of March. The work to find X7 Had been so much that I decided to instead work at finding a pattern before attempting anything more. Then, suddenly, I found a pattern in the first week of April! So that night I worked my way up to X9 and over the next three days up to X15. The problem was, the pattern was still difficult for me to grasp and so I took another month to find an algorithm to find the coefficients I needed and within 15 minutes, I was able to expand my collection of equations from the sum of X15 up to X47! When I finally got internet, I posted this over on UTI using an example my poor TI-89 could handle.

So yeah, I actually am not all that good at math, but math is one of those few things that I can get absolutely consumed in and I am bound to eventually come across things. That was how I noticed that the diagonals in Pascal's triangle were simply the sums of the previous diagonal. Of course, I used the algorithm I came up with before to find those sums, so I didn't see that they followed X(X+1)(X+2)...(X+n-1)/n!, so that will be interesting to explore! There is so much that I randomly encounter and I don't even have a brain for math !_! I just have the devotion and it is the only thing I have the devotion for  :'(

EDIT: Sorry for any glaring grammatical errors... read the note at the top for my excuse...

Offline AngelFish

  • Is this my custom title?
  • Administrator
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3242
  • Rating: +270/-27
  • I'm a Fishbot
    • View Profile
Re: Sums, Pascal, and Equations for Sets
« Reply #9 on: March 31, 2011, 11:29:01 pm »
I read this in a mentally hyper/high pitched voice it was was kind of hilarious  ;D

I think most people in America would disagree with you about not being good at math though...
∂²Ψ    -(2m(V(x)-E)Ψ
---  = -------------
∂x²        ℏ²Ψ

Offline Xeda112358

  • they/them
  • Moderator
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 4704
  • Rating: +719/-6
  • Calc-u-lator, do doo doo do do do.
    • View Profile
Re: Sums, Pascal, and Equations for Sets
« Reply #10 on: March 31, 2011, 11:33:00 pm »
I don't know, I have a tough time grasping concepts in math, but I work at it so much that I eventually run across things :/

Offline phenomist

  • LV4 Regular (Next: 200)
  • ****
  • Posts: 132
  • Rating: +46/-3
    • View Profile
Re: Sums, Pascal, and Equations for Sets
« Reply #11 on: April 02, 2011, 03:25:01 am »
Well, you don't need to formalize stuff just like in "everybody else's way". (Just take Ramanujan, for instance.) You can do some pretty amazing stuff independently that nobody else has considered.
Level Designer for Graviter

[Disclaimer: I can't program for my life.]

Offline Xeda112358

  • they/them
  • Moderator
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 4704
  • Rating: +719/-6
  • Calc-u-lator, do doo doo do do do.
    • View Profile
Re: Sums, Pascal, and Equations for Sets
« Reply #12 on: April 07, 2011, 08:44:58 pm »
Okay, so I was playing around with that idea yesterday about how the diagonals in Pascal's triangle are simply the sum of the diagonal before it and I combined that with some other things I did with it and I came up with a few things:
First, Pn(r)=(r+n)!/(r!n!). This means that if you want to check the third diagonal for the seventh number, n=2 and r=6 (because they offset at 0). This yields:
P2(6)=(6+2)!/(6!2!)
P2(6)=40320/1440
P2(6)=28

Because of the closure property under addition and multiplication of integers, we also have that Pn(r)=Pr(n) which can be useful, too. We can also look at nCr alternatively as:
Pn(r)=r+nCr
or
Pn(r)=r+nCn

We also have the definition of nCr as r+nCn=n!/(r!(n-r)!), so we can show the above statements true:

r+nCr=(r+n)!/r!((r+n)-r)!
r+nCr=(r+n)!/r!n!
and:
r+nCn=(r+n)!/n!((r+n)-n)!
r+nCn=(r+n)!/n!r!

So yeah, just a little fun XD I am definitely adding this to my master notebook :D

Offline Xeda112358

  • they/them
  • Moderator
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 4704
  • Rating: +719/-6
  • Calc-u-lator, do doo doo do do do.
    • View Profile
Re: Sums, Pascal, and Equations for Sets
« Reply #13 on: April 11, 2011, 02:35:09 am »
Okay, so I have a program made to automate the process of finding an equation for a set of points. You input a list of points and it stores the equation into Y1 :) The only problem which I have to fix is the calculators rounding error :/ since it has to divide by factorials... blegh Anywho, I'll fix it up tomorrow :)

Offline jnesselr

  • King Graphmastur
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2270
  • Rating: +81/-20
  • TAO == epic
    • View Profile
Re: Sums, Pascal, and Equations for Sets
« Reply #14 on: April 11, 2011, 07:28:36 am »
That's kinda epic Zeda.