Question: Proc. Tabulate return results but keep access to assigned name(s) for results.

I am trying to tidy up cases where a proc returns multiple values. Have being trying Tabulate. I can get it to work when called after the results are returned. I would the procedure to do this but  keep acces to the name(s) assigned to the returned values.

A,B,C:= proc(...)  .....  return a, b, c    end proc. 

So basically display a tabulated of a, b, c.
 

restart

 

QQFProj := proc(q12::algebraic, q23::algebraic, q34::algebraic, q14::algebraic,{columns:=[QQFproj,Q13proj,Q24proj]},prnt::boolean:=true)
description "Projective quadruple quad formula and intermediate 13 and 24 quads. Useful for cyclic quadrilaterals";
local qqf,q13,q24, sub1,sub2,sub3, R;
#uses  DT = DocumentTools;
sub1:= (q12 + q23 + q34 + q14)^2 - 2*(q12^2 + q23^2 + q34^2 + q14^2) ;
sub2:=-4*(q12*q23*q34+q12*q23*q14+q12*q34*q14+q23*q34*q14)+8*q12*q23*q34*q14;
sub3:=64*q12*q23*q34*q14*(1-q12)*(1-q23)*(1-q34)*(1-q14);
qqf:=(sub1+sub2)^2=sub3;
q13:=((q12-q23)^2-(q34-q14)^2)/(2*(q12+q23-q34-q14-2*q12*q23+2*q34*q14));#check this
q24:=((q23-q34)^2-(q12-q14)^2)/(2*(q23+q34-q12-q14-2*q23*q34+2*q12*q14));#check this
#if prnt then
#return [columns,[qqf,q13,q24]];


if prnt then
print(cat(" ",columns[1],"    ",columns[2],"     ",columns[3])) ;
end if;
return qqf ,q13,q24


 end proc:

q12:=1/2:q23:=9/10:q34:=25/26:q41:=9/130: #Cyclic quadrilateral
 AA:=QQFProj(q12,q23,q34,q41,true);


AA[1];
AA[2];
AA[3]

" QQFproj    Q13proj     Q24proj"

 

9801/2856100 = 9801/2856100, 4/5, 16/65

 

9801/2856100 = 9801/2856100

 

4/5

 

16/65

(1)

# Can the below be built into the proc to nicely didplay the results but maintain access to the results as shown when prnt=true.

columns:=[QQFproj,Q13proj,Q24proj]:
BB:=QQFProj(q12,q23,q34,q41,false):
DocumentTools:-Tabulate([columns,[BB]],width=55):#could do with a variable width depending on length of output epression.

BB[1];
BB[2];
BB[3]

9801/2856100 = 9801/2856100

 

4/5

 

16/65

(2)

dspformat:=(BB,columns)->DocumentTools:-Tabulate([columns,[BB]],width=75);

proc (BB, columns) options operator, arrow; DocumentTools:-Tabulate([columns, [BB]], width = 75) end proc

(3)

CC:=dspformat(BB,columns):#layout not as expected

CC[1] ; #  just gives  letters from Tabulate

"T"

(4)

 


 

Download 2024-03-18_Q_Format_Returned_Results_into_a_Table..mw

This has been branched into the following page(s):
Please Wait...