# Revision history [back]

### NotImplementedError

Hi its ok when I set matrixForm=False, but I got NotImplementedError error when I choose matrixForm=True.

Why ?

var('r0_0,r0_1,r1_0,r1_1,p_0,p_1,v_0,v_1,x,y')
def projectvOnV(v,V) :
# projection matrix
x=V[0];y=V[1]
projectM=matrix(SR,[(x^2/(x^2 + y^2), x*y/(x^2 + y^2)),
(x*y/(x^2 + y^2), y^2/(x^2 + y^2))])

return projectM*v

matrixForm=True

if matrixForm :
Vr0 = matrix(SR,[r0_0,r0_1]).transpose()
Vr1 = matrix(SR,[r1_0,r1_1]).transpose()
Vp = matrix(SR,[p_0,p_1]).transpose()

else :
Vr0 = vector(SR,[r0_0,r0_1])
Vr1 = vector(SR,[r1_0,r1_1])
Vp = vector(SR,[p_0,p_1])

Vp=Vr0-Vr1
Vp_0=projectvOnV(Vr0,Vp)# vector Vr0 projeted on Vp

show("Vp : ",Vp,Vp.parent())
show("Vp_0 : ",Vp_0,Vp_0.parent())

Vin=Vr0-Vp_0
displayedObject=[Vin,Vr0,Vr1,Vp,Vp_0]
if matrixForm :
for e in displayedObject :
e=vector(e)
@interact
def _( thetaNumVr0=slider(0.01,2*pi,0.05,default=3.5),
rhoNumVr0=slider(0.01,4,0.05,default=2),
thetaNumVr1=slider(0.01,2*pi,0.05,default=5),
rhoNumVr1=slider(0.01,4,0.05,default=1)):
numL=[r0_0==rhoNumVr0*cos(thetaNumVr0),r0_1==rhoNumVr0*sin(thetaNumVr0),
r1_0==rhoNumVr1*cos(thetaNumVr1),r1_1==rhoNumVr1*sin(thetaNumVr1)]

plt=plot(arrow([0,0],Vr0.subs(numL),color="red",width=3,linestyle='dashed'))
plt+=text("Vr0",(Vr0*4/5+vector([0.1,0.1])).subs(numL),color="red",fontsize=10)

plt+=plot(arrow([0,0],Vr1.subs(numL),color="blue",width=3,linestyle='dashed'))
plt+=text("Vr1",(Vr1*4/5+vector([0,0.1])).subs(numL),color="blue",fontsize=10)

plt+=plot(arrow((Vr1).subs(numL).list(),(Vr1+Vp).subs(numL),color="grey",width=3,linestyle='dashed'))
plt+=text("Vp",((Vr1+Vp).subs(numL))/2,color="grey",fontsize=10)

plt+=plot(arrow([0,0],(Vp_0).subs(numL),color="pink",width=3,linestyle='dashed'))
plt+=text("Vp_0",(Vp_0*4/5+vector([0.1,0.1])).subs(numL),color="pink",fontsize=10)

plt+=plot(arrow([0,0],(Vin).subs(numL),color="black",width=3,linestyle='solid'))
plt+=text("Vin",(Vin*4/5+vector([0.1,0.1])).subs(numL),color="black",fontsize=10)

show(plt,aspect_ratio=1)


### NotImplementedError

Hi Hi

UBUNTU 18.04, SageMath 9.1, Jupyter Notebook

its ok when I set matrixForm=False, but I got NotImplementedError error when I choose matrixForm=True.

Why ?

var('r0_0,r0_1,r1_0,r1_1,p_0,p_1,v_0,v_1,x,y')
def projectvOnV(v,V) :
# projection matrix
x=V[0];y=V[1]
projectM=matrix(SR,[(x^2/(x^2 + y^2), x*y/(x^2 + y^2)),
(x*y/(x^2 + y^2), y^2/(x^2 + y^2))])

return projectM*v

matrixForm=True

if matrixForm :
Vr0 = matrix(SR,[r0_0,r0_1]).transpose()
Vr1 = matrix(SR,[r1_0,r1_1]).transpose()
Vp = matrix(SR,[p_0,p_1]).transpose()

else :
Vr0 = vector(SR,[r0_0,r0_1])
Vr1 = vector(SR,[r1_0,r1_1])
Vp = vector(SR,[p_0,p_1])

Vp=Vr0-Vr1
Vp_0=projectvOnV(Vr0,Vp)# vector Vr0 projeted on Vp

show("Vp : ",Vp,Vp.parent())
show("Vp_0 : ",Vp_0,Vp_0.parent())

Vin=Vr0-Vp_0
displayedObject=[Vin,Vr0,Vr1,Vp,Vp_0]
if matrixForm :
for e in displayedObject :
e=vector(e)
@interact
def _( thetaNumVr0=slider(0.01,2*pi,0.05,default=3.5),
rhoNumVr0=slider(0.01,4,0.05,default=2),
thetaNumVr1=slider(0.01,2*pi,0.05,default=5),
rhoNumVr1=slider(0.01,4,0.05,default=1)):
numL=[r0_0==rhoNumVr0*cos(thetaNumVr0),r0_1==rhoNumVr0*sin(thetaNumVr0),
r1_0==rhoNumVr1*cos(thetaNumVr1),r1_1==rhoNumVr1*sin(thetaNumVr1)]

plt=plot(arrow([0,0],Vr0.subs(numL),color="red",width=3,linestyle='dashed'))
plt+=text("Vr0",(Vr0*4/5+vector([0.1,0.1])).subs(numL),color="red",fontsize=10)

plt+=plot(arrow([0,0],Vr1.subs(numL),color="blue",width=3,linestyle='dashed'))
plt+=text("Vr1",(Vr1*4/5+vector([0,0.1])).subs(numL),color="blue",fontsize=10)

plt+=plot(arrow((Vr1).subs(numL).list(),(Vr1+Vp).subs(numL),color="grey",width=3,linestyle='dashed'))
plt+=text("Vp",((Vr1+Vp).subs(numL))/2,color="grey",fontsize=10)

plt+=plot(arrow([0,0],(Vp_0).subs(numL),color="pink",width=3,linestyle='dashed'))
plt+=text("Vp_0",(Vp_0*4/5+vector([0.1,0.1])).subs(numL),color="pink",fontsize=10)

plt+=plot(arrow([0,0],(Vin).subs(numL),color="black",width=3,linestyle='solid'))
plt+=text("Vin",(Vin*4/5+vector([0.1,0.1])).subs(numL),color="black",fontsize=10)

show(plt,aspect_ratio=1)