Visualizing the curve \((\pi^{(\lambda)})_{\lambda \in (0,1)}\)ΒΆ

import numpy as np
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import axes3d, Axes3D
from itertools import combinations
import scipy as sp

#### Data of counts of reals lines as lambda ranges between 1/100 and 100/100.
Rraw = np.array([   [10000.0,0.0,0.,0.0],
                    [10000.0,0.0,0.,0.0],
                    [10000.0,0.0,0.,0.0],
                    [9995.0,5.0,0.,0.0],
                    [9994.0,5.0,1.,0.0],
                    [9985.0,13.0,2.,0.0],
                    [9984.0,14.0,2.,0.0],
                    [9973.0,25.0,2.,0.0],
                    [9940.0,57.0,3.,0.0],
                    [9923.0,71.0,6.,0.0],
                    [9873.0,120.0,7.,0.0],
                    [9841.0,142.0,15.,2.0],
                    [9753.0,223.0,24.,0.0],
                    [9710.0,259.0,31.,0.0],
                    [9607.0,367.0,26.,0.0],
                    [9525.0,429.0,45.,1.0],
                    [9416.0,521.0,63.,0.0],
                    [9263.0,653.0,84.,0.0],
                    [9102.0,806.0,92.,0.0],
                    [8889.0,964.0,144.,3.0],
                    [8761.0,1095.0,143.,1.0],
                    [8567.0,1239.0,191.,3.0],
                    [8287.0,1478.0,231.,4.0],
                    [8130.0,1577.0,290.,3.0],
                    [7916.0,1780.0,298.,6.0],
                    [7715.0,1924.0,358.,3.0],
                    [7325.0,2230.0,439.,6.0],
                    [7094.0,2440.0,461.,5.0],
                    [6810.0,2605.0,578.,7.0],
                    [6723.0,2668.0,603.,6.0],
                    [6307.0,2963.0,718.,12.0],
                    [6032.0,3148.0,809.,11.0],
                    [5716.0,3321.0,934.,29.0],
                    [5471.0,3480.0,1037.,12.0],
                    [5191.0,3721.0,1068.,20.0],
                    [4972.0,3822.0,1186.,20.0],
                    [4702.0,4018.0,1253.,27.0],
                    [4447.0,4094.0,1429.,30.0],
                    [4205.0,4207.0,1555.,33.0],
                    [3955.0,4423.0,1597.,25.0],
                    [3757.0,4450.0,1743.,50.0],
                    [3466.0,4559.0,1926.,49.0],
                    [3267.0,4674.0,2014.,45.0],
                    [2995.0,4763.0,2180.,62.0],
                    [2723.0,4908.0,2312.,57.0],
                    [2684.0,4852.0,2403.,61.0],
                    [2429.0,4872.0,2625.,74.0],
                    [2274.0,4915.0,2738.,73.0],
                    [2086.0,5004.0,2837.,73.0],
                    [1965.0,4978.0,2979.,78.0],
                    [1795.0,4961.0,3161.,83.0],
                    [1727.0,4942.0,3232.,99.0],
                    [1523.0,4965.0,3406.,106.0],
                    [1478.0,4902.0,3526.,94.0],
                    [1374.0,4807.0,3704.,115.0],
                    [1227.0,4910.0,3754.,109.0],
                    [1122.0,4928.0,3825.,125.0],
                    [1075.0,4766.0,4022.,137.0],
                    [1061.0,4672.0,4133.,134.0],
                    [942.0,4627.0,4295.,136.0],
                    [926.0,4500.0,4411.,163.0],
                    [819.0,4521.0,4495.,165.0],
                    [790.0,4501.0,4575.,134.0],
                    [774.0,4443.0,4607.,176.0],
                    [646.0,4435.0,4747.,172.0],
                    [615.0,4321.0,4853.,211.0],
                    [608.0,4338.0,4863.,191.0],
                    [610.0,4240.0,4949.,201.0],
                    [576.0,4184.0,5050.,190.0],
                    [490.0,4140.0,5163.,207.0],
                    [451.0,4088.0,5239.,222.0],
                    [475.0,3947.0,5376.,202.0],
                    [448.0,4133.0,5217.,202.0],
                    [413.0,4049.0,5315.,223.0],
                    [432.0,3910.0,5428.,230.0],
                    [407.0,3872.0,5480.,241.0],
                    [383.0,3767.0,5595.,255.0],
                    [363.0,3724.0,5667.,246.0],
                    [337.0,3756.0,5644.,263.0],
                    [358.0,3840.0,5546.,256.0],
                    [338.0,3802.0,5613.,247.0],
                    [325.0,3734.0,5674.,267.0],
                    [324.0,3724.0,5684.,268.0],
                    [301.0,3713.0,5697.,289.0],
                    [337.0,3638.0,5758.,267.0],
                    [285.0,3559.0,5881.,275.0],
                    [271.0,3729.0,5744.,256.0],
                    [307.0,3565.0,5863.,265.0],
                    [270.0,3690.0,5758.,282.0],
                    [290.0,3627.0,5810.,273.0],
                    [294.0,3607.0,5835.,264.0],
                    [311.0,3535.0,5880.,274.0],
                    [250.0,3527.0,5948.,275.0],
                    [276.0,3626.0,5834.,264.0],
                    [239.0,3607.0,5887.,267.0],
                    [251.0,3590.0,5851.,308.0],
                    [260.0,3594.0,5878.,268.0],
                    [249.0,3581.0,5872.,298.0],
                    [256.0,3525.0,5943.,276.0],
                    [269.0,3563.0,5906.,262.0]])/10000



######## Plotting the data points in a suitable 3-d space.

A = np.array([[ 1/2,  1/np.sqrt(2),  0],
              [-1/2,  0,             1/np.sqrt(2)],
              [ 1/2, -1/np.sqrt(2),  0],
              [-1/2,  0,             -1//np.sqrt(2)]])


m = np.array([1/4,1/4,1/4,1/4])

R2 = np.zeros((100,3))


for i in range(100):

    l = Rraw[i,:] - m

    x1 = np.dot(l,A[:,0])
    x2 = np.dot(l,A[:,1])
    x3 = np.dot(l,A[:,2])

    R2[i,:] = np.array([x1,x2,x3])



t = np.linspace(0,1,1000)

a = np.array([ 1, 0, 0, 0]) - m
v3 = np.array([np.dot(a,A[:,0]),
               np.dot(a,A[:,1]),
               np.dot(a,A[:,2])])

b  = np.array([ 0, 1, 0, 0]) - m
v7  = np.array([np.dot(b,A[:,0]),
                np.dot(b,A[:,1]),
                np.dot(b,A[:,2])])


c = np.array([ 0, 0, 1, 0]) - m
v15 = np.array([np.dot(c,A[:,0]),
                np.dot(c,A[:,1]),
                np.dot(c,A[:,2])])


d = np.array([ 0, 0, 0, 1]) - m
v27 = np.array([np.dot(d,A[:,0]),
                np.dot(d,A[:,1]),
                np.dot(d,A[:,2])])



v3 = v3.reshape(3,1)
v7 = v7.reshape(3,1)
v15 = v15.reshape(3,1)
v27 = v27.reshape(3,1)

e_3_7 = t*v3 + (1-t)*v7
e_3_15 = t*v3 + (1-t)*v15
e_3_27 = t*v3 + (1-t)*v27

e_7_15 = t*v7 + (1-t)*v15
e_7_27 = t*v7 + (1-t)*v27
e_15_27 = t*v15 + (1-t)*v27


%matplotlib qt


fig= plt.figure()
ax = fig.add_subplot(111,projection='3d')
ax.grid(False)
plt.axis('off')

ax.plot(e_3_7[0,:], e_3_7[1,:], e_3_7[2,:], color="black")
ax.plot(e_3_15[0,:], e_3_15[1,:], e_3_15[2,:] , color="black")
ax.plot(e_3_27[0,:], e_3_27[1,:], e_3_27[2,:] , color="black")
ax.plot(e_7_15[0,:], e_7_15[1,:], e_7_15[2,:] , color="black")
ax.plot(e_7_27[0,:], e_7_27[1,:], e_7_27[2,:], color="black")
ax.plot(e_15_27[0,:], e_15_27[1,:], e_15_27[2,:] , color="black")


ax.scatter(R2[:,0],R2[:,1] , R2[:,2]  , color="blue")


ax.scatter(v3[0,0],v3[1,0],v3[2,0], color='red')
ax.text(v3[0,0],v3[1,0],v3[2,0],  '%s' % (str(3)), size=20, zorder=1, color='k')


ax.scatter(v7[0,0],v7[1,0],v7[2,0], color='red')
ax.text(v7[0,0],v7[1,0],v7[2,0],  '%s' % (str(7)), size=20, zorder=1, color='k')



ax.scatter(v15[0,0],v15[1,0],v15[2,0], color='red')
ax.text(v15[0,0],v15[1,0],v15[2,0], '%s' % (str(15)), size=20, zorder=1, color='k')


ax.scatter(v27[0,0],v27[1,0],v27[2,0], color='red')
ax.text(v27[0,0],v27[1,0],v27[2,0],  '%s' % (str(27)), size=20, zorder=1, color='k')


plt.show()