Dominion Strategy Forum

Please login or register.

Login with username, password and session length
Pages: 1 ... 225 226 [227] 228 229 230  All

Author Topic: Random Stuff Part II  (Read 1221991 times)

0 Members and 1 Guest are viewing this topic.

silverspawn

  • Adventurer
  • ******
  • Online Online
  • Posts: 5318
  • Shuffle iT Username: sty.silver
  • Respect: +3224
    • View Profile
Re: Random Stuff Part II
« Reply #5650 on: November 28, 2015, 08:15:34 pm »
0

Pokemon or Big Data?  Probably easy for this crowd.

I got 53%  :(

I only played g1 and in german, but I still expected to get more. They all sound like pokemon!

eHalcyon

  • Adventurer
  • ******
  • Offline Offline
  • Posts: 8689
  • Respect: +9187
    • View Profile
Re: Random Stuff Part II
« Reply #5651 on: November 29, 2015, 12:00:39 am »
+3

http://voices.nationalgeographic.com/2013/09/21/beer-gut-mans-belly-brews-own-beer/

Auto-brewery syndrome, a condition which causes fermentation in your stomach whenever you eat a lot of carbs, causing you to get drunk even though you haven't had a drop of alcohol to drink.
Logged

assemble_me

  • Saboteur
  • *****
  • Offline Offline
  • Posts: 1407
  • Shuffle iT Username: assemble me
  • Dominion stream/yt junkie
  • Respect: +808
    • View Profile
Re: Random Stuff Part II
« Reply #5652 on: November 29, 2015, 09:04:04 am »
+3

For all the otter friends around

Logged
Join the f.ds Dominion league | My Twitch channel

... and none of his posts shall remain unedited

Burning Skull

  • Saboteur
  • *****
  • Offline Offline
  • Posts: 1150
  • Shuffle iT Username: Burning Skull
  • See you in the Outpost
  • Respect: +1843
    • View Profile
Re: Random Stuff Part II
« Reply #5653 on: November 29, 2015, 10:04:42 am »
+3

silverspawn

  • Adventurer
  • ******
  • Online Online
  • Posts: 5318
  • Shuffle iT Username: sty.silver
  • Respect: +3224
    • View Profile
Re: Random Stuff Part II
« Reply #5654 on: November 29, 2015, 12:20:14 pm »
0

Does someone know an online calculator who computes the parameters of a function based on a number of sample values?

e.g. I say f(x) = a + b *x and f(0) = 10 and f(1) = 12 and he tells me a = 10 and b = 2

I'm pretty sure it has to be there but I can't find one. Maybe I don't know how to phrase it correctly.

Witherweaver

  • Adventurer
  • ******
  • Offline Offline
  • Posts: 6476
  • Shuffle iT Username: Witherweaver
  • Respect: +7866
    • View Profile
Re: Random Stuff Part II
« Reply #5655 on: November 29, 2015, 01:06:10 pm »
0

Does someone know an online calculator who computes the parameters of a function based on a number of sample values?

e.g. I say f(x) = a + b *x and f(0) = 10 and f(1) = 12 and he tells me a = 10 and b = 2

I'm pretty sure it has to be there but I can't find one. Maybe I don't know how to phrase it correctly.

Try googling "online polynomial interpolator".  I'm sure Wolfram Alpha has one, and I would guess other sites do as well as the problem is trivial.
Logged

eHalcyon

  • Adventurer
  • ******
  • Offline Offline
  • Posts: 8689
  • Respect: +9187
    • View Profile
Logged

sitnaltax

  • Apprentice
  • *****
  • Offline Offline
  • Posts: 284
  • Respect: +490
    • View Profile
Re: Random Stuff Part II
« Reply #5657 on: November 29, 2015, 02:42:36 pm »
0

Does someone know an online calculator who computes the parameters of a function based on a number of sample values?

e.g. I say f(x) = a + b *x and f(0) = 10 and f(1) = 12 and he tells me a = 10 and b = 2

I'm pretty sure it has to be there but I can't find one. Maybe I don't know how to phrase it correctly.

Looks like trying to solve a system of linear equations?

http://wims.unice.fr/wims/wims.cgi?session=0A0E929B69.5&+lang=en&+module=tool%2Flinear%2Flinsolver.en&+method=coef&+cmd=resume
Logged

Tables

  • Margrave
  • *****
  • Offline Offline
  • Posts: 2816
  • Build more Bridges in the King's Court!
  • Respect: +3349
    • View Profile
Re: Random Stuff Part II
« Reply #5658 on: November 29, 2015, 03:54:07 pm »
0

Does someone know an online calculator who computes the parameters of a function based on a number of sample values?

e.g. I say f(x) = a + b *x and f(0) = 10 and f(1) = 12 and he tells me a = 10 and b = 2

I'm pretty sure it has to be there but I can't find one. Maybe I don't know how to phrase it correctly.

Looks like trying to solve a system of linear equations?

http://wims.unice.fr/wims/wims.cgi?session=0A0E929B69.5&+lang=en&+module=tool%2Flinear%2Flinsolver.en&+method=coef&+cmd=resume


No, it isn't. It's taking a series of n points and generating the unique (n-1)th order polynomial that passes those points.

I worked out a way to do it for 3 points once, and have seen a way to generalise it to n points, although it's pretty time consuming. If you only have one or two equations you want to fit to I can probably explain the method for it if you'd like.
Logged
...spin-offs are still better for all of the previously cited reasons.
But not strictly better, because the spinoff can have a different cost than the expansion.

qmech

  • Torturer
  • *****
  • Offline Offline
  • Posts: 1918
  • Shuffle iT Username: qmech
  • What year is it?
  • Respect: +2320
    • View Profile
Re: Random Stuff Part II
« Reply #5659 on: November 29, 2015, 04:00:34 pm »
+1

Looks like trying to solve a system of linear equations?

http://wims.unice.fr/wims/wims.cgi?session=0A0E929B69.5&+lang=en&+module=tool%2Flinear%2Flinsolver.en&+method=coef&+cmd=resume

No, it isn't. It's taking a series of n points and generating the unique (n-1)th order polynomial that passes those points.

It kind of is: when you put in your n values of x you get n linear equations for the n coefficients.  And looking at them as a system of linear equations also tells you why you can't always expect a unique solution, and why degree n-2 is not going to suffice in general.

Edit: Anyone ever wanted to know what transcendental actually means?  Think of all the numbers you can write down of the form a_n x^n + a_{n-1} x^{n-1} + ... + a_1 x + a_0, where the a_n are integers and n can be as large as you like.  If you never get the same number in two different ways then x is transcendental.  A fun consequence of this is that, because pi is transcendental, if you want to check whether two polynomials (defined in some complicated way that you maybe don't even know exactly) are equal "all" you have to do is check whether they agree at pi. 
« Last Edit: November 29, 2015, 04:09:37 pm by qmech »
Logged

Witherweaver

  • Adventurer
  • ******
  • Offline Offline
  • Posts: 6476
  • Shuffle iT Username: Witherweaver
  • Respect: +7866
    • View Profile
Re: Random Stuff Part II
« Reply #5660 on: November 29, 2015, 04:10:51 pm »
+2

Guys it's trivial.  The unique Nth degree polynomial passing through (x0, y0), ..., (xN,yN) is

L_N(X) = (x-x1)...(x-xN)/((x0-x1)(x0-x2)...(x0-xN))y0 + (x-x0)(x-x2)...(x-xN)/((x1-x0)(x1-x2)...(x1-xN))y1 + ... + (x-x0)(x-x1)...(x-x{N-1})/((xN-x1)(xN-x2)...(xN-x{N-1}))yN

Expand and collect to get the form you want.  Still trivial to determine coefficients.

Edit: Fixed, typing on phone
« Last Edit: November 29, 2015, 04:12:32 pm by Witherweaver »
Logged

Tables

  • Margrave
  • *****
  • Offline Offline
  • Posts: 2816
  • Build more Bridges in the King's Court!
  • Respect: +3349
    • View Profile
Re: Random Stuff Part II
« Reply #5661 on: November 29, 2015, 04:17:00 pm »
0

It kind of is: when you put in your n values of x you get n linear equations for the n coefficients.  And looking at them as a system of linear equations also tells you why you can't always expect a unique solution, and why degree n-2 is not going to suffice in general.

The only case I can think of where you won't get a unique n-1th order polynomial is where two points have the say c co-ordinate - and in that case no polynomial (of you form y = ax^(n-1) + ... + c) will work. Maybe there's some weird stuff in higher order polynomials I'm overlooking but I don't think there is. As for the system of linear equations, yeah, that's one way to derive the solutions, I think, but it's not what's being asked for.

PPE: What Witherweaver just posted might well work. Although his definition of 'trivial' seems to not match up with my own, because that looks far from obvious that it's correct.
Logged
...spin-offs are still better for all of the previously cited reasons.
But not strictly better, because the spinoff can have a different cost than the expansion.

Limetime

  • Saboteur
  • *****
  • Offline Offline
  • Posts: 1237
  • Shuffle iT Username: limetime
  • Respect: +1179
    • View Profile
Re: Random Stuff Part II
« Reply #5662 on: November 29, 2015, 04:20:21 pm »
0

BTW: Where did WanderingWinder go?
Logged

Witherweaver

  • Adventurer
  • ******
  • Offline Offline
  • Posts: 6476
  • Shuffle iT Username: Witherweaver
  • Respect: +7866
    • View Profile
Re: Random Stuff Part II
« Reply #5663 on: November 29, 2015, 04:20:47 pm »
0

You can directly set up a system if linear equations for the coefficients a0, ..., an for

f(X) = a0+ a1x + a2x^2+...+ aNx^N

but this requires solving an N+1 by N+1 system, and its quite ill conditioned (believe it's called the Van Der Wol matrix or something)

Form I wrote (Legendre) is much better because you immediately can just write it down.
« Last Edit: November 29, 2015, 04:37:16 pm by Witherweaver »
Logged

Witherweaver

  • Adventurer
  • ******
  • Offline Offline
  • Posts: 6476
  • Shuffle iT Username: Witherweaver
  • Respect: +7866
    • View Profile
Re: Random Stuff Part II
« Reply #5664 on: November 29, 2015, 04:23:17 pm »
0

It's obvious because plug in each point.  Each term isolates exactly yi when x=xi, because all the other terms are zero, and denominator makes the yi multiplier 1.

There is only one Nth degree poly passing through N+1 points.  This is easy to show as well.  Since L_N does it, L_N is THE unique ibterpolant
Logged

qmech

  • Torturer
  • *****
  • Offline Offline
  • Posts: 1918
  • Shuffle iT Username: qmech
  • What year is it?
  • Respect: +2320
    • View Profile
Re: Random Stuff Part II
« Reply #5665 on: November 29, 2015, 04:23:58 pm »
0

Witherweaver's answer is trivial in the sense that it is easy to write down a polynomial of degree n-1 that vanishes at n-1 given points, and appropriately scaled versions of these (over all (n-1)-subsets of the n points you're interested in) will attain the desired values at each point.

Edit: And Tables is right that the polys are unique, as the difference of two examples has at least n roots, so must be the zero poly.
« Last Edit: November 29, 2015, 04:27:14 pm by qmech »
Logged

Titandrake

  • Mountebank
  • *****
  • Offline Offline
  • Posts: 2210
  • Respect: +2856
    • View Profile
Re: Random Stuff Part II
« Reply #5666 on: November 29, 2015, 04:28:26 pm »
+1

Okay. Okay okay okay. I'm TAing a course right now where we actually teach polynomial interpolation. I'M QUALIFIED TO POST THINGS ON THE INTERNET.

If you have n points, one option is to say f(x) = a_0 + a_1x + a_2x^2 + ... + a_{n-1}x^{n-1}. That gives you n different variables in the coefficients, and n different equations through the points (x_1,y_1), ... , (x_n,y_n). You can then solve that system of equations.

Alternatively, you can use the thing Witherweaver is talking about, which is Lagrange interpolation. The idea is that for every point (x_i, y_i), you define a polynomial f_i(x) such that
  • f_i(x_j) = 0 for all j not equal to i
  • f_i(x_i) = 1
If you know f_i(x) for each i, then the polynomial

f(x) = y_1 f_1(x) + y_2 f_2(x) + ... + y_n f_n(x)

passes through all the n points.

Then, you can derive each f_i(x) through inspection. The way we define it, we want a polynomial with n-1 roots, and we know the value at x_i is 1, so you can write it as

f_i(x) = (x-x_1)(x-x_2)...(x-x_{i-1})(x-x_{i+1})....(x-x_n) * (1 / (x_i - x_1)(x_i-x_2) ... (x_i-x_n))

For any N points, there is exactly one polynomial of degree up to n-1 that goes through those points. At least one exists by the method above. If f(x) and g(x) go through the same n points and are both degree <= n-1, then f(x) - g(x) has n roots and is of degree <= n-1, which is only possible if f(x) - g(x) = 0.

PPE: I've been ninjaed by all the other math people here.
Logged
I have a blog! It's called Sorta Insightful. Check it out?

Witherweaver

  • Adventurer
  • ******
  • Offline Offline
  • Posts: 6476
  • Shuffle iT Username: Witherweaver
  • Respect: +7866
    • View Profile
Re: Random Stuff Part II
« Reply #5667 on: November 29, 2015, 04:32:53 pm »
0

I taught Numerical Analysis three or four times in grad school.. we covered interpolation quite heavily.
Logged

ashersky

  • Mountebank
  • *****
  • Offline Offline
  • Posts: 2343
  • 2013/2014/2015 Mafia Mod of the Year
  • Respect: +1520
    • View Profile
Re: Random Stuff Part II
« Reply #5668 on: November 29, 2015, 04:34:23 pm »
0

Okay. Okay okay okay. I'm TAing a course right now where we actually teach polynomial interpolation. I'M QUALIFIED TO POST THINGS ON THE INTERNET.

If you have n points, one option is to say f(x) = a_0 + a_1x + a_2x^2 + ... + a_{n-1}x^{n-1}. That gives you n different variables in the coefficients, and n different equations through the points (x_1,y_1), ... , (x_n,y_n). You can then solve that system of equations.

Alternatively, you can use the thing Witherweaver is talking about, which is Lagrange interpolation. The idea is that for every point (x_i, y_i), you define a polynomial f_i(x) such that
  • f_i(x_j) = 0 for all j not equal to i
  • f_i(x_i) = 1
If you know f_i(x) for each i, then the polynomial

f(x) = y_1 f_1(x) + y_2 f_2(x) + ... + y_n f_n(x)

passes through all the n points.

Then, you can derive each f_i(x) through inspection. The way we define it, we want a polynomial with n-1 roots, and we know the value at x_i is 1, so you can write it as

f_i(x) = (x-x_1)(x-x_2)...(x-x_{i-1})(x-x_{i+1})....(x-x_n) * (1 / (x_i - x_1)(x_i-x_2) ... (x_i-x_n))

For any N points, there is exactly one polynomial of degree up to n-1 that goes through those points. At least one exists by the method above. If f(x) and g(x) go through the same n points and are both degree <= n-1, then f(x) - g(x) has n roots and is of degree <= n-1, which is only possible if f(x) - g(x) = 0.

PPE: I've been ninjaed by all the other math people here.

And I have a degree in creative writing, so...try again.
Logged
f.ds Mafia Board Moderator

2013, 2014, 2015 Mafia Mod of the Year
2015 f.ds Representative, World Forum Mafia Championships
2013, 2014 Mafia Player of the Year (Tie)

11x MVP: M30, M83, ZM16, M25, M38, M61, M76, RMM5, RMM41, RMM46, M51

Tables

  • Margrave
  • *****
  • Offline Offline
  • Posts: 2816
  • Build more Bridges in the King's Court!
  • Respect: +3349
    • View Profile
Re: Random Stuff Part II
« Reply #5669 on: November 29, 2015, 04:38:25 pm »
0

Ah, yeah, I see how the formula works now. Lack of proper formatting due to being a forum made it a bit hard to see that was what was going on, but yeah it's not much effort to see that works. Takes a little bit more effort to prove it's unique but not especially hard I think.
Logged
...spin-offs are still better for all of the previously cited reasons.
But not strictly better, because the spinoff can have a different cost than the expansion.

liopoil

  • Margrave
  • *****
  • Offline Offline
  • Posts: 2587
  • Respect: +2479
    • View Profile
Re: Random Stuff Part II
« Reply #5670 on: November 29, 2015, 04:39:45 pm »
+3

Guys it turns out that the forum supportssuperscripts andsubscripts!
Logged

qmech

  • Torturer
  • *****
  • Offline Offline
  • Posts: 1918
  • Shuffle iT Username: qmech
  • What year is it?
  • Respect: +2320
    • View Profile
Re: Random Stuff Part II
« Reply #5671 on: November 29, 2015, 04:41:22 pm »
0

Perhaps the numerical analysts would also like to explain why interpolation is a really bad way of approximating a function by a polynomial in practice due to overfitting...

Edit: Let's not be lazy.  Note that interpolation through n points is really bad way of approximating a function by a polynomial of degree n-1 due to overfitting.  By making sure you hit the value bang on at those n points you've used up all your degrees of freedom, so have no control of how closely you approximate the function away from the n special points.  Now I think I will leave the better alternatives to the numerical analysts.
« Last Edit: November 29, 2015, 04:45:48 pm by qmech »
Logged

Witherweaver

  • Adventurer
  • ******
  • Offline Offline
  • Posts: 6476
  • Shuffle iT Username: Witherweaver
  • Respect: +7866
    • View Profile
Re: Random Stuff Part II
« Reply #5672 on: November 29, 2015, 04:42:58 pm »
0

Guys it turns out that the forum supportssuperscripts andsubscripts!

That was hard enough to post on my phone!
Logged

Witherweaver

  • Adventurer
  • ******
  • Offline Offline
  • Posts: 6476
  • Shuffle iT Username: Witherweaver
  • Respect: +7866
    • View Profile
Re: Random Stuff Part II
« Reply #5673 on: November 29, 2015, 04:46:45 pm »
0

Perhaps the numerical analysts would also like to explain why interpolation is a really bad way of approximating a function by a polynomial in practice due to overfitting...

Well its bad because of the shape.  To fit N points you have an N+1 degree poly, which means (generally), N "wiggles" (changes of direction).  The thing you're fitting probably does not have that structure.

Piecewise poly interp (spline) is better, or if you need it just very near a point, take the Taylor poly.  Or you can fit some combination if function and derivative values at the point.

Can also consider regression (e.g., least squares best fit line).
Logged

scott_pilgrim

  • Saboteur
  • *****
  • Offline Offline
  • Posts: 1102
  • Respect: +2146
    • View Profile
Re: Random Stuff Part II
« Reply #5674 on: November 29, 2015, 05:02:54 pm »
+11

BTW: Where did WanderingWinder go?

He's just been posting on all his other accounts.
Logged
Pages: 1 ... 225 226 [227] 228 229 230  All
 

Page created in 0.066 seconds with 21 queries.