hermann on Sun, 11 Feb 2024 18:10:41 +0100 |
[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]
Re: GP cross product? |
On 2024-02-11 13:31, Bill Allombert wrote:
On Sun, Feb 11, 2024 at 01:44:24AM +0100, hermann@stamm-wilbrandt.de wrote:Then by Wikipedia definition perhaps simpler: ? cross=(a,b)->[a[2]*b[3]-a[3]*b[2],a[3]*b[1]-a[1]*b[3],a[1]*b[2]-a[2]*b[1]];Yes this is probably the best.First I came up with this:? cross=(a,b)->{m=matdet(Mat([[i,j,k]~,a~,b~]));[polcoef(m,1,i),polcoef(m,1,j),polcoef(m,1,k)]};Just for the record, never use polynomial unknowns for linear algebra. Instead just compute the values over a basis.
Thanks Bill, will try to remember that.
I searched for "cross" and "vector product" in GP user's guide and foundnothing. I searched mailing lists unsuccessfully as well.Yes, the cross product almost never occur in number theory.
I was surprised that cross product became interesting for me as well.I created ternary quadratic form to determine sum of three squares by technique Dirichlet 1850.
I learned here in this email list that I can get all ℤ³ vectors with norml2()==n with:
Q=qflllgram(get_tqf(n))^-1; M=Q~*Q; S=[(Q*v)~|v<-Vec(qfminim(M,n)[3]),qfeval(M,x)==n]Then I looked into "<=" instead of "==" to get all vectors in ℤ³ with norml2()<=n:
S=[(Q*v)~|v<-Vec(qfminim(M,n)[3]),qfeval(M,x)<=n]qfminim() without mapping by Q returns only half of them with one being [0,0,1], and then there are some on z==0, z==-1, ..., here for n=37:
https://stamm-wilbrandt.de/images/tqf_3D.3.gp.n_37.jpgThen after mapping, and colored all vertices with same z<=1 coordinate with same color, to see how they get mapped. Here for n=37:
https://stamm-wilbrandt.de/images/tqf_3D.2.gp.n_37.jpg Interactive: https://stamm-wilbrandt.de/tqf_3D.2.gp.n_37.htmlI am mostly done with demos of my new GP3D repo, only README.md is outdated and will be updated:
https://github.com/Hermann-SW/GP3DAfter syncing you can see the generated JSCAD 3D models when you update tools/view_gzb64 "browser" variable with the browser you use. Then you can do
pi@raspberrypi5:~/GP3D $ n=37 gp -q < tqf_3D.3.gp n=37 pi@raspberrypi5:~/GP3D $ tools/view_gzb64 gp.jscad Opening in existing browser session. pi@raspberrypi5:~/GP3D $ to see model for first image I showed above, or pi@raspberrypi5:~/GP3D $ n=37 gp -q < tqf_3D.2.gp pi@raspberrypi5:~/GP3D $ tools/view_gzb64 gp.jscad Opening in existing browser session. pi@raspberrypi5:~/GP3D $ to see the second screenshot above (and translate/rotate/zoom).As can be seen the horizontal planes returned from qfminim() (in tqf_3d.3.gp) end up with very different slopes after mapping with Q (in tqf_3D.3.gp). But they keep being planes, and one plane (the one with maximal count of vectors) is highlighted with transparent plane !
The tqf_3D.2.gp models show small black sphere where that parallel plane has minimal distance to origin, at vector PO.
Without viewing one can grep for "^PO" and get the minimal distance to origin vectors for different n. n has to be != 0 (mod 4) and != 7 (mod 8):
pi@raspberrypi5:~/GP3D $ for n in 3 5 6 9 10 11 13 14 17 18 19 21 22 25 26 27 29 30
do echo -n "$n: " n=$n gp -q < tqf_3D.2.gp grep ^PO gp.jscad done
3: PO = [-1/9, 2/9, 2/9] 5: PO = [-1/3, 1/3, 1/3] 6: PO = [0, 0, -1] 9: PO = [-1/3, 1/3, -1/3] 10: PO = [-4/9, -8/9, -8/9] 11: PO = [0, 0, -1] 13: PO = [-1/3, -1/3, -1/3] 14: PO = [0, 0, -1] 17: PO = [-1/9, -1/9, -5/9] 18: PO = [0, 0, -1] 19: PO = [-2/33, 8/33, 8/33] 21: PO = [-1/3, -1/3, 1/3] 22: PO = [0, -1/5, 2/5] 25: PO = [-1/3, 1/3, -1/3] 26: PO = [-2/9, 4/9, -4/9] 27: PO = [0, 0, -1] 29: PO = [-1, 1, -1] 30: PO = [0, 0, -1] pi@raspberrypi5:~/GP3D $I want to understand how the normal vectors of the mapped sloped planes are correlated with n. My hope is that this will allow for much faster determination of sum of three squares computation than Dirichlet's 1850 method, and even faster than your
https://pari.math.u-bordeaux.fr/Scripts/foursquares.gpwhich stops being useful when applied to Mersenne primes above M_34 (and I try to determine sum of 4 squares for all Mersenne primes up to M_51).
So the question is, whether someone sees a relation between the computed mapped plane normal vectors above and n?
Regards, Hermann.