Jump to content
Dante Unbound: Share Bug Reports and Feedback Here! ×

Warframe And Taylor's Expansion (With Valkyr's Behind) (Part Two)


Renegade343
 Share

Recommended Posts

Part one of this series (pardon the pun) can be seen here (reading this is recommended to understand what I am doing and any assumptions made with the function): https://forums.warframe.com/index.php?/topic/300101-warframe-and-taylors-expansion-with-valkyrs-behind-part-one/

 

(Note: This time, only the pictures will be hidden behind spoilers)

 

Following on from part one of the series, I concluded that approximating Valkyr's behind to a quadratic function is not accurate enough. Thus, I went back to the original photo, and cropped out a larger portion (the dashed box indicates the cropping area: 

 

oR0NLuC.png

 

Then, I rotated the cropped area π/4 radians anti-clockwise, then placed it into Geogebra, then scaled the axis so that the axis will show the size of the image in meters (110.27 PPI, image size is 0.03429m x 0.0267m). Afterwards, I then started to find the points where the tangent to Valkyr's behind is 0, and the point of inflexion (point I in the image). The result is below: 

 

VAHbTcg.png

 

Taking (x, dy/dx) = (0, 0), (0.01932, 0), and (0.0096, 0.53104), I plotted these three points on a new graph sheet, then plotted a parabola that will be very close, if not exactly at, to the points, using the system of two equations (since the y-intercept = 0). Thus, the parabola's formula is as thus: 

 

4eSd708.png

 

I then differentiated it again to obtain this straight line for getting the co-efficient of x^2: 

 

rEDBcOc.png

 

Differentiating it the third time will give me -11653.02, which would be used to calculate the coefficient of x^3. 

 

I now have these five pieces of information: 

 

- f(x) is a cubic function.

- f(0) = 0.01658

- f'(x) = (-5826.81x^2) + 111x

- f''(x) = -11653.02x + 111

- f'''(x) = -11653.02

 

Once I collected all the data I needed, I used the Taylor series: 

 

f(x) = f(a) + f'(a)*(x-a) + (f''(a)/2!)*((x-a)^2) + ... 

 

And thus started to find f(x): 

 

Let a = 0, 

f(x) = f(0) + f'(0)*x + (f''(0)/2!)*(x^2) + (f'''(0)/3!)*(x^3) (since f''''(x) = 0, we will only consider up to f'''(x))

f(0) = 0.01658

f'(0) = 0

f''(0) = 111

f'''(0) = -11635.02

f(x) = 0.01658 + (55.5x^2) - (1942.17x^3)

 

And so, I plotted f(x), and obtained this result (see curvy pink line): 

 

utc171u.png

 

As it can be seen in the above image, f(x) fits almost perfectly with the curve of Valkyr's behind, with only a little deviation, up until x = 0.025, where the line deviates from the curve of Valkyr's behind more and more. What I am thinking, based on the cropped image, is that if we were to plot a function of the curve of Valkyr's behind, we may need a piecewise function, since it looks like from x = 0.025 onwards, it seems to be a straight line with negative gradient, meaning the curve may need to be limited to 0 ≤ x ≤ 0.025, then have a y = mx + c function for x > 0.025, which would more accurately represent Valkyr's behind as a function. 

 

And so, there is part two of me attempting to marry Warframe and Taylor's Expansion. The reason I posted this in Fan Art this time is because the function obtained is a piece of art in itself, even if it may not look like it at first glance. 

 

And of course, here comes a question for all of you to answer: What curve in Warframe do you want me to approximate?

 

Link to comment
Share on other sites

All of Booben, please.

 

Thank you kindly in advance.

That would depend if I could get the parts. 

 

Then again, there is the Market, but I do not really want to spend more money for this project of sorts. 

 

And speaking of Vauban, time to do statistics with alerts (and maybe Poisson distribution). 

Link to comment
Share on other sites

Fellow nerd, this is amazing. I think you are totally cool for doing this, seriously.

 

However, there are a few problems I can see (nothing on you, this is an admirable undertaking!) with polynomial interpolation through Taylor Series, and especially the method you've used, and I think you've already come across a few of them.

 

1. Truncation of the Taylor Series

Taylor Series is an infinite sum, sadly, and this means that any practical application of this is limited severely by the number of terms you use in the Taylor Series approximation. While yes, a cubic will fit 4 points exactly using a Lagrange Polynomial, any more and you'll find that the interpolant will differ heavily for a global application - even if we try and use a piecewise application!

Interestingly, since you've truncated the Taylor Series to the first four terms, we can represent the integral as:

F(x) = I + E(f'''')

Where the error is dependent on the leading error term f''''(x). This term will determine the magnitude of the error of the approximation for the truncated Taylor Series. However, given that we don't have the analytic function of Valkyr's butt, we can't begin to get an estimate for the error without graphical methods being used. For some applications where the analytic function is highly mobile or discontinuous, or where the derivative f''''(x) isn't well-behaved, this presents a rather large limitation on the accuracy of a polynomial interpolation, though the application in context is pretty good right now :)

 

2. Operation Efficiency (Time Complexity)

You had a crazy amount of lines of math there, and while it's no big deal if you enjoy your work, more sums = more work = more time spent computing and less time spent admiring. Using polynomial interpolation quickly adds up as you saw with determining the coefficients of each term in the interpolant. In fact, with polynomial interpolation and the Vandermonde Matrix method to solve the system of equations for each derivative (as I think you might have done), the number of operations scales as O(n^2) where n is the order of polynomial you're trying to determine. So where you did about 10 operations for those three points that I can see (each operation being an algebraic operation, subsitution or elimination), it scales with the number of points you have - hence, for 5 points, you'll have to do more than 25 operations to get a polynomial interpolant! Polynomial interpolation in this method is pretty operation-heavy - consider using something like cubic spline interpolation (Operations on the order of O(n)) to do this!

 

 

3. Round-off Error and Wiggles

One verrry specific limitation of using polynomial interpolation is the reliance on having almost-perfect data sets. Polynomial functions, especially higher-order ones (about fifth-order or higher) are really sensitive to errors when rounding off exact values which can't be expressed in decimal form. As the purpose of interpolation is to fit a line through each point, eventually you'll get to the case where values which are rounded off or have a slight error in them for one reason or another just... won't fit. For higher-order interpolations, this results in something really dramatic - a wiggle! (Keep it in your pants, guys.)

No really, that's the technical term for it xD

Wiggles arise from a combination of high-order polynomial interpolations and error in discrete data sets. As the function must pass through exactly each point, errors add up and eventually result in a large deviation in one area to try and make up for the cumulative error through all the points. It sounds pretty abstract, but take a look at this illustration.

Example2-1d.jpg

As seen, with a non-polynomial function, the deviation is massive for sections close to the endpoints because of slight error introduced that makes the polynomial not quite match up for intermediate values.

You haven't gotten up to this stage yet, but if you do decide to use polynomial interpolation for the rest of Valkyr's butt, fitting a high-order polynomial might not be particularly fun. Your suggestion of using a piecewise function might not get the same accuracy, but you'll be thanking the exponential decrease in work trying to fit equidistant points and pursuing high orders of precision to limit wiggle if you do!

 

Apart from that, this is possibly the awesomest thing I have seen on these forums yet, and while I shouldn't tell you to keep it up cos I worry for your health, know that you're doing a really cool thing :D

 

Have you tried using other Numerical Methods? Interpolation between points to find a curve sounds like something true computational mechanics fans would have fun with - try these concepts if you've got time:

- Cubic Spline Interpolation (a fairly complex method of interpolation using the derivatives to match piecewise curves, but is ridiculously accurate and efficient for its accuracy. CAD and people who work in 3-D modelling/animation use this heaps!)

- Rational Functions (verrrry complex, but very accurate method, best used in MATLAB or a comparable programming environment cause it's pretty specific, gives great handling of singularities and poles)

 

Edit:

Once I understand how to get a parabola from four points.

Sadly, unless all four points lie on a parabolic path already, this isn't possible due to the definition of a quadratic if you're going for interpolation. Higher-order polynomials like cubics though...

Edited by Vastaren
Link to comment
Share on other sites

As in, conic sections (Parabolae, hyperbolae, circles and ellipses)? Or have I missed it?

Yes, since with conic sections, I would be able to rotate the parabola so that it passes through four points, since a parabola can be drawn with a directrix and focus point, and the directix can be rotated.

Edited by Renegade343
Link to comment
Share on other sites

Yes, since with conic sections, I would be able to rotate the parabola so that it passes through four points, since a parabola can be drawn with a directix and focus point, and the directix can be rotated.

For most well-behaved differentiable functions, you'd be right, but that's a pretty specific range, sadly. And then we get to the problem where rotating a function by definition could cause it not to be a function at all, hence the Taylor Series would break down D:

 

a591mrF.jpgA continuous function with a discontinuous first derivative!

9yXcTvk.jpgAaaand the same function with a cubic interpolant.

Very pathological example. I might just be the worst person on these forums right now.

Edited by Vastaren
Link to comment
Share on other sites

Contents from post #19. 

Actually, once we rotate the parabola, we could still differentiate it using implicit differentiation, then shift everything so that it becomes dy/dx = c (where c is the derivative of the rotated parabola), then differentiate it again, and so forth. Then, we graph the results, and should be able to obtain the value of y from a given x, which we then can use the results on the Taylor series. 

 

Of course, I have not tested that yet. 

 

And speaking of which, after 30 minutes of studying interpolation, I think I already understand a part of it.

Link to comment
Share on other sites

Posting this to say that since I do not have Vauban, I will make a consolation thread of approximating the function of Oberon's front bulge. 

 

Once I understand how to get a parabola from four points.

Actually, on reviewing the image, it looks like there would be no need to get a parabola from four points for approximating the curve of Oberon's front bulge, since I think that the bulge is more of a parabola. 

 

But not to worry. I will study on finding parabolas from four points, and I will try to find a way to use it for fun. 

Link to comment
Share on other sites

Actually, once we rotate the parabola, we could still differentiate it using implicit differentiation, then shift everything so that it becomes dy/dx = c (where c is the derivative of the rotated parabola), then differentiate it again, and so forth. Then, we graph the results, and should be able to obtain the value of y from a given x, which we then can use the results on the Taylor series. 

 

Of course, I have not tested that yet. 

 

And speaking of which, after 30 minutes of studying interpolation, I think I already understand a part of it.

You *could* use a linearly scaling change of variables and rotate the coordinate axes to try and fit a quadratic interpolant, and in very specific cases, it'll work, but sadly, any real parabola by definition is *still* only defined uniquely by three points no matter which way you rotate it. If you do manage to fit one through four points - and it's possible - then it's entirely possible to ignore one of the points for the rotated coordinate system, hence we're back to the definition of a parabola.

 

I think you're thinking of a very specific loophole though... and yes, I think there is one!

Complex coefficients!

 

... Have fun with that, it's way outside what I know :P

Link to comment
Share on other sites

You *could* use a linearly scaling change of variables and rotate the coordinate axes to try and fit a quadratic interpolant, and in very specific cases, it'll work, but sadly, any real parabola by definition is *still* only defined uniquely by three points no matter which way you rotate it. If you do manage to fit one through four points - and it's possible - then it's entirely possible to ignore one of the points for the rotated coordinate system, hence we're back to the definition of a parabola.

Actually, the definition of a parabola can be written as being the locus of points, where it is at an equal distance from its directrix and its focus point. So, under that definition, we can still rotate the parabola and still not violate its definition (since the focus and directrix would also rotate). 

Link to comment
Share on other sites

  • 2 weeks later...
  • 2 months later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...