kill(all)$

maxima : intro to residue curve ( = ternary plot),version 1.0,part 4
peter.vlasschaert@gmail.com,27/09/2020

ref : Consult , Denis Constales (=DC), Prof UGent*
ref : maple file, see website.
-------------------------------------------------------------------------------------------------------------------------
===================================================================
ref1:https://stackoverflow.com/questions/15706857/multiple-plots-in-maxima
ref2:https://themaximalist.org/2017/04/19/multiple-plots-in-a-single-maxima-figure/
===================================================================
---------------------------------------------------------------------------------------------------------------------------
new: 24/09/2020:maxima : appendix how to draw line on the canvas,version 1.0
download  (Maxima,code)  :maximahowtodrawlineonthecanvaswxplot2dversion1final
download  (Maxima,png  )  :maximahowtodrawlineonthecanvaswxplot2dversion1finaloutp
---------------------------------------------------------------------------------------------------------------------------

load packages,option 
=================

load(lrats)$ ratprint:false$

 scaling ,parametric equation of a general line 
===================================

1e) scaling.
----------------

f:sqrt(3)/20;/* scaling factor,*/

/* f:1; remove them */

a) equilateral triangle: " f = sqrt(3)/20 ", nl :gelijkzijdig driehoek, angle 'hoek = 60° '
b) isosceles triangle : "  f = 1",                nl :gelijkbenig driehoek, height = h = 1

2e) parametric line.
----------------------------

lp(a_,b_):=a_*t+b_*(1-t);

ternary plot :
=========

horizontal:lines
===========
space : between lines = k  "  = y values"

s1x:[(k/sqrt(3))*f,((20-k)/sqrt(3))*f];
s1y:k*f;          /* y values are fixed values */

s1:[k/sqrt(3)*t+(20-k)/sqrt(3)*(1-t),k];

p1:makelist(makelist
  ([ev(lp(s1x[1],s1x[2]),nouns),ev(s1y,nouns)],
   t,0,1,0.1),k,0,11)$

rem : maple ' k =0 to 10'  → Maxima ' k = 0 to 11 ', see : maple file,(DC).

→  first :horizontal line

p1[1];

→ second : horizontale line

p1[2];

→ last: horizontale line , reduced to point, 'see coordinates'

p1[11];

p:[]$
 /* q:[[0,0],[3,5]]$ */
for i:1 thru 11 do(
p:endcons([discrete,p1[i]],p)
)$
/*p:endcons([discrete,q],p)$*/

wxplot2d(p,[color,blue],[legend,false],same_xy);

→  hypotenuse (1), "hypotenusa", line. (rico = +)
==============

s2x:[((k+10)/sqrt(3))*f,((2*k)/sqrt(3))*f];
s2y:[(10-k)*f,0*f];

p2:makelist(makelist
  ([ev(lp(s2x[1],s2x[2]),nouns),ev(lp(s2y[1],s2y[2]),nouns)],
   t,0,1,0.1),k,0,11)$

pp:[]$

for i:1 thru 11 do(
pp:endcons([discrete,p1[i]],pp),
pp:endcons([discrete,p2[i]],pp)    
)$

wxplot2d(pp,[color,blue],[legend,false],same_xy);

→  hypotenuse (2), "hypotenusa",line.(rico = -)
==============

s3x:[((k)/sqrt(3))*f,((2*k)/sqrt(3))*f];
s3y:[k*f,0*f];

p3:makelist(makelist
  ([ev(lp(s3x[1],s3x[2]),nouns),ev(lp(s3y[1],s3y[2]),nouns)],
   t,0,1,0.1),k,0,11)$

ppp:[]$

for i:1 thru 11 do(
ppp:endcons([discrete,p1[i]],ppp),
ppp:endcons([discrete,p2[i]],ppp),
ppp:endcons([discrete,p3[i]],ppp)        
)$

wxplot2d(ppp,[color,blue],[legend,false],same_xy);

rem :wx before plot2d : plot of the figure is inside the document.

maple  code : DC 
==============
-------------------------------------------------------------------------------------------------------------------------
f := sqrt(3)/20;
af := 1;
plot([seq([f*(k*t/sqrt(3) + (20 - k)*(1 - t)/sqrt(3)), f*k, t = 0 .. 1], k = 0 .. 10),
 seq([f*((k + 10)*t/sqrt(3) + 2*k*(1 - t)/sqrt(3)), f*((10 - k)*t + 0*(1 - t)), t = 0 .. 1], k = 0 .. 10),
 seq([f*(k*t/sqrt(3) + 2*k*(1 - t)/sqrt(3)), f*k*t, t = 0 .. 1], k = 0 .. 10)], scaling = constrained);
--------------------------------------------------------------------------------------------------------------------------