[ 3 / biz / cgl / ck / diy / fa / ic / jp / lit / sci / vr / vt ] [ index / top / reports ] [ become a patron ] [ status ]
2023-11: Warosu is now out of extended maintenance.

/sci/ - Science & Math


View post   

File: 1.01 MB, 256x256, brainhurts.gif [View same] [iqdb] [saucenao] [google]
3086660 No.3086660 [Reply] [Original]

Hey, so back in the day my graphing calculator (which was awesome and i'm so pissed i lost it) had a program that could take 3 sets of x an y values and turn it into a quadratic equation (sometimes not quite right, in that it had to average, but it always made the best fit), I've tried googling such a thing and it seems fruitless, anyone know where such a program can be found?

In case anyone is wondering, the three values in question I want a formula for are (1,1);(2,5);(3,23), this is just for my own curiousity, however it does come from a real world problem.

>> No.3086673

that sounds like witch talk to me

>> No.3086689

I believe most statistical software can do costume fitting plots including polynomials.

>> No.3086747

>>3086689
This was a pretty simple program though.

>> No.3086794
File: 31 KB, 590x442, sshot_2011-05-19_21:17:00.png [View same] [iqdb] [saucenao] [google]
3086794

>> No.3086844

>>3086794

Ahh, I see what OP wanted. I'm pretty sure that what you want is exactly what this other anon (oh wait, he's a tripfag), posted except that this one you are seeing the "naked" code, as opposed just some promp window telling you to input the "data" numbers as shown in his code.

In other words OP, what he did is what you want, except this one doesn't have an user friendly interface. If you are working with a TI, then try going to their website and checking their software list.

>> No.3086865

Wiki article with more detailed explanations than my Mathematica code:
http://en.wikipedia.org/wiki/Polynomial_interpolation

>> No.3086887

>>3086794
Links?

Also I forgot to mention that there's a fourth plot point of (0,0), which I suppose may make it not quadratic at all. In which case the real world problem just got more interesting.

Using my extrapolation skills, the next point would be (4,119), and to find the next it would be that number times 6 plus 5, and the next one then would be that outcome times 7 plus 6.

Anyone able to make a pattern out of this mathematically?

>> No.3086928

What I guess you're doing here is taking the value of your previous outcome, multiplying it by the number of permutations plus one, then adding the number of permutations. So (0,0) goes to (1,1), then to (2,5) and so on.

How is that demonstrated in a mathematical formula so that I can just punch in the permutation number and figure it out? Is it possible that it can't be done as it requires the input of the previous permutation?

How does this work?

>> No.3086936

microsoft excel does this, if you don't have mathematica/maple/matlab/whatever

just enter the 3 values in 2 columns, make a scatter graph and make it fit a second order polynomial.

>> No.3086969
File: 37 KB, 570x690, sshot_2011-05-19_21:45:15.png [View same] [iqdb] [saucenao] [google]
3086969

>the next point would be (4,119)
Nah. Pic related, data with (0,0) added. Table of x, f(x) below.

>> No.3087024

>>3086969
No, sadly, that doesn't fit the pattern at all.

The real world problem is thus:
Jimmy is trying to get to heaven, to get there he has to pass an infinite number of tollbooths, the cost of each tollbooth is one higher than the previous one, with the first starting at one gold coin. Jimmy has an infinite number of gold coins at his house, however, he can only carry one gold coin at a time. Each time Jimmy passes BACK through a tollbooth that tollbooth reinstates it's fee. So he has to pay the first one then (without going through just yet) return home to get a coin then go through the first, pay for the first half of the second, then pay the first again, then pay the second half of the second, then the first again, and THEN he can pay the first third of the third.

So the question is, at each tollbooth how many coins has Jimmy paid in total after he walks through it WITH a coin?

>> No.3087049

>>3087024
So the points would be (0,0);(1,1);(2,5);(3,23);(4,119);(5,719)

And the pattern would be as I described in >>3086928.

Can a formula be made for this?

>> No.3087077
File: 11 KB, 493x506, graph1.png [View same] [iqdb] [saucenao] [google]
3087077

It looks exponential to me, and I think it makes sense that it would be, right?

http://www.graphtools.com/line.html

>> No.3087088

>>3087077
Most likely, but what is the equation?

>> No.3087098

> however it does come from a real world problem.

get the fuck out

>> No.3087104

The price for passing the first gate is 1.
The price for passing the n-th gate is n times the price of the former gate.

... that's the definiton of the factorial function, so <span class="math">\mathrm{price}(n)=n![/spoiler] (which grows faster than exponentially by the way).

>> No.3087110

My guess is that you use exponential interpolation instead of polynomial, and someone above mentioned that excel can fit points to several types of equations. I'll see if I can do it because I am curious, but you should be able to do it too.

>> No.3087158

>>3087104
2! = 2
3! = 6
4! = 24

You are incorrect sir. Also I think 0! = 1, but I'm not sure.

>> No.3087171
File: 64 KB, 750x600, facepalm.jpg [View same] [iqdb] [saucenao] [google]
3087171

>>3087158

>> No.3087258

It takes 1 to get through the first.

It takes 1 to get through the first but not go in to get 1 to put into the second (which now has 1 remaining), go back home to get 1 for the first again but no go in, and then one more to open the second, meaning 4 coins total for just the second.

The third would be (the number to get into the second + 1) x 3 .

{previous permutation value+1} x {permutation number}

so the function is

f(n) = {f(n-1) +1} x {n}

for each individual gate, and the formula for the whole thing is

∑ f(n)

and set your starting and ending values?

Right?

Your function is

f(n) = [f(n-1) x (n+1)] + n

I wonder if they are equivalent.

I don't know if that helps, and I'm not sure if it's a factorial function.

>> No.3087282

>>3087258

Oh shit, I think the factorial thing is right.

The function would be price(n) = n! - 1

>> No.3087295

>>3087282

you'd get 1, 5, 23, 119, which are the values you chugged out.

>> No.3087310

>>3087295
except that f(1) = 0...

1!-1 = 0

>> No.3087327

Try Lagrange's interpolator polynoms.

>> No.3087351

>>3087310

You could either adjust your starting value of n to fit the gate number, or do

price(n) = (n+1)! -1

so at n = 0, which corresponds to not having gone through a gate yet, you get a price of 0.

At n = 1, which is the price to get through gate 1 and all the gates before it (none), the price is 1.

At n = 2, which is gate 2 and previous gates, the price is 5.

At n = 3, which is gate 3 and previous, the price is 23.