kill(all)$

appendix :chemical components : sum  ,version 1.0
peter.vlasschaert@gmail.com,13/02/2021

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

load(lrats)$ratprint:false$ load(stringproc)$

p1:sconcat(Na,ascii(32),O,ascii(32),H);

p1a:charlist(p1);

chemical element 
1e)  one element symbol  : {O,H}.
2e)  two element symbol  :  {Na }.

p2:sconcat(H,ascii(32),S,ascii(32),O,ascii(32));

p3:sconcat(Na,ascii(32),S,ascii(32),O,ascii(32));

p4:sconcat(H,ascii(32),O);

p5:sconcat(p1,"+",p2);

p6:sconcat(ascii(32),ascii(32),ascii(32),1,ascii(32),ascii(32),1,ascii(32),ascii(32),1,
    ascii(32),ascii(32),ascii(32),ascii(32),2,ascii(32),ascii(32),1,ascii(32),ascii(32),4);

between two molecule  : "+" →  ascii(32),ascii(32),ascii(32),ascii(32).
=====================================================
no difference with result : sconcat 'or' concat
=====================================================
chemical element :
-------------------------
1e)  one element symbol  : {O,H}. → ascii(32),ascii(32)
2e)  two element symbol  :  {Na }. → ascii(32),ascii(32),ascii(32)
=====================================================

p7a:p5;
p7b:p6;

p8:stringp(p6);

To remove : "1" with  ascii(32)

p9:ssubst(ascii(32),"1",p6);

final result 
--------------

p10a:p7a;
p10b:p9;

p11:[ascii(32),ascii(32),ascii(32),1,ascii(32),ascii(32),1,ascii(32),ascii(32),1,
    ascii(32),ascii(32),ascii(32),ascii(32),2,ascii(32),ascii(32),1,ascii(32),ascii(32),4];

convert :list → string :  ( use :simplode)

p11a:simplode(p11);

p11b:stringp(p11a);

p12a:p7a;
p12b:p11a;

p13a:p7a;
p13b:ssubst(ascii(32),"1",p11a);

convert first line: chemical equation
===========================
use :p1,p2

p14a:[Na,ascii(32),O,ascii(32),H];
p14b:simplode(p14a);

p15a:[H,ascii(32),S,ascii(32),O];
p15b:simplode(p15a);

p16:[p14a,"+",p15a];

p16a:flatten(p16);

p16b:simplode(p16a);

final result :

p17a:p16b;
p17b:p12b;

p18a:p16b;
p18b:ssubst(ascii(32),"1",p17b);

use : disp 'maxima'

p19:disp(p18a,p18b)+disp(p18a,p18b)$

stringp(disp(p18a,p18b));