vv

14027 Reputation

20 Badges

10 years, 53 days

MaplePrimes Activity


These are answers submitted by vv

Distribution function for the distance between two uniformly distributed random points in the unit square

restart;

 

The density for |x-y|^2 in the unit interval

 

int(piecewise( (x-y)^2<t, 1, 0), [x=0..1,y=0..1]) assuming t>0:

f1 := unapply(simplify(diff(%, t)), t) assuming t>0;

f1 := proc (t) options operator, arrow; piecewise(t <= 1, -(sqrt(t)-1)/sqrt(t), 1 < t, 0) end proc

(1)

 

The density for ||x-y||^2 in the unit square

 

simplify(int( f1(s)*f1(t-s),s=0..t)) assuming t>0:
f2:=unapply(piecewise(t>0,%,0), t);

f2 := proc (t) options operator, arrow; piecewise(0 < t, piecewise(t < 1, Pi-4*sqrt(t)+t, t < 2, -t+4*sqrt(t-1)-2*arcsin((-2+t)/t)-2, 2 <= t, 0), 0) end proc

(2)

 

The cdf for ||x-y||^2  in the unit square

 

simplify(int(f2(s), s=0..t)) assuming t>0:
F2:= unapply(%, t);

F2 := proc (t) options operator, arrow; (1/6)*piecewise(t < 1, -16*t^(3/2)+6*t*Pi+3*t^2, t < 2, -12*arcsin((-2+t)/t)*t+(16*t+8)*sqrt(t-1)-3*t^2-12*t+2, 2 <= t, 6) end proc

(3)

 

The cdf and pdf  for  ||x-y|| in the unit square

 

simplify(F2(t^2)) assuming t>0:
F := unapply(%, t) assuming t>0;
simplify( diff(F2(t^2),t) ) assuming t>0:
f:=unapply(%, t);

F := proc (t) options operator, arrow; (1/6)*piecewise(t < 1, t^2*(3*t^2+6*Pi-16*t), t < sqrt(2), -3*t^4-12*arcsin((t^2-2)/t^2)*t^2+16*sqrt(t^2-1)*t^2-12*t^2+8*sqrt(t^2-1)+2, sqrt(2) <= t, 6) end proc

 

proc (t) options operator, arrow; -2*t*piecewise(t <= 1, -t^2-Pi+4*t, t <= 2^(1/2), ((t^2-1)^(1/2)*t^2+2*arcsin((t^2-2)/t^2)*(t^2-1)^(1/2)-4*t^2+2*(t^2-1)^(1/2)+4)/(t^2-1)^(1/2), 2^(1/2) < t, 0) end proc

(4)

plot(f, 0..2, title="pdf for the distance between 2 points in I^2");

 

plot(F, 0..3, title="cdf for the distance between 2 points in I^2");

 

Note. Unfortunately Maple 2020 fails in computing the quadruple integral needed for a direct solution.

Download dist-points-vv.mw

You forgot a multiplication sign * after omega__n
expand(EXPR)
works without any assumption.

Just use the Constraints to eliminate variables.

restart:
local gamma:

SYS := dlogR[i, r] = sum(sum(rho[j, u]*pi[i, j, r, F]*(-epsilon[r]*sum(pi[k, j, r, F]*((dlogR[i, r] - dlogR[k, r]) + (-`dlog&delta;`[i, r] + `dlog&delta;`[k, r])), k = 1 .. J) + dlogR[j, u]), u = 1 .. S), j = 1 .. J)/rho[i, r];

dlogR[i, r] = (sum(sum(rho[j, u]*pi[i, j, r, F]*(-epsilon[r]*(sum(pi[k, j, r, F]*(dlogR[i, r]-dlogR[k, r]-`dlog&delta;`[i, r]+`dlog&delta;`[k, r]), k = 1 .. J))+dlogR[j, u]), u = 1 .. S), j = 1 .. J))/rho[i, r]

(1)

EQ:=[seq( eval(SYS, [J = 3, S = 1,r = 1]), i=1..3)]:

indets(EQ):

X:=select( u -> evalb(convert(u,string)[1..5]="dlogR"), %);

{dlogR[1, 1], dlogR[2, 1], dlogR[3, 1]}

(2)

Cons := {seq(seq(add(pi[i, j, r, F], i = 1..3) = 1, j = 1..3), r = 1..1)}

{pi[1, 1, 1, F]+pi[2, 1, 1, F]+pi[3, 1, 1, F] = 1, pi[1, 2, 1, F]+pi[2, 2, 1, F]+pi[3, 2, 1, F] = 1, pi[1, 3, 1, F]+pi[2, 3, 1, F]+pi[3, 3, 1, F] = 1}

(3)

CONS:= solve(Cons, select(u -> (op(1,u)=3),  indets(Cons)));

{pi[3, 1, 1, F] = -pi[1, 1, 1, F]-pi[2, 1, 1, F]+1, pi[3, 2, 1, F] = -pi[1, 2, 1, F]-pi[2, 2, 1, F]+1, pi[3, 3, 1, F] = -pi[1, 3, 1, F]-pi[2, 3, 1, F]+1}

(4)

EQIND:=eval(EQ,CONS):

SOL:=simplify(solve(EQIND,X)):

SOL[1]; SOL[2]; SOL[3];

dlogR[1, 1] = ((`dlog&delta;`[1, 1]-`dlog&delta;`[3, 1]+dlogR[3, 1])*(pi[2, 2, 1, F]*pi[1, 2, 1, F]*(pi[2, 2, 1, F]+pi[1, 2, 1, F]-1)*rho[2, 1]^2+(((-pi[2, 1, 1, F]^2+pi[2, 1, 1, F])*pi[1, 2, 1, F]^2+(2*pi[1, 1, 1, F]*pi[2, 1, 1, F]*pi[2, 2, 1, F]+pi[2, 1, 1, F]^2-pi[2, 1, 1, F])*pi[1, 2, 1, F]-pi[2, 2, 1, F]*pi[1, 1, 1, F]*(pi[1, 1, 1, F]-1)*(pi[2, 2, 1, F]-1))*rho[1, 1]-((pi[2, 3, 1, F]^2-pi[2, 3, 1, F])*pi[1, 2, 1, F]^2+(-2*pi[1, 3, 1, F]*pi[2, 2, 1, F]*pi[2, 3, 1, F]-pi[2, 3, 1, F]^2+pi[2, 3, 1, F])*pi[1, 2, 1, F]+pi[2, 2, 1, F]*pi[1, 3, 1, F]*(pi[1, 3, 1, F]-1)*(pi[2, 2, 1, F]-1))*rho[3, 1])*rho[2, 1]+pi[1, 1, 1, F]*pi[2, 1, 1, F]*(pi[2, 1, 1, F]+pi[1, 1, 1, F]-1)*rho[1, 1]^2-rho[3, 1]*((pi[2, 3, 1, F]^2-pi[2, 3, 1, F])*pi[1, 1, 1, F]^2-pi[2, 3, 1, F]*(2*pi[1, 3, 1, F]*pi[2, 1, 1, F]+pi[2, 3, 1, F]-1)*pi[1, 1, 1, F]+pi[2, 1, 1, F]*pi[1, 3, 1, F]*(pi[2, 1, 1, F]-1)*(pi[1, 3, 1, F]-1))*rho[1, 1]+pi[2, 3, 1, F]*rho[3, 1]^2*pi[1, 3, 1, F]*(pi[2, 3, 1, F]+pi[1, 3, 1, F]-1))*epsilon[1]^2+(pi[1, 2, 1, F]*(`dlog&delta;`[1, 1]-`dlog&delta;`[3, 1]+dlogR[3, 1])*(pi[2, 2, 1, F]+pi[1, 2, 1, F]-1)*rho[2, 1]^2+((pi[2, 1, 1, F]*((`dlog&delta;`[1, 1]-`dlog&delta;`[3, 1]+dlogR[3, 1])*pi[1, 1, 1, F]+(pi[2, 1, 1, F]-1)*(`dlog&delta;`[2, 1]-`dlog&delta;`[3, 1]+dlogR[3, 1]))*pi[1, 2, 1, F]-((`dlog&delta;`[1, 1]-`dlog&delta;`[3, 1]+dlogR[3, 1])*pi[1, 1, 1, F]+(`dlog&delta;`[2, 1]-`dlog&delta;`[3, 1]+dlogR[3, 1])*pi[2, 1, 1, F]-`dlog&delta;`[1, 1]+`dlog&delta;`[3, 1]-dlogR[3, 1])*(pi[2, 2, 1, F]-1)*pi[1, 1, 1, F])*rho[1, 1]+(-(pi[2, 2, 1, F]*dlogR[3, 1]+(-`dlog&delta;`[1, 1]+`dlog&delta;`[3, 1]-dlogR[3, 1])*pi[1, 3, 1, F]-(`dlog&delta;`[2, 1]-`dlog&delta;`[3, 1]+dlogR[3, 1])*(pi[2, 3, 1, F]-1))*pi[2, 3, 1, F]*pi[1, 2, 1, F]+(pi[2, 2, 1, F]*dlogR[3, 1]+(-`dlog&delta;`[1, 1]+`dlog&delta;`[3, 1]-dlogR[3, 1])*pi[1, 3, 1, F]+(-`dlog&delta;`[2, 1]+`dlog&delta;`[3, 1]-dlogR[3, 1])*pi[2, 3, 1, F]+`dlog&delta;`[1, 1]-`dlog&delta;`[3, 1]+dlogR[3, 1])*(pi[2, 2, 1, F]-1)*pi[1, 3, 1, F])*rho[3, 1])*rho[2, 1]-(pi[2, 1, 1, F]*(pi[2, 3, 1, F]*pi[1, 1, 1, F]-pi[1, 3, 1, F]*(pi[2, 1, 1, F]-1))*rho[1, 1]+pi[2, 3, 1, F]*rho[3, 1]*pi[1, 3, 1, F])*dlogR[3, 1]*rho[3, 1])*epsilon[1]+rho[2, 1]*dlogR[3, 1]*(-pi[2, 3, 1, F]*pi[1, 2, 1, F]+pi[1, 3, 1,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, 1, F]^2-pi[1, 3, 1, F])*pi[2, 2, 1, F]^2+(-2*pi[1, 2, 1, F]*pi[1, 3, 1, F]*pi[2, 3, 1, F]-pi[1, 3, 1, F]^2+pi[1, 3, 1, F])*pi[2, 2, 1, F]+pi[2, 3, 1, F]*pi[1, 2, 1, F]*(pi[1, 2, 1, F]-1)*(pi[2, 3, 1, F]-1))*rho[3, 1]*rho[2, 1]+pi[2, 3, 1, F]*rho[3, 1]^2*pi[1, 3, 1, F]*(pi[2, 3, 1, F]+pi[1, 3, 1, F]-1))*epsilon[1]^2+(pi[2, 1, 1, F]*(pi[2, 1, 1, F]+pi[1, 1, 1, F]-1)*(`dlog&delta;`[2, 1]-`dlog&delta;`[3, 1]+dlogR[3, 1])*rho[1, 1]^2+((pi[1, 2, 1, F]*((`dlog&delta;`[2, 1]-`dlog&delta;`[3, 1]+dlogR[3, 1])*pi[2, 2, 1, F]+(pi[1, 2, 1, F]-1)*(`dlog&delta;`[1, 1]-`dlog&delta;`[3, 1]+dlogR[3, 1]))*pi[2, 1, 1, F]-(pi[1, 1, 1, F]-1)*pi[2, 2, 1, F]*((`dlog&delta;`[2, 1]-`dlog&delta;`[3, 1]+dlogR[3, 1])*pi[2, 2, 1, F]+(`dlog&delta;`[1, 1]-`dlog&delta;`[3, 1]+dlogR[3, 1])*pi[1, 2, 1, F]-`dlog&delta;`[2, 1]+`dlog&delta;`[3, 1]-dlogR[3, 1]))*rho[2, 1]-(-pi[1, 3, 1, F]*(-pi[1, 1, 1, F]*dlogR[3, 1]+(`dlog&delta;`[2, 1]-`dlog&delta;`[3, 1]+dlogR[3, 1])*pi[2, 3, 1, F]+(pi[1, 3, 1, F]-1)*(`dlog&delta;`[1, 1]-`dlog&delta;`[3, 1]+dlogR[3, 1]))*pi[2, 1, 1, F]+(pi[1, 1, 1, F]-1)*pi[2, 3, 1, F]*(-pi[1, 1, 1, F]*dlogR[3, 1]+(`dlog&delta;`[2, 1]-`dlog&delta;`[3, 1]+dlogR[3, 1])*pi[2, 3, 1, F]+(`dlog&delta;`[1, 1]-`dlog&delta;`[3, 1]+dlogR[3, 1])*pi[1, 3, 1, F]-`dlog&delta;`[2, 1]+`dlog&delta;`[3, 1]-dlogR[3, 1]))*rho[3, 1])*rho[1, 1]-((pi[1, 3, 1, F]*pi[2, 2, 1, F]-pi[2, 3, 1, F]*(pi[1, 2, 1, F]-1))*pi[1, 2, 1, F]*rho[2, 1]+pi[2, 3, 1, F]*rho[3, 1]*pi[1, 3, 1, F])*dlogR[3, 1]*rho[3, 1])*epsilon[1]+(-pi[1, 3, 1, F]*pi[2, 1, 1, F]+pi[2, 3, 1, F]*(pi[1, 1, 1, F]-1))*dlogR[3, 1]*rho[1, 1]*rho[3, 1])/((pi[1, 1, 1, F]*pi[2, 1, 1, F]*(pi[2, 1, 1, F]+pi[1, 1, 1, F]-1)*rho[1, 1]^2+(((-pi[1, 2, 1, F]^2+pi[1, 2, 1, F])*pi[2, 1, 1, F]^2+(2*pi[1, 1, 1, F]*pi[1, 2, 1, F]*pi[2, 2, 1, F]+pi[1, 2, 1, F]^2-pi[1, 2, 1, F])*pi[2, 1, 1, F]-pi[2, 2, 1, F]*pi[1, 1, 1, F]*(pi[1, 1, 1, F]-1)*(pi[2, 2, 1, F]-1))*rho[2, 1]-rho[3, 1]*((pi[1, 3, 1, F]^2-pi[1, 3, 1, F])*pi[2, 1, 1, F]^2+(-2*pi[1, 1, 1, F]*pi[1, 3, 1, F]*pi[2, 3, 1, F]-pi[1, 3, 1, F]^2+pi[1, 3, 1, F])*pi[2, 1, 1, F]+pi[2, 3, 1, F]*pi[1, 1, 1, F]*(pi[1, 1, 1, F]-1)*(pi[2, 3, 1, F]-1)))*rho[1, 1]+pi[2, 2, 1, F]*pi[1, 2, 1, F]*(pi[2, 2, 1, F]+pi[1, 2, 1, F]-1)*rho[2, 1]^2-((pi[1, 3, 1, F]^2-pi[1, 3, 1, F])*pi[2, 2, 1, F]^2+(-2*pi[1, 2, 1, F]*pi[1, 3, 1, F]*pi[2, 3, 1, F]-pi[1, 3, 1, F]^2+pi[1, 3, 1, F])*pi[2, 2, 1, F]+pi[2, 3, 1, F]*pi[1, 2, 1, F]*(pi[1, 2, 1, F]-1)*(pi[2, 3, 1, F]-1))*rho[3, 1]*rho[2, 1]+pi[2, 3, 1, F]*rho[3, 1]^2*pi[1, 3, 1, F]*(pi[2, 3, 1, F]+pi[1, 3, 1, F]-1))*epsilon[1]^2+(pi[2, 1, 1, F]*(pi[2, 1, 1, F]+pi[1, 1, 1, F]-1)*rho[1, 1]^2+(-(pi[2, 2, 1, F]+pi[1, 1, 1, F])*(-pi[1, 2, 1, F]*pi[2, 1, 1, F]+(pi[1, 1, 1, F]-1)*(pi[2, 2, 1, F]-1))*rho[2, 1]-pi[2, 3, 1, F]*(-pi[1, 3, 1, F]*pi[2, 1, 1, F]+(pi[1, 1, 1, F]-1)*(pi[2, 3, 1, F]-1))*rho[3, 1])*rho[1, 1]+(pi[1, 2, 1, F]*(pi[2, 2, 1, F]+pi[1, 2, 1, F]-1)*rho[2, 1]-((pi[1, 3, 1, F]-1)*pi[2, 2, 1, F]-pi[2, 3, 1, F]*pi[1, 2, 1, F]-pi[1, 3, 1, F]+1)*pi[1, 3, 1, F]*rho[3, 1])*rho[2, 1])*epsilon[1]-rho[2, 1]*(-pi[1, 2, 1, F]*pi[2, 1, 1, F]+(pi[1, 1, 1, F]-1)*(pi[2, 2, 1, F]-1))*rho[1, 1])

 

dlogR[3, 1] = dlogR[3, 1]

(5)

 

``

Download Example-vv.mw

# The bug looks severe to me. In Maple 2018 it is OK. 2019?
restart;
fname:= "atest.txt":
for i from 95 to 120 do
  a := 10^i + 13;   aok:=a;
  save a, fname;    read(fname);
  lprint('i'=i, filesize = FileTools:-Size(fname), OK=evalb(a=aok))
od:
# Correct only for i <= 96  (!?)

i = 95, filesize = 107, OK = true
i = 96, filesize = 108, OK = true
i = 97, filesize = 93, OK = false
i = 98, filesize = 94, OK = false
i = 99, filesize = 95, OK = false
i = 100, filesize = 96, OK = false
i = 101, filesize = 97, OK = false
i = 102, filesize = 98, OK = false
i = 103, filesize = 99, OK = false
i = 104, filesize = 100, OK = false
i = 105, filesize = 101, OK = false
i = 106, filesize = 102, OK = false
i = 107, filesize = 103, OK = false
i = 108, filesize = 104, OK = false
i = 109, filesize = 105, OK = false
i = 110, filesize = 106, OK = false
i = 111, filesize = 107, OK = false
i = 112, filesize = 108, OK = false
i = 113, filesize = 109, OK = false
i = 114, filesize = 110, OK = false
i = 115, filesize = 111, OK = false

i = 116, filesize = 93, OK = false
i = 117, filesize = 94, OK = false
i = 118, filesize = 95, OK = false
i = 119, filesize = 96, OK = false
i = 120, filesize = 97, OK = false

Edit. Same for floats! Try:  Digits:=200 and a:=10^i + 13.0

P:=proc(p,x,y)
  local pp:=expand(p), ld:=ldegree(pp,{x,y}), a:=floor(ld/2), b:=ld-a;
  coeff(coeff(pp,x,a),y,b)*x^a*y^b
end proc;

P(13*x^2*y^2 + x*y^2 + 2*y*x^2,x,y) # x*y^2
P(100*x^2*y^2 + 35*y*x + 45*x,x,y)   # 0

The double integral diverges.
I have supposed that Dgamma = D(gamma), Dphi = D(phi).
(Use gamma1 instead of gamma = used by Maple.) 
 

g(a) = piecewise(a < 0, 1/4*2^(1/2)*(a^2)^(1/4)*exp(-1/2*a^2)*BesselK(1/4,1/2*a^2),
-1/2*Pi^(1/2)*2^(1/4)*exp(-1/2*a^2)*(2^(1/2)*CylinderD(3/2,-2^(1/2)*a)+
2*a*CylinderD(1/2,-2^(1/2)*a)));

 

Note that actually the second branch is valid for a<0 too!

with(LinearAlgebra):

A:=RandomMatrix(4, generator=(()->randpoly(x, degree=1)));

Matrix(4, 4, {(1, 1) = -27*x+65, (1, 2) = 88*x+10, (1, 3) = -6*x+80, (1, 4) = -84*x+57, (2, 1) = -49*x+31, (2, 2) = 73*x+95, (2, 3) = 68*x-29, (2, 4) = 5*x-26, (3, 1) = -51*x+88, (3, 2) = 97*x-67, (3, 3) = 58*x+29, (3, 4) = 37*x+5, (4, 1) = -36*x-57, (4, 2) = 85*x+80, (4, 3) = 90*x+74, (4, 4) = 27*x+9})

(1)

f:=unapply('Determinant'(A), x):

fsolve(f, -5..5);

-.8230972093

(2)

fsolve(f(x), x, complex)

HFloat(-0.8230972092886379), HFloat(0.47998410600004493), HFloat(3.0828436546763673)-HFloat(2.183514741277015)*I, HFloat(3.0828436546763673)+HFloat(2.183514741277015)*I

(3)

#solve(f(x), x, explicit)

 

 

Windows:

src:=cat(kernelopts(mapledir), "\\samples"):
dest:="D:\\tmp\\samples\\":
system( cat("xcopy \"", src, "\" ", dest, " /E") );

 

No, if   f := y z x + exp(x) cos(y) + g(y, z)
your ff is not correct.

IntWithConst:=proc(f::algebraic, x::name, C::name:=_F)
  local u:=indets(f, And(name, Not(constant))) minus {x};
  int(f, x) + C(u[])
end:

A := exp(x)*cos(y) + y*z:

f:=IntWithConst(A, x);
       
f := y*z*x + exp(x)*cos(y) + _F(y, z)

diff(f,y);
      
z*x - exp(x)*sin(y) + diff(_F(y, z), y)

 

The principle is simple: if diff(f(x,y), x) = 0 then f(x,y) is constant with respect to x, which means that f(x,y) depends only on y, i.e. f(x,y) = g(y).

If you want to see this in Maple:

pdsolve( diff(f(x,y), x) = 0, f(x,y) );

         f(x, y) = _F1(y)

Actually, the fact is true only locally: in a non-convex domain, f(x,y) could depend on x (!). Maths is difficult...

So, you want a partial fraction form. Unfortunately Maple does it only for rational expressions and a substitution is needed.

S:=sqrt(N__s):
subs(x=S, convert(subs(S=x,S^2=x^2, ex1), parfrac));

 

 

 

 

The standard plot is over a rectangle (i.e. the xy projection is a rectangle).

plot3d(4*x^2+9*y^2, x=-5..5, y=-4..4);

 

You probably want an ellipse, obtained by cutting the paraboloid by an horizontal plane.

solve(4*x^2+9*y^2<=100,[x,y])

[[x <= 5, -5 <= x, y <= (2/3)*(-x^2+25)^(1/2), -(2/3)*(-x^2+25)^(1/2) <= y]]

(1)

plot3d(4*x^2+9*y^2, x=-5..5, y=-(2*sqrt(-x^2 + 25))/3..(2*sqrt(-x^2 + 25))/3)

 

 

A simpler method is to use the view option

plot3d(4*x^2+9*y^2, x=-5..5, y=-5..5, view=0..100);

 

The loci are two circles centered at B and C.

(The geometry package cannot be used generally for such problems; they must be solved directly.)


 

restart;

A triangle ABC with fixed B and C vertices is considered in the plane, A being variable so that AB+AC remains constant and equal to a given length L.
We call P, T, T1  the points of contact of the excircle in the angle B with the sides BC, AB and AC respectively.
Show that P is fixed and is a vertex of the ellipse described by point A.

What are the locus of T and T1? How to animate the drawing when A move ? Thank you.

 

The equation of the ellipse is x^2/p^2 + y^2/q&2 = 1 (0<q<p);   f is the focal length
a,b,c are the sides of the triangle ABC.

 

c:=p+u*f/p:
b:=p-u*f/p:
a:=2*f:

A:=[u,v]:
B:=[-f,0]:
C:=[f,0]:

PC:=(a+b+c)/2-a:

PO=f+PC;

PO = p

(1)

# ==> P is a vertex

P:=[p,0]:

PB:=p+f:

T:=B+(A-B) *~ (PB/c):

[x,y]-simplify(T):

elim:=eliminate([%[], u^2/p^2+v^2/q^2-1, f^2=p^2-q^2], [u,v]);

[{u = p*(f^2-p*x)/(f^2-f*p+f*x-p^2), v = y*(f^2-p^2)/(f^2-f*p+f*x-p^2)}, {f^2-p^2+q^2, f^2*y^2+2*f*p*q^2-2*f*q^2*x+p^2*q^2-p^2*y^2-q^2*x^2}]

(2)

eqT:=simplify(elim[2][2], [f^2=p^2-q^2]);

q^2*(2*f*p-2*f*x+p^2-x^2-y^2)

(3)

Student:-Precalculus:-CompleteSquare(eqT,{x,y});

-q^2*y^2-q^2*(x+f)^2+q^2*(2*f*p+p^2)+f^2*q^2

(4)

 ==>  The locus of T is a circle having the center at B.

 

T1:=C+(A-C) *~ (PC/b):

[x,y]-simplify(T1):

elim1:=eliminate([%[], u^2/p^2+v^2/q^2-1, f^2=p^2-q^2], [u,v]);

[{u = p*(f^2-p*x)/(f^2+f*p-f*x-p^2), v = y*(f^2-p^2)/(f^2+f*p-f*x-p^2)}, {f^2-p^2+q^2, f^2*y^2-2*f*p*q^2+2*f*q^2*x+p^2*q^2-p^2*y^2-q^2*x^2}]

(5)

eqT1:=simplify(elim1[2][2], [f^2=p^2-q^2]);

-q^2*(2*f*p-2*f*x-p^2+x^2+y^2)

(6)

Student:-Precalculus:-CompleteSquare(eqT1,{x,y});

-q^2*y^2-q^2*(x-f)^2-q^2*(2*f*p-p^2)+f^2*q^2

(7)

==> The locus of T1 is a circle having the center at C.

##### Plot ####

p:=5;q:=3;f:=4;
v:=solve(u^2/p^2+vv^2/q^2-1,vv)[1]:

5

 

3

 

4

(8)

pp:=proc(u_)
global u; uses plots;
u:=u_;
display(
  plot([A,B,C,A]),
  plot([T,T1,P], style=point, color=blue, symbolsize=20),
  implicitplot(x^2/p^2+y^2/q^2-1, x=-10..10, y=-10..10, color=pink),
  implicitplot(eqT,  x=-20..10, y=-1..10, color=green),
  implicitplot(eqT1, x=-20..10, y=-1..10, color=blue),
  scaling=constrained, view=[-15..6, 0..10]
) end proc:

Explore(pp(u_), u_=-p*1.0 .. p)

 

 


 

 

 

Download geom-loci-ellipse-circles.mw

You have some inaccurate formulations, starting with the definition of a defective eigenvalue (see the cited wiki article).
Anyway, the defective eigenvectors can be obtained directly from the Jordan form of the matrix (they are the columns of Q):

A :=Matrix([[1,-2],[2,5]]):
J,Q:=LinearAlgebra:-JordanForm(A, output=['J','Q']);

         

v1:=Q[..,1];
v2:=Q[..,2];


(A-3).v1,  (A-3).v2,  (A-3)^2 . v2;

First 36 37 38 39 40 41 42 Last Page 38 of 121