So I'm just going to talk through this rather than doing the solution: find where x^2=x. So, 1. This gives the upper right vertex of the square.
Why do you say that the center lies on -x+1? Is that just from eyeballing it?So I'm just going to talk through this rather than doing the solution: find where x^2=x. So, 1. This gives the upper right vertex of the square.
Then, the center of the circle is somewhere on the line y=-x+1
The circle itself is defined by (y-m)^2+(x-n)^2=r where m and n are coordinates on the above line.
I played around on desmos for a minute but I didn't recognize any of the numbers that approximated the solution. I'll probably play more with it later, but n is somewhere around 1/1.56 and m is somewhere around 1/2.76, with radius around 1/7.76, however I wasn't constraining these to the line, either, and doing all of it by eyeball.
It's a square and is making contact with two sides that come to a corner with the circle. The center of such a circle that is tangent to two adjacent sides of a square will always be on the diagonal that bisects that angle.Why do you say that the center lies on -x+1? Is that just from eyeballing it?So I'm just going to talk through this rather than doing the solution: find where x^2=x. So, 1. This gives the upper right vertex of the square.
Then, the center of the circle is somewhere on the line y=-x+1
The circle itself is defined by (y-m)^2+(x-n)^2=r where m and n are coordinates on the above line.
I played around on desmos for a minute but I didn't recognize any of the numbers that approximated the solution. I'll probably play more with it later, but n is somewhere around 1/1.56 and m is somewhere around 1/2.76, with radius around 1/7.76, however I wasn't constraining these to the line, either, and doing all of it by eyeball.
import math as ma
import numpy as np
import array as ar
import matplotlib.pyplot as plt
n = 100000
y1 = ar.array('d',n*[0])
y2 = ar.array('d',n*[0])
cc = ar.array('d',n*[0])
x = np.linspace(0,1,n)
#find intercept of line and curve
#x^2 = -x + 1
#x^2 + x -1 = 0
a =1
b = 1
c = -1
xp =(-b + np.sqrt(b**2 - 4 *a*c))/(2*a) #x intercept
yp = xp**2 #y intercept
print("Intercept (x,y) ",xp," ",yp)
#line and cirve
for i in range(n):
y1[i] = -x[i] + 1
y2[i] = x[i]**2
#iterate until x the radius of the circle equals
#the distence from the cener of the circke to the curve
for i in range(n):
yc = -x[i] + 1
r = np. sqrt( (x[i]-xp)**2 + (yc - yp)**2 ) #distance formula
if abs(r-x[i]) < .00001:
print("Circle Center(x,y) ",x[i]," ",yc)
cc[i] = yc #plot point
area = np.pi*r**2
print("Area ",area)
break
[fig, p] = plt.subplots(1)
p.plot(x,y1,linewidth=2.0,color="k")
p.plot(x,y2,linewidth=2.0,color="k")
p.plot(x,cc,linewidth=2.0,color="k")
p.grid(color='k', linestyle='-', linewidth=1)
p.grid(which='major', color='k',linestyle='-', linewidth=0.8)
p.grid(which='minor', color='k', linestyle='-', linewidth=0.4)
p.minorticks_on()
plt.show()
Well, as I said, that point on the line whose distance, perpendicular to Y=1 will be equal to the distance to of the line perpendicular from the parabola to that same point, and this will naturally be the point where the tangent curves meet because it will be a radius of the circle that touches the parabola there.The only data point to nail; it down is the intersection of curves. The radius of the circle is x, so when the x matches the distance from center of the circle to the curves along the diagonal line that us the radius,
One way is an iterative solution. Iterate x vales and when x is close to equaling the distance from center to the curve it is done. A common method when all you need is a number.
Code:import math as ma import numpy as np import array as ar import matplotlib.pyplot as plt n = 100000 y1 = ar.array('d',n*[0]) y2 = ar.array('d',n*[0]) cc = ar.array('d',n*[0]) x = np.linspace(0,1,n) #find intercept of line and curve #x^2 = -x + 1 #x^2 + x -1 = 0 a =1 b = 1 c = -1 xp =(-b + np.sqrt(b**2 - 4 *a*c))/(2*a) #x intercept yp = xp**2 #y intercept print("Intercept (x,y) ",xp," ",yp) #line and cirve for i in range(n): y1[i] = -x[i] + 1 y2[i] = x[i]**2 #iterate until x the radius of the circle equals #the distence from the cener of the circke to the curve for i in range(n): yc = -x[i] + 1 r = np. sqrt( (x[i]-xp)**2 + (yc - yp)**2 ) #distance formula if abs(r-x[i]) < .00001: print("Circle Center(x,y) ",x[i]," ",yc) cc[i] = yc #plot point area = np.pi*r**2 print("Area ",area) break [fig, p] = plt.subplots(1) p.plot(x,y1,linewidth=2.0,color="k") p.plot(x,y2,linewidth=2.0,color="k") p.plot(x,cc,linewidth=2.0,color="k") p.grid(color='k', linestyle='-', linewidth=1) p.grid(which='major', color='k',linestyle='-', linewidth=0.8) p.grid(which='minor', color='k', linestyle='-', linewidth=0.4) p.minorticks_on() plt.show()