makeB'Section allows for easy creation of equations that define hyperplanes. The default creates a hash table with two keys: B'NumberCoefficients and B'SectionString. The first key is a list of numbers in CC that are coefficients, and the second key is a string representing the linear polynomial. The option RandomCoefficientGenerator can be set to a function to generate random numbers for the coefficients.
i1 : s=makeB'Section({x,y,z})
o1 = B'Section{...2...}
o1 : B'Section
|
i2 : class s
o2 = B'Section
o2 : Type
|
i3 : randomRealCoefficientGenerator=()->random(RR)
o3 = randomRealCoefficientGenerator
o3 : FunctionClosure
|
i4 : sReal=makeB'Section({x,y,z},RandomCoefficientGenerator=>randomRealCoefficientGenerator)
o4 = B'Section{...2...}
o4 : B'Section
|
i5 : sReal#B'NumberCoefficients
o5 = {.0741835, .808694, .362835}
o5 : List
|
i6 : randomRationalCoefficientGenerator=()->random(QQ)
o6 = randomRationalCoefficientGenerator
o6 : FunctionClosure
|
i7 : sRational=makeB'Section({x,y,z},RandomCoefficientGenerator=>randomRationalCoefficientGenerator)
o7 = B'Section{...2...}
o7 : B'Section
|
i8 : sRational#B'NumberCoefficients
7 1 7
o8 = {--, -, --}
10 2 10
o8 : List
|
i10 : X={x,y,z}
o10 = {x, y, z}
o10 : List
|
i11 : P={1,2,3}
o11 = {1, 2, 3}
o11 : List
|
i12 : affineContainingPoint=makeB'Section({x,y,z},ContainsPoint=>P)
o12 = B'Section{...3...}
o12 : B'Section
|
i13 : r= affineContainingPoint#B'SectionString
o13 = (1.18921+.849539*ii)*(x-(1)*(1))+(-.542371+.307137*ii)*(y-(1)*(2))+(
1.36945+.015633*ii)*(z-(1)*(3))
|
i14 : print r
(1.18921+.849539*ii)*(x-(1)*(1))+(-.542371+.307137*ii)*(y-(1)*(2))+(1.36945+.015633*ii)*(z-(1)*(3))
|