Bill Allombert on Fri, 08 Dec 2023 17:44:01 +0100


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: norml2() with variables in vector?


On Fri, Dec 08, 2023 at 01:22:57AM +0100, hermann@stamm-wilbrandt.de wrote:
> On 2023-12-07 23:42, Bill Allombert wrote:
> > 
> > You can use qfsolve by adding a variable (always the same trick).
> > 
> > v=[-102, -107, 93; 22, 23, -20; 1, 1, -1]^-1
> ...
> > Or if you want all the solutions:
> > 
> > ? M=v~*v;[x|x<-Vec(qfminim(M,101)[3]),qfeval(M,x)==101]
> > %18 =
> > 
> [[823,-177,-9]~,[828,-178,-9]~,[1032,-222,-11]~,[1037,-223,-11]~,[205,-44,-3]~,[613,-132,-7]~,[215,-46,-3]~,[1031,-222,-11]~,[643,-138,-7]~,[1459,-314,-15]~,[1061,-228,-11]~,[1469,-316,-15]~,[0,0,1]~,[204,-44,-3]~,[25,-5,-1]~,[1249,-269,-13]~,[239,-51,-3]~,[1463,-315,-15]~,[1284,-276,-13]~,[1488,-320,-15]~,[399,-86,-3]~,[417,-90,-5]~,[389,-84,-3]~,[835,-180,-9]~,[467,-100,-5]~,[1691,-364,-17]~,[885,-190,-9]~,[1701,-366,-17]~,[400,-86,-3]~,[196,-42,-1]~,[599,-129,-5]~,[217,-47,-3]~,[584,-126,-5]~,[844,-182,-9]~,[365,-79,-3]~,[1267,-273,-13]~,[151,-33,-1]~,[1481,-319,-15]~,[272,-58,-3]~,[1700,-366,-17]~,[899,-193,-9]~,[1715,-369,-17]~,[1312,-282,-13]~,[1516,-326,-15]~,[795,-171,-7]~,[387,-83,-3]~,[989,-213,-9]~,[235,-51,-3]~,[984,-212,-9]~,[444,-96,-5]~,[760,-164,-7]~,[1076,-232,-11]~,[332,-72,-3]~,[1504,-324,-15]~,[300,-64,-3]~,[1728,-372,-17]~,[509,-109,-5]~,[1733,-373,-17]~,[1131,-243,-11]~,[1539,-331,-15]~,[1185,-255,-11]~,[369,-79,-3]~,[1160,-250,-11]~,[676,-146,-7]~,[304,-66,-3]~
> ,[1532,-330,-15]~,[741,-159,-7]~,[1557,-335,-15]~,[977,-210,-9]~,[1375,-296,-13]~,[151,-32,-1]~,[1365,-294,-13]~,[267,-58,-3]~,[927,-200,-9]~,[1113,-240,-11]~,[81,-18,-1]~,[1551,-334,-15]~,[337,-72,-3]~,[1561,-336,-15]~,[1163,-250,-11]~,[1172,-252,-11]~,[968,-208,-9]~,[1127,-243,-11]~,[913,-197,-9]~]
> > 
> Thank you, I want all solutions.
> 
> My previous posting showed the 168 solutions I got from Mathematica

Ah yes, qfminim only return the solution with positive first coordinates.
If you want the others, just negate the result:
M=v~*v;S=[x|x<-Vec(qfminim(M,101)[3]),qfeval(M,x)==101];
concat(S,-S)

Cheers,
Bill.