kill(all)$

maxima : use packages (unit,lrats),version 1.0
peter.vlasschaert@gmail.com,21/08/2021

load(lrats)$ratprint:false$

load (unit)$

  [a, c, d] : [1* m, 2* m, 3 * m];
  p1:solve([A = a * b, b = c * d], [A, b]);
  p1a:flatten(p1);

p1a:ev(p1a,nouns);

→ need special values 

declare_index_properties(A,[postsubscript,postsuperscript,presubscript,presuperscript])$
p1b:A[a,b,c,d];

→ subst,ratsubst : 'doesn't work'

p1c:lratsubst(p1a,p1b);

use :lratsubst , 'load(lrats)'

p1d:s1=a+c+d;

definition :force = kg*m/s^2
mass             = mm = 10kg
acceleration = aa    = 9.81m/s^2

gravitation
========

p2:Force = mm*aa;

p2a:aa  =10*kg;
p2b:mm=9.81*m/s^2;

p2c:[p2a,p2b];

p2d:subst(p2c,p2);

rem : *100 for rhs(p2d)

p2d1:lhs(p2d)=convert(rhs(p2d),[kg,cm,s]);

rem:*1000 for p2d1

p2d2:lhs(p2d)=convert(rhs(p2d),[g,cm,s]);

→ how find :unit & value

p2d11:ratcoeff(rhs(p2d),(kg*m)/s^2);

p2d1a:rhs(p2d/p2d11);

→ dimension : force

dimension(rhs(p2d));

usedimension(N);/*clue what to do*/

cd;

setunits([m,kg,s,A,K,mol,cd]);

→ Fundamental units

dimension([m,kg,s,A,K,mol,cd]);

→ general units

p3:[N,Pa,J,W,C,V,F,Ω,T,H,lm,lx];

→ stange:output

p3a:dimension(p3);

p3b:dimension(N);

p3b1:dimension(Pa);

→  corrected 'version'  of strange output above.

p3b2:makelist(dimension(p3[i]),i,1,length(p3));

p3b3:makelist(dontusedimension(p3[i]),i,1,length(p3));

J = Joule            (=energy)=(N*m)

p3b3a:dontusedimension(J);

W= Watt = J/s (=power) = (N*m)/s

p3b3b:dontusedimension(W);

physical quantities :
===============

example :[viscosity ,kinematic viscosity]

p4:[dimension(Pa*s),dimension(m^2/s)];

p4a:args(p4[1]);

or

p4b:[num(p4[1]),denom(p4[1])];

kill(usersetunits)

physical constant : Maxima
-------------------------------------

Einstein  equation ( E=m*c^2=[Joule])
==============================

load("physconst")$

→ velocity of light

float((%%c));

→ E=m*c^2;

einst(mm):= mm*((%%c))^2*J;

einst(1);

ev(%,float);

x1:einst1(mm):=mm*kg*((float(%%c))*m/s)^2;

einst1(1);

x2:dimension(einst1(1));

einst2(mm):=block([],
s1:einst1(mm),
s2:return(dimension(s1))    
);

einst2(1);

check:value: x2

is(x2=einst2(1));

rem :planck constant:h ' plack relation '  E=h*υ  = [kg*m^2/s]*[1/s];
υ =frequency

s2:float(%%h);

planck constant:

s22:float(part(s2,1)),numer;

q=i*t = A*s= charge paticle:electron (proton)
==================================
reason :atom =electroneutral

s2a:float(%%e),numer;

part(s2a,1);

part(s2a,2);

packages : load(unit)
=================

problem :setunits(p3 )

→ error

Input is not a unit.  To define your own unit, use the addunit command.
#0: isunit(candidate=Ω) (unit.mac line 396)
#1: isbase(unit=Ω) (unit.mac line 408)
#2: setunits(units=[N,Pa,J,W,C,V,F,Ω,T,H,lm,lx]) (unit.mac line 608)
 -- an error. To debug this try: debugmode(true);

/*  Not yet implemented

/* Prints out information about a unit */
unitinfo(unit):= block([letrat:true,result,dimension],

/*  Allows the user to create their own units */
addunits([[unitname(s)],definition,0]):=
*/

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

rem :temperature conversion : see ezunits