kill(all)$

simple example : book found corrected for the new version Maxima.
===================================================
see : maxima book
ref : maxima.sourceforge.net/docs/maximabook/maximabook-19-Sept-2004.pdf
(=> programming : example from the book)
info : peter.vlasschaert@gmail.com,13/06/2019.

why method construct : new function
1e )  one rule : 'see below'

newdiff1(expr,var):=
if atom(expr) = true then
( if expr = var then 1 else 0) ;

rem : atom  ?  
==========
result : true   => {number,string ,symbol}
result : false => { list,other}

p1a: atom(earth);

a:[1,2,3];

list :

p1b:atom(a);

number:

p1c:atom(a[2]);

number :∞

mathematical symbols :

p1d :atom(∞);

p1e:atom(∂);

p1f:atom(∑);

p1g:atom(⇒);

z:problem +, - ,/,*,^ 

p1ga:atom("+");

error : no result , true or false ;

p1h:atom(+p);

no error when used as prefix, see z

error : p+

test function :new diff

example:

newdiff1(x,y);

rem : dx/dy
==========
x: expression
y : variable

newdiff2  => ?
===================
rules : differentation ,combination ,+  or * between 'two function'³

newdiff2(expr,var):=
if atom(expr) = true then
( if expr = var then 1 else 0) 
else if part(expr,0) = "+"  then  
        'diff(part(expr,1),var) + 'diff(part(expr,2),var)
else 
       'diff(expr,var)
;

p2:part(u+v,0);

newdiff2 : two rules 
1e)  first rule       :  'p2c,p2d'
2e)  second rule :  'p2a'

p2a:newdiff2(u+v,x);

p2b:newdiff2(u*v,x);

p2c:newdiff2(y,x);

p2d:newdiff2(y,y);

newdiff3(expr,var):=
if atom(expr) = true then
( if expr = var then 1 else 0) 
else if part(expr,0) = "+"  then  
        'diff(part(expr,1),var) + 'diff(part(expr,2),var)
else if part(expr,0) = "*"  then  
part(expr,2)* 'diff(part(expr,1),var)
+ part(expr,1)* 'diff(part(expr,2),var)
else 
       'diff(expr,var);

newdiff2 : two rules 
1e)  first rule       :  
2e)  second rule :  
3e)  thrid rule      : 'p3'

p3:newdiff3(x*y,v);

rem : solved by implementing extra rule.

p3a:newdiff3(x/y,v);

problem : pg 67 from the book , new version works,'peter.vlasschaert@gmail.com.