Problem 282. Circle and Quadratic
Imagine the quadratic curve with equation
y=y(x)=ax^2+bx+c
On the concave side of this curve there is a circle of radius R. The circle is as close the the extremum of the quadratic as possible without resulting in the curves crossing each other. Write a function which takes as inputs a,b,c, and R and returns the coordinates of the center of the circle.
For example, if
a=1; b=0; c=10; R=pi;
then the function returns
T = circ_puzz(a,b,c,R) T = 0 20.1196044010894
This can be visualized as follows:
P = @(x) a*x.^2 + b*x + c; % Quadratic C = @(x) real(sqrt(R^2(xT(1)).^2) + T(2)); % Lower half circle x = linspace(R,R,10000); % Range of plotted data. plot(x,C(x),'r',x,C(x)+2*T(2),'r',x,P(x),T(1),T(2),'*k') ylim([0,30]) axis equal
Solution Stats
Problem Comments

3 Comments
the visualisation has an error, it should be
C = @(x) real(sqrt(R^2(xT(1)).^2) + T(2)); % Lower half circle
Thanks Gunther. The function does produce the correct graphic, but only when T(1)=0 as in my example.
The third test is a pain. Why such a small circle for high precision? It's already a singlepoint tangent circle. It is no fun to look for the specific method the author had in mind when we already have the answer. IMHO, problems should be open; they accept all kinds of solutions (leaving people to explore clever ideas). Or they should be closed, and a specific method is requested (so people don't wander to dead ends). Precision should be a requirement only for closed ones.
Solution Comments
Show commentsProblem Recent Solvers14
Suggested Problems

1933 Solvers

Given an unsigned integer x, find the largest y by rearranging the bits in x
1816 Solvers

Flag largest magnitude swings as they occur
678 Solvers

Permute diagonal and antidiagonal
444 Solvers

424 Solvers
More from this Author6
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!