kill(all)$

maxima :programming , dot product ,use infix operator,version 1.0
peter.vlasschaert@gmail.com,14/04/2022

function : "°" (aa, bb)
-------------------------

→ check :

properties("°");

infix ("°");

"°" (aa, bb) :=if (aa=e[1] or aa=e[2] or aa=e[3]) and
                         (bb=e[1] or bb=e[2] or bb=e[3]) then 
                         if aa≠bb then 0 else 1$                 

→ check :

properties("°");

declare("°",multiplicative);

→ check :

properties("°");

rem : can't be used for function.
--------------------------------------

grind("°" (aa, bb))$

examples : aa°bb
--------------------

e[1]°e[1];

e[2]°e[1];

e[1]°e[2];

e[3]°e[2];

vector : R, 3-dimensional
------------------------------
cartesian coordinates ,unit vectors:{e[i],i=1,2,3}

declare([x,y,z],constant);

p1:R=x*e[1]+y*e[2]+z*e[3];

p1a:expand(p1°e[1]);

p2:expand((x*e[1]+y*e[2]+z*e[3]).e[1]);

p3:args(p2);

How to use : local option "false".
---------------------------------------

--------------------------------------------------------------

simp;

p3a:block([simp:false],(p1.e[1]));

simp:false, local "option" inside block statement.

simp;

--------------------------------------------------------------

p4:subst(["."="°"],p3);

p4a:ev(p4,nouns);

function: dot product "unit vectors:e[i],i=1,2,3"
-------------------------------------------------------

use: p2

simp;

ex:p2;

load(lrats)$

dot product:sum of terms
-------------------------------

use:"°" (aa, bb) ,   see "above":infix equation .

→ evdot : lhs or rhs of a expression.

build :procedure

evdot[xx]:=block([],  
  s2:args(xx),  /*list of expression*/
  s3:subst(["."="°"],s2),
  s4:makelist(ev(s3[jj],nouns),jj,1,length(s3)),
  s5:sum(s4[j1],j1,1,length(s3)) ,
  s6:subst([e[1]=1,e[2]=1,e[3]=1],s5)/*(e[i])^2 = 1,i=1,2,3*/   
)$

evaluation : nouns,diff,integrate,..............................

grind(evdot);

simp;

→ option :  simp:false or simp:true

p5:evdot[ex]=lhs(p3a);

result : p1, only for x .
--------------------------

p5a:subst([p5],p1);

find :{y,z}
-----------

→ result : find y : R.e[2]

use : p1

p6:expand(p1.e[2]);

p6a:evdot[rhs(p6)]=lhs(p6);

→ result : find z : R.e[3]

p7:expand(p1.e[3]);

p7a:evdot[rhs(p7)]=lhs(p7);

final result :
--------------

-------------------------------------------------

p9:p1;
p9a:[p5,p6a,p7a];
p9b:subst(p9a,p9);

--------------------------------------------------

ratcoef : e1.e3
-----------------

use : ex ,see "above".
------------------------

mm:z*(e[3] . e[1])+y*(e[2] . e[1])+x*e[1]^2;

problem : ratcoef, e[..]

solve problem:

exa:[e[1]=e1,e[2]=e2,e[3]=e3];
exa1:subst(exa,mm);
exa2:ratcoef(exa1,e3.e1);

dot product :use option : commutative.
-----------------------------------------------
why : a.b = b.a ?

ref:https://flex.phys.tohoku.ac.jp/texi/maxima/maxima_6.html#IDX129

q1:e3.e1=e1.e3;

q1a:is(q1);

declare: property, "."

declare(".",commutative);

q2:e3.e1=e1.e3;

q2a:is(q2);

remove : property , "."

remove(".",commutative);

check : commutative.

q3a:is(q1);

syntax : 
======

→ : remove(".",commutative,.......);
→ : ".","°" = operator, rem : "see above: infix"
analog : infix,prefix,postfix,matchfix.............

example : matchfix
-----------------------

matchfix("|","|");

|x|:=abs(x);

|-a|;

without : assume that "a" is "positive",assume(a>0)

other properties : see:ref,"above"
------------------------------------------------------
additive,outative,linear,multiplicative,evenfun
oddfun,commutative,antisymmetric,nary
-------------------------------------------------------
relation : declare & properties.
is : check , "true or false"

remvalue(all);

→ Menu: Maxima

remove : properties from a variable
------------------------------------------

declare(x,constant);

constantp(x);

check :

properties(x);

analog :even(p) ,p = predicate

remove(x,constant);

constantp(x);

check :

properties(x);

--------------------------------------------------------------------