Author Topic: Sums, Pascal, and Equations for Sets  (Read 12851 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
Re: Sums, Pascal, and Equations for Sets
« Reply #15 on: April 11, 2011, 08:10:39 am »
^_^ I made one that doesn't have all those decimals, but it is slower to graph. Still, it makes it more accurate when fitting 15 degree polynomials  XD

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 #16 on: September 05, 2011, 09:26:27 pm »
So here is an update. I made a program in Python that will do the same thing as Interpl8 for the calc (pretty much). Just input the list (don't add an ending bracket or starting one) and then when it asks for the file to output to, just do something like equation.txt

Offline 3rik

  • LV3 Member (Next: 100)
  • ***
  • Posts: 92
  • Rating: +8/-0
  • My TI-84+ SE
    • View Profile
Re: Sums, Pascal, and Equations for Sets
« Reply #17 on: September 06, 2011, 11:56:11 am »
I'm not sure if I understood this topic.
Are you trying to find some thing like y=(1.25+0.25i)x4+(-19.5-2i)x3+(82.75+4.75i)x2+(-97.5-3i)x+0 for the set {0, -33, i, 27, 6}?
I used matrices to find the answer and it didn't seem as complicated as that.

I am not in college math so if I totally missed the point please disregard this post.
Userbars

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 #18 on: September 06, 2011, 04:50:51 pm »
This is just my own playing around with math and I don't doubt that there is a much easier way to do this. The method I used is derived from a matrix, actually, too. However, taking the time to squish that matrix down from two dimensions to one was the long, drawn out part. I came up with this as kind of an offshoot of some bigger math problems that I was working on, but I thought it was a neat idea. So yeah, pretty much, this method takes a finite set of data and finds an equation that can model that data.

Offline 3rik

  • LV3 Member (Next: 100)
  • ***
  • Posts: 92
  • Rating: +8/-0
  • My TI-84+ SE
    • View Profile
Re: Sums, Pascal, and Equations for Sets
« Reply #19 on: September 06, 2011, 11:24:30 pm »
Okay. I do stuff like that too. If you want to see my precalculus method of doing it I put it here.

Spoiler For my method of solving the problem if you're curious:

So the objective of this problem is to find a (n-1)th degree polynomial for a finite set of data with n terms.

So if the set has five terms then the general equation would be

ax4+bx3+cx2+dx+e=t

where x is the term number minus 1 and t is the term and a, b, c, d, e are the coefficients.

Using the example of {0, -33 , i, 27, 6}, we can substitute the values in for x and t.

(in this case we have to make the assumption that 0^0 = 1 or else everything falls apart)

0a + 0b + 0c + 0d + 1e = 0
1a + 1b + 1c + 1d + 1e = -33
16a + 8b + 4c + 2d + 1e = i
81a + 27b + 9c + 3d + 1e = 27
256a + 64b + 16c + 4d + 1e = 6

This is can be solved more easily by using matrices (really you can kinda skip to this step)

[A] =
00001
11111
168421
8127931
256641641

[B] =
a
b
c
d
e

[C] =
0
-33
i
27
6

(excuse my messy matrices)

So [A]*[B] = [C]

Since we already know what [A] and [C] are, we need to solve for [B]

[A]-1*[A]*[B]=[A]-1*[C]
[B]=[A]-1*[C]

Multiply and you'll have your coefficients!



I know the TI-84 and the TI-Nspire CX can handle inverse matrices and I know the Nspire can handle non-real values in the matrices.

Otherwise writing algorithms for this isn't that hard to do.

It works for any length of set as long as you can calculate (n-1)(n-1); but the calculator is often imprecise with inverse matrices.

« Last Edit: September 07, 2011, 12:01:57 am by 3rik »
Userbars

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 #20 on: August 05, 2012, 05:02:48 pm »
necro update >.>

Here is an interpolation program that allows you to supply your own x list and y list. Unfortunately, this requires BatLib to be installed as it uses the number to string function (it makes the program much faster, smaller, and I don't need to use other variables).

Now for some more stuff..

I have been working on some pretty cool math that has lead me to figuring out how to make different interpolation models. For example, I could before model data with a polynomial equation, but now I have an algorithm to do exponential data. Here is an example:

I want:
     f(0)=a
     f(1)=b
     f(2)=c
The formula is scary, but really cool:
     f(x)=cx(x-1)/2bx(2-x)a(x-2)(x-1)/2
Try it, it works :D It was a simple process, too. All I did was say:
     eu(0)=a
     eu(1)=b
     eu(2)=c
Then:
     u(0)=ln(a)
     u(1)=ln(b)
     u(2)=ln(c)
Using the first algorithm that I established:
     ln(a) |                    |
     ln(b) |ln(b)-ln(a)         |
     ln(c) |ln(c)-ln(b)         |ln(c)-2ln(b)+ln(a)
;=======
     ln(a) |3ln(b)-2ln(a)-ln(c) |ln(c)-2ln(b)+ln(a)
     ln(b) |ln(b)-ln(a)         |ln(c)-2ln(b)+ln(a)
     ln(c) |ln(c)-ln(b)         |ln(c)-2ln(b)+ln(a)

Then u(x)=ln(a)+x(3ln(b)-2ln(a)-ln(c))+x(x+1)/2(ln(c)-2ln(b)+ln(a)).
Now we use some logarithm rules to simplify:
     u(x)=ln(a)+ln(b3x)-ln(a2x)-ln(cx)+ln(cx(x+1)/2)-ln(bx(x+1))+ln(ax(x+1)/2).
Now substitute in the u(x):
     f(x)=eln(a)+ln(b3x)-ln(a2x)-ln(cx)+ln(cx(x+1)/2)-ln(bx(x+1))+ln(ax(x+1)/2)
Now we reorganise this to make it easier to apply more rules:
     f(x)=eln(a)+ln(b3x)+ln(cx(x+1)/2)+ln(ax(x+1)/2)-ln(a2x)-ln(cx)-ln(bx(x+1))
     f(x)=eln(a)+ln(b3x)+ln(cx(x+1)/2)+ln(ax(x+1)/2)-(ln(a2x)+ln(cx)+ln(bx(x+1)))
     f(x)=eln(a)+ln(b3x)+ln(cx(x+1)/2)+ln(ax(x+1)/2)/e(ln(a2x)+ln(cx)+ln(bx(x+1)))
Now we use more simplification with logs and exponents of the same base:
     f(x)=(ab3xcx(x+1)/2ax(x+1)/2/(a2xcxbx(x+1))
     f(x)=(b3xcx(x+1)/2ax(x+1)/2+1/(a2xcxbx(x+1))
     f(x)=(b3x-x(x+1)cx(x+1)/2-xax(x+1)/2+1-2x
     f(x)=(b-x(x-2)cx(x-1)/2a(x-1)(x-2)/2
     f(x)=(bx(2-x)cx(x-1)/2a(x-1)(x-2)/2


I also went through a similar process for using sine and cosine, but it had some sign issues :/ (because of how arcsine and arccosine are defined to work as a function). It actually worked for the values I used, but I am pretty sure I put together a data set that failed.

In any event, it might be useful to make a small interpolation suite. It would probably be nice to have a version in BASIC so that folks can study it, but another version in assembly to make a faster and more efficient process.