# solve() need solution pre-chewed

HI

why do i have to square the two terms of the equation so that solve gives me the solution?

why it does not alow him to do square both sides ?

```
vL=['x','y','r','x_0','y_0','x_p','y_p','x_t','y_t','atg','btg','alpha']
varL=var(vL)
x_0Num=-1/3 ;y_0Num=-1/4 ;rNum=1
numL=[x_0==x_0Num ,y_0==y_0Num ,r==rNum]
assume(x,'real')
assume(abs(x_0)<1)
assume(abs(y_0)<1)
assume(r>=1)
C_u(x)= sqrt(r^2-x^2)
C_d(x)= -sqrt(r^2-x^2)
delta_0(x)=y_0/x_0*x # radial to circle
delta_p(x)=-x_0/y_0*x + y_0+(x_0^2)/y_0 #perpendicular to circle radial delta_0
assume(delta_p>0)
# numerical solution
SupNum=solve((C_u(x)==delta_p(x)).substitute(numL), x, to_poly_solve=True)
# literal solutions which do not work
SupLit1=solve(C_u(x)== delta_p(x), x, to_poly_solve=True)
SupLit2=solve(C_u(x)== delta_p(x), x, algorithm='sympy')
# literal solutions ok
SupLit3=solve(C_u(x)^2== (delta_p(x))^2, x, algorithm='sympy')
SupLit4=solve(C_u(x)^2== (delta_p(x))^2, x, to_poly_solve=True)
show("Sup num : ",SupNum)
show("Sup lit 1 : ", LatexExpr(r" \huge \color{red} {?? }"),SupLit1)
show("Sup lit 2 : ", LatexExpr(r" \huge \color{red} {?? }"),SupLit2)
show("Sup lit 3 : ",SupLit3, LatexExpr(r" \huge \color{green} {OK }"))
show("Sup lit 4 : ",SupLit4, LatexExpr(r" \huge \color{green} {OK }"))
```

projection in the other side is easy, but unfortunately the projection matrix is not invertible.

```
pointInsideCircle=False # projection from outside circle to intside
# alpha is angle between radial vector([(x_0,y_0),(0,0) ]) and tangente line from x_0,y_0 to circle
# (the sides V_R,V_tg,r form a rectangle triangle)
sin(alpha)=r/sqrt(x_0^2+y_0^2)
cos(alpha)=sqrt(1-sin(alpha)^2)
# radial vector from [x_0,y_0]
# we want it directed to the center of the circle so it is multiplyed by -1
V_R0=matrix(SR,[x_0,y_0]).transpose()*-1
#reduction factor because (||V_R||*cos(alpha)=||V_tg||)
reductFactor=cos(alpha)
# rotation matrix and shrink to get tangent vector V_tg
rotM=matrix(SR,[[cos(alpha),-sin(alpha)],[sin(alpha),cos(alpha)]])*reductFactor
# projection Matrix on radial Vector
projectOnRadialVectorM=matrix(SR,[(x_0^2/(x_0^2 + y_0^2), x_0*y_0/(x_0^2 + y_0^2)),
(x_0*y_0/(x_0^2 + y_0^2), y_0^2/(x_0^2 + y_0^2))])
# V_tg is the tangent vector
V_tg=rotM*V_R0
# vector ([[0,0],[x_t,y_t]) from (0,0) to tangent point
V_r=-v_R0+V_tg
# now project the tangent vector on radial Vector
V_p=(projectOnRadialVectorM*V_tg)
V_orthoToRadial=V_tg-V_p
# projected point ProjectPt of [x_0,y_0]= projected vector - radial vector [[x_0,y_0][0,0]
ProjectPt=V_p-V_R
```

this is a somewhat strange problem, it is a question of finding the abscissa x_t which corresponds to the point common to the upper semicircle of known radius and has a known line of equation that comes from inside the circle. There is therefore only one point x_t. But to solve the equation we have to square the two sides of the equation and therefore we lose the information that we are looking for the solution in the upper circle and we are left with two solutions. is that probably why the solve () function does not allow itself to be squared?

oops no! my comment above is stupid, because if my point x_0 y_0 is in the upper part there could be two possible solutions. finally I don't know why solve doesn't know how to solve literally this equation.

blue vector is on delta_p line.

Well, I don't know if the function solve () has a problem or not, but I just noticed that my way of proceeding is unnecessarily complicated! It is actually a simple right triangle with a small side sqrt(x_0² + y_0²) and a hypotenuse of length 1 and therefore we deduce the point [x_t, y_t ], where do we take the tangent.

fortunately I have known for a very long time that ridicule does not kill.