I want to create an equation from a graph that i created.

110 Views Asked by At

I made a graph that shows the distance to the center of a heart for each angle of rotation. I want to use this for the code I am writing, but that isn't quite so relevant right now. Now I want to create a function like y = x. x goes from 1 to 360, and y changes like this:

Graph that I want to turn into an equation

I could include it in other ways, but this is the approach I want to use because this approach can be useful for more variety.

here are all the y coordinates:

0,7222222 0,7301587 0,7222222 0,7142857 0,7142857 0,7063492 0,6984127 0,6984127 0,6904762 0,6984127 0,6904762 0,6825397 0,6825397 0,6825397 0,6746032 0,6746032 0,6746032 0,6666667 0,6746032 0,6666667 0,6666667 0,6666667 0,6666667 0,6587301 0,6666667 0,6587301 0,6587301 0,6507937 0,6587301 0,6587301 0,6507937 0,6507937 0,6587301 0,6587301 0,6587301 0,6507937 0,6587301 0,6587301 0,6587301 0,6587301 0,6587301 0,6587301 0,6666667 0,6666667 0,6666667 0,6666667 0,6666667 0,6666667 0,6666667 0,6666667 0,6746032 0,6746032 0,6825397 0,6825397 0,6825397 0,6825397 0,6825397 0,6904762 0,6904762 0,6984127 0,6984127 0,7063492 0,7063492 0,7063492 0,7142857 0,7142857 0,7222222 0,7301587 0,7222222 0,7380952 0,7380952 0,7460318 0,7460318 0,7539682 0,7539682 0,7619048 0,7619048 0,7698413 0,7777778 0,7777778 0,7857143 0,7936508 0,7936508 0,7936508 0,8015873 0,8095238 0,8174603 0,8253968 0,8253968 0,8333333 0,8412699 0,8412699 0,8492063 0,8492063 0,8571429 0,8650793 0,8650793 0,8730159 0,8809524 0,8809524 0,8888889 0,8968254 0,9047619 0,9047619 0,9126984 0,9126984 0,9206349 0,9285714 0,9285714 0,9365079 0,9444444 0,9444444 0,952381 0,952381 0,9603174 0,968254 0,968254 0,9761904 0,9761904 0,984127 0,984127 0,984127 0,984127 0,9920635 0,9920635 0,9920635 0,9920635 1 1 1 1 1 1 1 1 1 1 0,9920635 0,9920635 0,984127 0,9920635 0,9761904 0,968254 0,968254 0,968254 0,952381 0,952381 0,9444444 0,9285714 0,9206349 0,9126984 0,9047619 0,8809524 0,8730159 0,8571429 0,8412699 0,8412699 0,8253968 0,8095238 0,7936508 0,7777778 0,7619048 0,7460318 0,7222222 0,7142857 0,6904762 0,6825397 0,6666667 0,6428571 0,6349207 0,6190476 0,5952381 0,5873016 0,5714286 0,5634921 0,5396826 0,531746 0,5238096 0,515873 0,5 0,4920635 0,5 0,515873 0,5238096 0,531746 0,5396826 0,5634921 0,5714286 0,5873016 0,5952381 0,6190476 0,6349207 0,6428571 0,6666667 0,6746032 0,6904762 0,7142857 0,7222222 0,7460318 0,7619048 0,7777778 0,7936508 0,8095238 0,8253968 0,8412699 0,8412699 0,8571429 0,8730159 0,8809524 0,9047619 0,9126984 0,9206349 0,9285714 0,9444444 0,952381 0,952381 0,968254 0,968254 0,968254 0,9761904 0,9920635 0,984127 0,9920635 0,9920635 1 1 1 1 1 1 1 1 1 1 0,9920635 0,9920635 0,9920635 0,9920635 0,984127 0,984127 0,984127 0,984127 0,9761904 0,9761904 0,968254 0,968254 0,9603174 0,952381 0,952381 0,9444444 0,9444444 0,9365079 0,9285714 0,9285714 0,9206349 0,9126984 0,9126984 0,9047619 0,9047619 0,8968254 0,8888889 0,8809524 0,8809524 0,8730159 0,8650793 0,8650793 0,8571429 0,8492063 0,8492063 0,8412699 0,8412699 0,8333333 0,8253968 0,8253968 0,8174603 0,8095238 0,8015873 0,7936508 0,7936508 0,7936508 0,7857143 0,7777778 0,7777778 0,7698413 0,7619048 0,7619048 0,7539682 0,7539682 0,7460318 0,7460318 0,7380952 0,7380952 0,7222222 0,7301587 0,7222222 0,7142857 0,7142857 0,7063492 0,7063492 0,7063492 0,6984127 0,6984127 0,6904762 0,6904762 0,6825397 0,6825397 0,6825397 0,6825397 0,6825397 0,6746032 0,6746032 0,6666667 0,6666667 0,6666667 0,6666667 0,6666667 0,6666667 0,6666667 0,6666667 0,6587301 0,6587301 0,6587301 0,6587301 0,6587301 0,6587301 0,6507937 0,6587301 0,6587301 0,6587301 0,6507937 0,6587301 0,6587301 0,6587301 0,6507937 0,6587301 0,6587301 0,6666667 0,6587301 0,6666667 0,6666667 0,6666667 0,6666667 0,6746032 0,6666667 0,6746032 0,6746032 0,6746032 0,6825397 0,6825397 0,6825397 0,6904762 0,6984127 0,6904762 0,6984127 0,6984127 0,7063492 0,7142857 0,7142857 0,7222222 0,7301587

1

There are 1 best solutions below

0
On

How about you try this via Lagrange interpolation. I went on this site. And I plugged in some values based on a rough visual scan of your plot:

$$(1, 90) (31, 80) (141, 127) (171, 80) (181, 60) (191, 80) (221, 127) (331, 80) (361, 90)$$

Yielding this beautiful monstrosity:

$$-\frac{(299989 x^8)}{2127365856000000000} + \frac{(54298009 x^7)}{265920732000000000} - \frac{(64524305453 x^6)}{531841464000000000} + \frac{(10132698841093 x^5)}{265920732000000000} - \frac{1439473618836983 x^4)}{212736585600000000} + \frac{(177514529347798123 x^3)}{265920732000000000} - \frac{(17367748928219890513 x^2)}{531841464000000000} + \frac{(49383456898396535293 x)}{88640244000000000} - \frac{106143199760481469}{243936000000000} $$

_____________ Edit ______________

Unfortunately this plot isn't looking too healthy- perhaps we need more points. I'll leave it up to the OP if this method is to be pursued further. Here's the plot of the interpolating polynomial from Wolfram Alpha:

Wolfram Alpha Plot of Interpolating Polynomial