login  home  contents  what's new  discussion  bug reports     help  links  subscribe  changes  refresh  edit

spad
)abbrev category PUNIT PhysicalUnit
PhysicalUnit() : Category == with   
    "*"  : (%,%) -> %
    "/"  : (%,%) -> %
    "^"  : (%,Integer) -> %
    "="  : (%,%) -> Boolean
    dim  : % -> List Integer
    one  : %
    coerce : % -> OutputForm
)abbrev domain PUSYS PhysicalUnitSystem PhysicalUnitSystem(u:List Symbol) : Exports == Implementation where BASU ==> OrderedVariableList(u) FAGB ==> FreeModule(Integer,BASU) Exports == Join(PhysicalUnit,CoercibleTo OutputForm) with baseSymbols : List Symbol baseUnits : List % factors : % -> List Record(gen: BASU,exp: Integer) Implementation == FreeGroup(BASU) add Rep:=FreeModule(Integer,BASU) x * y == x+y x / y == x-y x ^ n == n*x one() == 0$Rep baseSymbols() == [convert(x)@Symbol for x in enumerate$BASU] baseUnits() == [x::% for x in enumerate$BASU] dim(x) == [coefficient(x,b) for b in enumerate$BASU] x = y == test(dim x = dim y)
)abbrev domain PQTY PhysQty PhysQty(U:PhysicalUnit): Exports == Implementation where
Q ==> Fraction(Integer) F ==> Float R ==> DoubleFloat I ==> Integer OF ==> OutputForm PI ==> PositiveInteger IVF ==> Interval Float
Exports == Join(CoercibleTo OutputForm) with _* : (%,%) -> % _/ : (%,%) -> % _+ : (%,%) -> % _- : (%,%) -> % _^ : (%,Integer) -> % _- : % -> %
_* : (Union(F,R,I,Q,PI),%) -> % _/ : (%,Union(F,R,I,Q,PI)) -> %
ival : % -> IVF unit : % -> U
magnitude : % -> F uncertainty : % -> F
elt : (IVF,U) -> % elt : (F,U) -> %
setOutputMode : PI -> PI coerce : % -> OutputForm
Implementation == add
Rep := Record(ival:IVF, unit:U)
outputMode:PI:=2
x:% * y:% == [x.ival * y.ival, x.unit * y.unit]$Rep x:% / y:% == r:Union(IVF,"failed"):=recip(y.ival) r case IVF => [x.ival * r, x.unit / y.unit]$Rep error "failed" x + y == x.unit=y.unit => [x.ival + y.ival, x.unit]$Rep error "failed" x - y == x.unit=y.unit => [x.ival - y.ival, x.unit]$Rep error "failed" x ^ n == n > 0 => [x.ival^n::PI, x.unit^n::PI]$Rep n = 0 => [interval(1.0,1.0)$IVF, one()]$Rep r:Union(IVF,"failed"):=recip(x.ival) m:PI:=(-n)::PI r case IVF => [r^m, x.unit^n]$Rep error "failed"
- x == [-x.ival, x.unit]$Rep
r:Union(F,R,I,Q,PI) * x:% == r case I or r case PI => [r*x.ival, x.unit]$Rep mkrep(r) ==> [interval(r)$IVF * x.ival, x.unit]$Rep r case Q or r case F => mkrep r r case R => mkrep convert(r)$F
x:% / r:Union(F,R,I,Q,PI) == s:%:=r*[interval(1.0)$IVF, one()]$Rep x/s
ival x == x.ival unit x == x.unit
magnitude x == (sup(x.ival)+inf(x.ival))/2.0 uncertainty x == (sup(x.ival)-inf(x.ival))/2.0
elt(v:IVF,u:U):% == [v,u]$Rep elt(v:F,u:U):% == [interval(v)$IVF,u]$Rep
setOutputMode(s:PI):PI == modes:List PI:= [1,2,3] if member?(s,modes) then outputMode := s return s error "1: plusMinus, 2: single, 3: interval"
coerce(x) == pm:Character:=char(177) pmof:=pm::String::Symbol::OF val:Float:=(sup(x.ival)+inf(x.ival))/2 err:Float:=sup(x.ival)-val outputMode=1 => blankSeparate [val::OF,pmof,err::OF,x.unit::OF] outputMode=2 => blankSeparate [val::OF,x.unit::OF] outputMode=3 => blankSeparate [x.ival::OF,x.unit::OF]
)abbrev domain SI SIunit SIunit : Exports == Implementation where
Exports == Join(SetCategory,PhysicalUnit) with
unitSystem : () -> Type baseUnits : () -> List %
%m : Integer -> % %kg : Integer -> % %s : Integer -> % %A : Integer -> % %K : Integer -> % %mol : Integer -> % %cd : Integer -> %
metre : % kilogram : % second : % ampere : % kelvin : % mole : % candela : %
hertz : % newton : % pascal : % joule : % watt : % coulomb : % volt : % farad : % ohm : % siemens : % weber : % tesla : % henry : % lumen : % lux : % becquerel : % gray : % sievert : % katal : %
Implementation == PhysicalUnitSystem(['m,'kg,'s,'A,'K,'mol,'cd]) add
USY:=['m,'kg,'s,'A,'K,'mol,'cd] Rep:=PhysicalUnitSystem(USY)
unitSystem() == %
u:=baseUnits()$Rep baseUnits() == u
%m(n) == u.1^n %kg(n) == u.2^n %s(n) == u.3^n %A(n) == u.4^n %K(n) == u.5^n %mol(n) == u.6^n %cd(n) == u.7^n
metre == %m(1) kilogram == %kg(1) second == %s(1) ampere == %A(1) kelvin == %K(1) mole == %mol(1) candela == %cd(1)
hertz == %s(-1) newton == %kg(1)*%m(1)*%s(-2) pascal == %kg(1)*%m(-1)*%s(-2) joule == %kg(1)*%m(2)*%s(-2) watt == %kg(1)*%m(2)*%s(-3) coulomb == %s(1)*%A(1) volt == %kg(1)*%m(2)*%s(-3)*%A(-1) farad == %kg(-1)*%m(-2)*%s(4)*%A(2) ohm == %kg(1)*%m(2)*%s(-3)*%A(2) siemens == %kg(-1)*%m(-2)*%s(3)*%A(2) weber == %kg(1)*%m(2)*%s(-2)*%A(-1) tesla == %kg(1)*%s(-2)*%A(-1) henry == %kg(1)*%m(2)*%s(-2)*%A(-2) lumen == %cd(1) lux == %m(-2)*%cd(1) becquerel == %s(-1) gray == %m(2)*%s(-2) sievert == %m(2)*%s(-2) katal == %s(-1)*%mol(1)
)abbrev package DIMAN DimensionalAnalysis DimensionalAnalysis(P:PhysicalUnit) : Exports == Implementation where
Exports == with
buckingham : Table(Symbol,P) -> List(Expression(Integer))
Implementation == P add
mkxpr(s:List Symbol,v:Vector Integer):Expression Integer == r:Expression Integer:=1 for j in 1..#s repeat r:=r*(s.j)::Expression(Integer)^(v.j) r
buckingham(t) == --[1::Expression Integer] M:Matrix(Integer):=matrix [dim(t.x) for x in keys(t)] ns:List Vector Integer:=nullSpace transpose(M) r:List Expression Integer:=[] for j in 1..#ns repeat r:=append(r,[mkxpr(keys(t),ns.j)]) r
spad
   Compiling FriCAS source code from file 
      /var/lib/zope2.10/instance/axiom-wiki/var/LatexWiki/4318783589297783802-25px001.spad
      using old system compiler.
   PUNIT abbreviates category PhysicalUnit 
------------------------------------------------------------------------
   initializing NRLIB PUNIT for PhysicalUnit 
   compiling into NRLIB PUNIT 
;;; *** |PhysicalUnit| REDEFINED Time: 0 SEC.
finalizing NRLIB PUNIT Processing PhysicalUnit for Browser database: --->-->PhysicalUnit(constructor): Not documented!!!! --->-->PhysicalUnit((* (% % %))): Not documented!!!! --->-->PhysicalUnit((/ (% % %))): Not documented!!!! --->-->PhysicalUnit((^ (% % (Integer)))): Not documented!!!! --->-->PhysicalUnit((= ((Boolean) % %))): Not documented!!!! --->-->PhysicalUnit((dim ((List (Integer)) %))): Not documented!!!! --->-->PhysicalUnit((one (%) constant)): Not documented!!!! --->-->PhysicalUnit((coerce ((OutputForm) %))): Not documented!!!! --->-->PhysicalUnit(): Missing Description ; compiling file "/var/aw/var/LatexWiki/PUNIT.NRLIB/PUNIT.lsp" (written 04 APR 2022 08:21:19 PM):
; /var/aw/var/LatexWiki/PUNIT.NRLIB/PUNIT.fasl written ; compilation finished in 0:00:00.003 ------------------------------------------------------------------------ PhysicalUnit is now explicitly exposed in frame initial PhysicalUnit will be automatically loaded when needed from /var/aw/var/LatexWiki/PUNIT.NRLIB/PUNIT
PUSYS abbreviates domain PhysicalUnitSystem ------------------------------------------------------------------------ initializing NRLIB PUSYS for PhysicalUnitSystem compiling into NRLIB PUSYS compiling exported * : ($,$) -> $ Time: 0.02 SEC.
compiling exported / : ($,$) -> $ Time: 0.01 SEC.
compiling exported ^ : ($,Integer) -> $ Time: 0 SEC.
compiling exported one : () -> $ Time: 0 SEC.
compiling exported baseSymbols : () -> List Symbol Time: 0 SEC.
compiling exported baseUnits : () -> List $ Time: 0 SEC.
compiling exported dim : $ -> List Integer Time: 0 SEC.
compiling exported = : ($,$) -> Boolean Time: 0.01 SEC.
(time taken in buildFunctor: 0)
;;; *** |PhysicalUnitSystem| REDEFINED
;;; *** |PhysicalUnitSystem| REDEFINED Time: 0.01 SEC.
Cumulative Statistics for Constructor PhysicalUnitSystem Time: 0.05 seconds
--------------non extending category---------------------- .. PhysicalUnitSystem(#1) of cat (|Join| (|PhysicalUnit|) (|CoercibleTo| (|OutputForm|)) (CATEGORY |domain| (SIGNATURE |baseSymbols| ((|List| (|Symbol|))) |constant|) (SIGNATURE |baseUnits| ((|List| $)) |constant|) (SIGNATURE |factors| ((|List| (|Record| (|:| |gen| (|OrderedVariableList| |#1|)) (|:| |exp| (|Integer|)))) $)))) has no (|Group|) finalizing NRLIB PUSYS Processing PhysicalUnitSystem for Browser database: --->-->PhysicalUnitSystem(constructor): Not documented!!!! --->-->PhysicalUnitSystem((baseSymbols ((List (Symbol))) constant)): Not documented!!!! --->-->PhysicalUnitSystem((baseUnits ((List %)) constant)): Not documented!!!! --->-->PhysicalUnitSystem((factors ((List (Record (: gen (OrderedVariableList u)) (: exp (Integer)))) %))): Not documented!!!! --->-->PhysicalUnitSystem(): Missing Description ; compiling file "/var/aw/var/LatexWiki/PUSYS.NRLIB/PUSYS.lsp" (written 04 APR 2022 08:21:19 PM):
; /var/aw/var/LatexWiki/PUSYS.NRLIB/PUSYS.fasl written ; compilation finished in 0:00:00.022 ------------------------------------------------------------------------ PhysicalUnitSystem is now explicitly exposed in frame initial PhysicalUnitSystem will be automatically loaded when needed from /var/aw/var/LatexWiki/PUSYS.NRLIB/PUSYS
PQTY abbreviates domain PhysQty ------------------------------------------------------------------------ initializing NRLIB PQTY for PhysQty compiling into NRLIB PQTY Local variable Rep type redefined: (Join (SetCategory) (CATEGORY domain (SIGNATURE construct ((Record (: ival (Interval (Float))) (: unit U)) (Interval (Float)) U)) (SIGNATURE ~= ((Boolean) (Record (: ival (Interval (Float))) (: unit U)) (Record (: ival (Interval (Float))) (: unit U)))) (SIGNATURE coerce ((OutputForm) (Record (: ival (Interval (Float))) (: unit U)))) (SIGNATURE elt ((Interval (Float)) (Record (: ival (Interval (Float))) (: unit U)) ival)) (SIGNATURE elt (U (Record (: ival (Interval (Float))) (: unit U)) unit)) (SIGNATURE setelt! ((Interval (Float)) (Record (: ival (Interval (Float))) (: unit U)) ival (Interval (Float)))) (SIGNATURE setelt! (U (Record (: ival (Interval (Float))) (: unit U)) unit U)) (SIGNATURE copy ((Record (: ival (Interval (Float))) (: unit U)) (Record (: ival (Interval (Float))) (: unit U)))))) to (Join (BiModule (Integer) (Integer)) (FreeModuleCategory (Integer) (OrderedVariableList u)) (CATEGORY domain (IF (has (Integer) (CommutativeRing)) (ATTRIBUTE (Module (Integer))) noBranch) (IF (has (Integer) (SemiRing)) (ATTRIBUTE (RetractableTo (OrderedVariableList u))) noBranch) (IF (has (OrderedVariableList u) (OrderedSet)) (PROGN (IF (has (Integer) (OrderedAbelianMonoid)) (ATTRIBUTE (OrderedAbelianMonoid)) noBranch) (IF (has (Integer) (OrderedAbelianMonoidSup)) (ATTRIBUTE (OrderedAbelianMonoidSup)) noBranch)) noBranch) (SIGNATURE * ($ (Integer) (OrderedVariableList u))) (SIGNATURE * ($ (OrderedVariableList u) (Integer))))) compiling exported * : ($,$) -> $ Time: 0.01 SEC.
compiling exported / : ($,$) -> $ Time: 0 SEC.
compiling exported + : ($,$) -> $ Time: 0 SEC.
compiling exported - : ($,$) -> $ Time: 0 SEC.
compiling exported ^ : ($,Integer) -> $ Time: 0.01 SEC.
compiling exported - : $ -> $ Time: 0 SEC.
compiling exported * : (Union(Float,DoubleFloat,Integer,Fraction Integer,PositiveInteger),$) -> $ processing macro definition mkrep r ==> (Sel Rep construct)(*((Sel (Interval (Float)) interval) r,x ival),x unit) Time: 0.01 SEC.
compiling exported / : ($,Union(Float,DoubleFloat,Integer,Fraction Integer,PositiveInteger)) -> $ Time: 0 SEC.
compiling exported ival : $ -> Interval Float PQTY;ival;$I;9 is replaced by QCAR Time: 0 SEC.
compiling exported unit : $ -> U PQTY;unit;$U;10 is replaced by QCDR Time: 0 SEC.
compiling exported magnitude : $ -> Float Time: 0.01 SEC.
compiling exported uncertainty : $ -> Float Time: 0 SEC.
compiling exported elt : (Interval Float,U) -> $ PQTY;elt;IU$;13 is replaced by CONS Time: 0 SEC.
compiling exported elt : (Float,U) -> $ Time: 0 SEC.
compiling exported setOutputMode : PositiveInteger -> PositiveInteger Time: 0.01 SEC.
compiling exported coerce : $ -> OutputForm Time: 0.01 SEC.
(time taken in buildFunctor: 0)
;;; *** |PhysQty| REDEFINED
;;; *** |PhysQty| REDEFINED Time: 0 SEC.
Cumulative Statistics for Constructor PhysQty Time: 0.06 seconds
finalizing NRLIB PQTY Processing PhysQty for Browser database: --->-->PhysQty(constructor): Not documented!!!! --->-->PhysQty((* (% % %))): Not documented!!!! --->-->PhysQty((/ (% % %))): Not documented!!!! --->-->PhysQty((+ (% % %))): Not documented!!!! --->-->PhysQty((- (% % %))): Not documented!!!! --->-->PhysQty((^ (% % (Integer)))): Not documented!!!! --->-->PhysQty((- (% %))): Not documented!!!! --->-->PhysQty((* (% (Union (Float) (DoubleFloat) (Integer) (Fraction (Integer)) (PositiveInteger)) %))): Not documented!!!! --->-->PhysQty((/ (% % (Union (Float) (DoubleFloat) (Integer) (Fraction (Integer)) (PositiveInteger))))): Not documented!!!! --->-->PhysQty((ival ((Interval (Float)) %))): Not documented!!!! --->-->PhysQty((unit (U %))): Not documented!!!! --->-->PhysQty((magnitude ((Float) %))): Not documented!!!! --->-->PhysQty((uncertainty ((Float) %))): Not documented!!!! --->-->PhysQty((elt (% (Interval (Float)) U))): Not documented!!!! --->-->PhysQty((elt (% (Float) U))): Not documented!!!! --->-->PhysQty((setOutputMode ((PositiveInteger) (PositiveInteger)))): Not documented!!!! --->-->PhysQty((coerce ((OutputForm) %))): Not documented!!!! --->-->PhysQty(): Missing Description ; compiling file "/var/aw/var/LatexWiki/PQTY.NRLIB/PQTY.lsp" (written 04 APR 2022 08:21:19 PM):
; /var/aw/var/LatexWiki/PQTY.NRLIB/PQTY.fasl written ; compilation finished in 0:00:00.058 ------------------------------------------------------------------------ PhysQty is now explicitly exposed in frame initial PhysQty will be automatically loaded when needed from /var/aw/var/LatexWiki/PQTY.NRLIB/PQTY
SI abbreviates domain SIunit ------------------------------------------------------------------------ initializing NRLIB SI for SIunit compiling into NRLIB SI Local variable Rep type redefined: (Join (PhysicalUnit) (CoercibleTo (OutputForm)) (CATEGORY domain (SIGNATURE baseSymbols ((List (Symbol))) constant) (SIGNATURE baseUnits ((List $)) constant) (SIGNATURE factors ((List (Record (: gen (OrderedVariableList USY)) (: exp (Integer)))) $)))) to (Join (SetCategory) (CATEGORY domain (SIGNATURE construct ((Record (: ival (Interval (Float))) (: unit U)) (Interval (Float)) U)) (SIGNATURE ~= ((Boolean) (Record (: ival (Interval (Float))) (: unit U)) (Record (: ival (Interval (Float))) (: unit U)))) (SIGNATURE coerce ((OutputForm) (Record (: ival (Interval (Float))) (: unit U)))) (SIGNATURE elt ((Interval (Float)) (Record (: ival (Interval (Float))) (: unit U)) ival)) (SIGNATURE elt (U (Record (: ival (Interval (Float))) (: unit U)) unit)) (SIGNATURE setelt! ((Interval (Float)) (Record (: ival (Interval (Float))) (: unit U)) ival (Interval (Float)))) (SIGNATURE setelt! (U (Record (: ival (Interval (Float))) (: unit U)) unit U)) (SIGNATURE copy ((Record (: ival (Interval (Float))) (: unit U)) (Record (: ival (Interval (Float))) (: unit U)))))) compiling exported unitSystem : () -> Type Time: 0 SEC.
compiling exported baseUnits : () -> List $ Time: 0 SEC.
compiling exported %m : Integer -> $ Time: 0.01 SEC.
compiling exported %kg : Integer -> $ Time: 0.01 SEC.
compiling exported %s : Integer -> $ Time: 0 SEC.
compiling exported %A : Integer -> $ Time: 0 SEC.
compiling exported %K : Integer -> $ Time: 0 SEC.
compiling exported %mol : Integer -> $ Time: 0 SEC.
compiling exported %cd : Integer -> $ Time: 0 SEC.
compiling exported metre : () -> $ Time: 0.01 SEC.
compiling exported kilogram : () -> $ Time: 0 SEC.
compiling exported second : () -> $ Time: 0 SEC.
compiling exported ampere : () -> $ Time: 0 SEC.
compiling exported kelvin : () -> $ Time: 0 SEC.
compiling exported mole : () -> $ Time: 0 SEC.
compiling exported candela : () -> $ Time: 0 SEC.
compiling exported hertz : () -> $ Time: 0 SEC.
compiling exported newton : () -> $ Time: 0 SEC.
compiling exported pascal : () -> $ Time: 0 SEC.
compiling exported joule : () -> $ Time: 0.01 SEC.
compiling exported watt : () -> $ Time: 0 SEC.
compiling exported coulomb : () -> $ Time: 0 SEC.
compiling exported volt : () -> $ Time: 0 SEC.
compiling exported farad : () -> $ Time: 0 SEC.
compiling exported ohm : () -> $ Time: 0 SEC.
compiling exported siemens : () -> $ Time: 0.01 SEC.
compiling exported weber : () -> $ Time: 0 SEC.
compiling exported tesla : () -> $ Time: 0 SEC.
compiling exported henry : () -> $ Time: 0 SEC.
compiling exported lumen : () -> $ Time: 0 SEC.
compiling exported lux : () -> $ Time: 0 SEC.
compiling exported becquerel : () -> $ Time: 0 SEC.
compiling exported gray : () -> $ Time: 0 SEC.
compiling exported sievert : () -> $ Time: 0 SEC.
compiling exported katal : () -> $ Time: 0 SEC.
(time taken in buildFunctor: 0)
;;; *** |SIunit| REDEFINED
;;; *** |SIunit| REDEFINED Time: 0 SEC.
Cumulative Statistics for Constructor SIunit Time: 0.05 seconds
--------------non extending category---------------------- .. SIunit of cat (|Join| (|SetCategory|) (|PhysicalUnit|) (CATEGORY |domain| (SIGNATURE |unitSystem| ((|Type|))) (SIGNATURE |baseUnits| ((|List| $))) (SIGNATURE |%m| ($ (|Integer|))) (SIGNATURE |%kg| ($ (|Integer|))) (SIGNATURE |%s| ($ (|Integer|))) (SIGNATURE %A ($ (|Integer|))) (SIGNATURE %K ($ (|Integer|))) (SIGNATURE |%mol| ($ (|Integer|))) (SIGNATURE |%cd| ($ (|Integer|))) (SIGNATURE |metre| ($) |constant|) (SIGNATURE |kilogram| ($) |constant|) (SIGNATURE |second| ($) |constant|) (SIGNATURE |ampere| ($) |constant|) (SIGNATURE |kelvin| ($) |constant|) (SIGNATURE |mole| ($) |constant|) (SIGNATURE |candela| ($) |constant|) (SIGNATURE |hertz| ($) |constant|) (SIGNATURE |newton| ($) |constant|) (SIGNATURE |pascal| ($) |constant|) (SIGNATURE |joule| ($) |constant|) (SIGNATURE |watt| ($) |constant|) (SIGNATURE |coulomb| ($) |constant|) (SIGNATURE |volt| ($) |constant|) (SIGNATURE |farad| ($) |constant|) (SIGNATURE |ohm| ($) |constant|) (SIGNATURE |siemens| ($) |constant|) (SIGNATURE |weber| ($) |constant|) (SIGNATURE |tesla| ($) |constant|) (SIGNATURE |henry| ($) |constant|) (SIGNATURE |lumen| ($) |constant|) (SIGNATURE |lux| ($) |constant|) (SIGNATURE |becquerel| ($) |constant|) (SIGNATURE |gray| ($) |constant|) (SIGNATURE |sievert| ($) |constant|) (SIGNATURE |katal| ($) |constant|))) has no (SIGNATURE |baseSymbols| ((|List| (|Symbol|))) |constant|) finalizing NRLIB SI Processing SIunit for Browser database: --->-->SIunit(constructor): Not documented!!!! --->-->SIunit((unitSystem ((Type)))): Not documented!!!! --->-->SIunit((baseUnits ((List %)))): Not documented!!!! --->-->SIunit( %(Integer())() ): Not documented!!!! --->-->SIunit((%kg (% (Integer)))): Not documented!!!! --->-->SIunit(((% (|Integer|)))): Not documented!!!! --->-->SIunit((%A (% (Integer)))): Not documented!!!! --->-->SIunit((%K (% (Integer)))): Not documented!!!! --->-->SIunit((%mol (% (Integer)))): Not documented!!!! --->-->SIunit((%cd (% (Integer)))): Not documented!!!! --->-->SIunit((metre (%) constant)): Not documented!!!! --->-->SIunit((kilogram (%) constant)): Not documented!!!! --->-->SIunit((second (%) constant)): Not documented!!!! --->-->SIunit((ampere (%) constant)): Not documented!!!! --->-->SIunit((kelvin (%) constant)): Not documented!!!! --->-->SIunit((mole (%) constant)): Not documented!!!! --->-->SIunit((candela (%) constant)): Not documented!!!! --->-->SIunit((hertz (%) constant)): Not documented!!!! --->-->SIunit((newton (%) constant)): Not documented!!!! --->-->SIunit((pascal (%) constant)): Not documented!!!! --->-->SIunit((joule (%) constant)): Not documented!!!! --->-->SIunit((watt (%) constant)): Not documented!!!! --->-->SIunit((coulomb (%) constant)): Not documented!!!! --->-->SIunit((volt (%) constant)): Not documented!!!! --->-->SIunit((farad (%) constant)): Not documented!!!! --->-->SIunit((ohm (%) constant)): Not documented!!!! --->-->SIunit((siemens (%) constant)): Not documented!!!! --->-->SIunit((weber (%) constant)): Not documented!!!! --->-->SIunit((tesla (%) constant)): Not documented!!!! --->-->SIunit((henry (%) constant)): Not documented!!!! --->-->SIunit((lumen (%) constant)): Not documented!!!! --->-->SIunit((lux (%) constant)): Not documented!!!! --->-->SIunit((becquerel (%) constant)): Not documented!!!! --->-->SIunit((gray (%) constant)): Not documented!!!! --->-->SIunit((sievert (%) constant)): Not documented!!!! --->-->SIunit((katal (%) constant)): Not documented!!!! --->-->SIunit(): Missing Description ; compiling file "/var/aw/var/LatexWiki/SI.NRLIB/SI.lsp" (written 04 APR 2022 08:21:19 PM):
; /var/aw/var/LatexWiki/SI.NRLIB/SI.fasl written ; compilation finished in 0:00:00.076 ------------------------------------------------------------------------ SIunit is now explicitly exposed in frame initial SIunit will be automatically loaded when needed from /var/aw/var/LatexWiki/SI.NRLIB/SI
DIMAN abbreviates package DimensionalAnalysis ------------------------------------------------------------------------ initializing NRLIB DIMAN for DimensionalAnalysis compiling into NRLIB DIMAN compiling local mkxpr : (List Symbol,Vector Integer) -> Expression Integer Time: 0.01 SEC.
compiling exported buckingham : Table(Symbol,P) -> List Expression Integer Time: 0.03 SEC.
(time taken in buildFunctor: 0)
;;; *** |DimensionalAnalysis| REDEFINED
;;; *** |DimensionalAnalysis| REDEFINED Time: 0.01 SEC.
Cumulative Statistics for Constructor DimensionalAnalysis Time: 0.05 seconds
finalizing NRLIB DIMAN Processing DimensionalAnalysis for Browser database: --->-->DimensionalAnalysis(constructor): Not documented!!!! --->-->DimensionalAnalysis((buckingham ((List (Expression (Integer))) (Table (Symbol) P)))): Not documented!!!! --->-->DimensionalAnalysis(): Missing Description ; compiling file "/var/aw/var/LatexWiki/DIMAN.NRLIB/DIMAN.lsp" (written 04 APR 2022 08:21:19 PM):
; /var/aw/var/LatexWiki/DIMAN.NRLIB/DIMAN.fasl written ; compilation finished in 0:00:00.023 ------------------------------------------------------------------------ DimensionalAnalysis is now explicitly exposed in frame initial DimensionalAnalysis will be automatically loaded when needed from /var/aw/var/LatexWiki/DIMAN.NRLIB/DIMAN

fricas
--
Template jEdit: spad_unittest.vm -- Unittest .....: PQTY -- Author .......: Kurt Pagani -- Date .........: Sat Jul 28 16:56:04 CEST 2018 --
fricas
)set break resume
 
fricas
)expose UnittestCount UnittestAux Unittest
UnittestCount is now explicitly exposed in frame initial UnittestAux is now explicitly exposed in frame initial Unittest is now explicitly exposed in frame initial
--)lib PUSYS PQTY SI DIMAN
fricas
)expose PUSYS PQTY SI DIMAN
PhysicalUnitSystem is already explicitly exposed in frame initial PhysQty is already explicitly exposed in frame initial SIunit is already explicitly exposed in frame initial DimensionalAnalysis is already explicitly exposed in frame initial --)co pdim2
fricas
)sh SI
SIunit is a domain constructor. Abbreviation for SIunit is SI This constructor is exposed in this frame. 46 Names for 46 Operations in this Domain. ------------------------------- Operations --------------------------------
%A : Integer -> % %K : Integer -> % %cd : Integer -> % %kg : Integer -> % %m : Integer -> % %mol : Integer -> % %s : Integer -> % ?*? : (%, %) -> % ?/? : (%, %) -> % ?=? : (%, %) -> Boolean ?^? : (%, Integer) -> % ampere : () -> % baseUnits : () -> List(%) becquerel : () -> % candela : () -> % coerce : % -> OutputForm coulomb : () -> % dim : % -> List(Integer) farad : () -> % gray : () -> % hash : % -> SingleInteger henry : () -> % hertz : () -> % joule : () -> % katal : () -> % kelvin : () -> % kilogram : () -> % latex : % -> String lumen : () -> % lux : () -> % metre : () -> % mole : () -> % newton : () -> % ohm : () -> % one : () -> % pascal : () -> % second : () -> % siemens : () -> % sievert : () -> % tesla : () -> % unitSystem : () -> Type volt : () -> % watt : () -> % weber : () -> % ?~=? : (%, %) -> Boolean hashUpdate! : (HashState, %) -> HashState
-- Usage
m:=1400.3 %kg(1)

\label{eq1}{1400.3}\  kg(1)
Type: PhysQty?(SIunit?)
fricas
v:=30.6 (%m(1)/%s(1))

\label{eq2}{30.6}\ {m \ {{s}^{- 1}}}(2)
Type: PhysQty?(SIunit?)
fricas
E:=m*v^2/2

\label{eq3}{655592.454}\ {{{m}^{2}}\  kg \ {{s}^{- 2}}}(3)
Type: PhysQty?(SIunit?)
fricas
-- Test Suite
testsuite "PUSYS"
All user variables and function definitions have been cleared.
Type: Void
fricas
-- Cases
testcase "cgs"
All user variables and function definitions have been cleared.
Type: Void
fricas
CGS ==> PUSYS(['cm,'g,'s])
Type: Void
fricas
[cm,g,s]:=baseUnits()$CGS

\label{eq4}\left[ cm , \: g , \: s \right](4)
Type: List(PhysicalUnitSystem?([cm,g,s]))
fricas
erg:=g*cm^2/s^2

\label{eq5}{{cm}^{2}}\  g \ {{s}^{- 2}}(5)
Type: PhysicalUnitSystem?([cm,g,s])
fricas
dyne:=g*cm/s^2

\label{eq6}cm \  g \ {{s}^{- 2}}(6)
Type: PhysicalUnitSystem?([cm,g,s])
fricas
testEquals("dim cm", "[1,0,0]")
Type: Void
fricas
testEquals("dim g", "[0,1,0]")
Type: Void
fricas
testEquals("dim s", "[0,0,1]")
Type: Void
fricas
testEquals("dim(cm/s*g)","[1,1,-1]")
Type: Void
fricas
testEquals("factors(cm/g).1.exp","1")
Type: Void
fricas
testEquals("factors(cm/g).2.exp","-1")
Type: Void
fricas
testEquals("factors(one()$CGS)","[]")
Type: Void
fricas
testEquals("baseSymbols()$CGS","['cm,'g,'s]")
Type: Void
fricas
testEquals("(cm^2/s^4*g=g*s^(-4)*cm^2)$CGS","true")
Type: Void
fricas
testEquals("(dyne * cm = erg)$CGS","true")
Type: Void
fricas
testcase "SI"
All user variables and function definitions have been cleared.
Type: Void
fricas
[m,kg,s,A,K,mol,cd]:=baseUnits()$SI

\label{eq7}\left[ m , \: kg , \: s , \: A , \: K , \: mol , \: cd \right](7)
Type: List(SIunit?)
fricas
force1:=%kg(1) * %m(1) * %s(-2)

\label{eq8}m \  kg \ {{s}^{- 2}}(8)
Type: SIunit?
fricas
force2:=kg * m / s^2

\label{eq9}m \  kg \ {{s}^{- 2}}(9)
Type: SIunit?
fricas
force3:=newton()$SI

\label{eq10}m \  kg \ {{s}^{- 2}}(10)
Type: SIunit?
fricas
area1:=%m(2)

\label{eq11}{m}^{2}(11)
Type: SIunit?
fricas
area2:=m^2

\label{eq12}{m}^{2}(12)
Type: SIunit?
fricas
area3:=metre()^2

\label{eq13}{m}^{2}(13)
Type: SIunit?
fricas
pressure1:=force1/area1

\label{eq14}{{m}^{- 1}}\  kg \ {{s}^{- 2}}(14)
Type: SIunit?
fricas
pressure2:=pascal()$SI

\label{eq15}{{m}^{- 1}}\  kg \ {{s}^{- 2}}(15)
Type: SIunit?
fricas
testEquals("(force1=force2)$SI","true")
Type: Void
fricas
testEquals("(force2=force3)$SI","true")
Type: Void
fricas
testEquals("(pressure1=pressure2)$SI","true")
Type: Void
fricas
testEquals("dim force1","[1,1,- 2,0,0,0,0]")
Type: Void
fricas
testEquals("dim pressure2","[- 1,1,- 2,0,0,0,0]")
Type: Void
fricas
-- Test Suite
testsuite "PQTY"
All user variables and function definitions have been cleared.
Type: Void
fricas
testcase "PQTY(SI)"
All user variables and function definitions have been cleared.
Type: Void
fricas
-- from codata.spad (package CODATA)
CT(v,e,u) ==> (interval(v-e,v+e)$Interval(Float)) u
Type: Void
fricas
-- speed of light in vacuum
-- Value         299 792 458 m s-1
-- Standard uncertainty          (exact)
-- Relative standard uncertainty         (exact)
-- Concise form          299 792 458 m s-1    
c  := CT(299792458.0, 0.0, %m(1)*%s(-1))

\label{eq16}{299792458.0}\ {m \ {{s}^{- 1}}}(16)
Type: PhysQty?(SIunit?)
fricas
-- Planck constant over 2 pi 
-- Value         1.054 571 800 x 10-34 J s
-- Standard uncertainty          0.000 000 013 x 10-34 J s
-- Relative standard uncertainty          1.2 x 10-8
-- Concise form          1.054 571 800(13) x 10-34 J s 
hbar := CT(1.054571800E-34, 0.000000013E-34,%m(2)*%kg(1)*%s(-1))

\label{eq17}{0.10545718 E - 33}\ {{{m}^{2}}\  kg \ {{s}^{- 1}}}(17)
Type: PhysQty?(SIunit?)
fricas
-- elementary charge
-- $e$
-- Value          1.602 176 6208 x 10-19  C
-- Standard uncertainty          0.000 000 0098 x 10-19 C
-- Relative standard uncertainty          6.1 x 10-9
-- Concise form           1.602 176 6208(98) x 10-19 C  
e  := CT(1.6021766208E-19, 0.0000000098E-19, %A(1)*%s(1))

\label{eq18}{0.1602176620 \<u> 8 E - 18}\ {s \  A}(18)
Type: PhysQty?(SIunit?)
fricas
-- electron mass
-- $m_{\rm e}$
-- Value         9.109 383 56 x 10-31 kg
-- Standard uncertainty          0.000 000 11 x 10-31 kg
-- Relative standard uncertainty          1.2 x 10-8
-- Concise form          9.109 383 56(11) x 10-31 kg   
m_e := CT(9.10938356E-31, 0.00000011E-31, %kg(1))

\label{eq19}{0.910938356 E - 30}\  kg(19)
Type: PhysQty?(SIunit?)
fricas
-- fine-structure constant
-- Value         7.297 352 5664 x 10-3
-- Standard uncertainty          0.000 000 0017 x 10-3
-- Relative standard uncertainty          2.3 x 10-10
-- Concise form          7.297 352 5664(17) x 10-3 
alpha := CT(7.2973525664E-3, 0.0000000017E-3,%m(0)$SI)

\label{eq20}{0.0072973525 \<u> 664}\  1(20)
Type: PhysQty?(SIunit?)
fricas
-- electric constant
-- $\varepsilon_0$
-- Value         8.854 187 817... x 10-12 F m-1
-- Standard uncertainty          (exact)
-- Relative standard uncertainty         (exact)
-- Concise form          8.854 187 817... x 10-12 F m-1    
eps_0 := CT(8.854187817E-12,0, %m(-3)*%kg(-1)*%s(4)*%A(2))

\label{eq21}{0.8854187817 E - 11}\ {{{m}^{- 3}}\ {{kg}^{- 1}}\ {{s}^{4}}\ {{A}^{2}}}(21)
Type: PhysQty?(SIunit?)
fricas
r1:=ival e

\label{eq22}\left[{0.1602176611 E - 18}, \:{0.1602176630 \_ 6 E - 18}\right](22)
Type: Interval(Float)
fricas
r2:=unit e

\label{eq23}s \  A(23)
Type: SIunit?
fricas
r3:=magnitude e

\label{eq24}0.1602176620 \<u> 8 E - 18(24)
Type: Float
fricas
r4:=uncertainty e

\label{eq25}0.9800000000 \<u> 0067680793 E - 27(25)
Type: Float
fricas
testEquals("(unit e = %s(1)*%A(1))$SI","true")
Type: Void
fricas
testEquals("(unit(m_e*c^2)/joule()$SI=one()$SI)$SI","true")
Type: Void
fricas
-- fine structure
myalpha:=(1/(4*%pi))::Float * eps_0^(-1)*e^2/hbar/c

\label{eq26}{0.0072973525 \<u> 6768042794 \</u> 47}\  1(26)
Type: PhysQty?(SIunit?)
fricas
testEquals("abs(magnitude(myalpha-alpha))<1.0E-10","true")
Type: Void
fricas
f:=2 newton()$SI

\label{eq27}{2.0}\ {m \  kg \ {{s}^{- 2}}}(27)
Type: PhysQty?(SIunit?)
fricas
l:=3.6 metre()$SI

\label{eq28}{3.6}\  m(28)
Type: PhysQty?(SIunit?)
fricas
a:=l^2

\label{eq29}{12.96}\ {{m}^{2}}(29)
Type: PhysQty?(SIunit?)
fricas
p:=f/a

\label{eq30}{0.1543209876 \<u> 5432098765}\ {{{m}^{- 1}}\  kg \ {{s}^{- 2}}}(30)
Type: PhysQty?(SIunit?)
fricas
testEquals("test(magnitude(7.2 joule()$SI / (f*l))=1$Float)","true")
Type: Void
fricas
testEquals("uncertainty(m_e*c^2)<1.0E-20","true")
Type: Void
fricas
setOutputMode(1)$PQTY(SI)

\label{eq31}1(31)
Type: PositiveInteger?
fricas
hbar

\label{eq32}{0.10545718 E - 33}\  �� \ {0.13 E - 41}\ {{{m}^{2}}\  kg \ {{s}^{- 1}}}(32)
Type: PhysQty?(SIunit?)
fricas
m_e

\label{eq33}{0.910938356 E - 30}\  �� \ {0.11 E - 37}\  kg(33)
Type: PhysQty?(SIunit?)
fricas
c

\label{eq34}{299792458.0}\  �� \ {0.2 E - 11}\ {m \ {{s}^{- 1}}}(34)
Type: PhysQty?(SIunit?)
fricas
setOutputMode(3)$PQTY(SI)

\label{eq35}3(35)
Type: PositiveInteger?
fricas
alpha

\label{eq36}{\left[{0.0072973525 \<u> 647}, \:{0.0072973525 \</u> 681}\right]}\  1(36)
Type: PhysQty?(SIunit?)
fricas
eps_0

\label{eq37}{
\begin{array}{@{}l}
\displaystyle
\left[{0.8854187816 \_ 9999999999 E - 11}, \: \right.
\
\
\displaystyle
\left.{0.8854187817 E - 11}\right] 
(37)
Type: PhysQty?(SIunit?)
fricas
setOutputMode(2)$PQTY(SI)

\label{eq38}2(38)
Type: PositiveInteger?
fricas
m_e

\label{eq39}{0.910938356 E - 30}\  kg(39)
Type: PhysQty?(SIunit?)
fricas
hbar

\label{eq40}{0.10545718 E - 33}\ {{{m}^{2}}\  kg \ {{s}^{- 1}}}(40)
Type: PhysQty?(SIunit?)
fricas
-- Test Suite
testsuite "DIMAN"
All user variables and function definitions have been cleared.
Type: Void
fricas
testcase "DIMAN(SI)"
All user variables and function definitions have been cleared.
Type: Void
fricas
-- Dimensional analysis
-- Buckingham Pi theorem
D==> DIMAN(SI)
Type: Void
fricas
t:Table(Symbol,SI):=table()

\label{eq41} \mbox{\rm table} \left({}\right)(41)
Type: Table(Symbol,SIunit?)
fricas
t.L:=%m(1)$SI ; t.M:=%kg(1)$SI; t.T:=%s(1)$SI; t.g:=%m(1)$SI/%s(2)$SI

\label{eq42}m \ {{s}^{- 2}}(42)
Type: SIunit?
fricas
bt:=buckingham(t)

\label{eq43}\left[{L \over{{{T}^{2}}\  g}}\right](43)
Type: List(Expression(Integer))
fricas
res1:=solve(bt.1=1,'T).1

\label{eq44}T ={\sqrt{L \over g}}(44)
Type: Equation(Expression(Integer))
fricas
s:Table(Symbol,SI):=table()

\label{eq45} \mbox{\rm table} \left({}\right)(45)
Type: Table(Symbol,SIunit?)
fricas
s.v:=%m(1)$SI/%s(1)$SI; s.rho:=%kg(1)$SI/%m(3)$SI; s.p:=pascal()$SI

\label{eq46}{{m}^{- 1}}\  kg \ {{s}^{- 2}}(46)
Type: SIunit?
fricas
bs:=buckingham(s)

\label{eq47}\left[{{rho \ {{v}^{2}}}\over p}\right](47)
Type: List(Expression(Integer))
fricas
res2:=solve(bs.1=1,'v).1

\label{eq48}v ={\sqrt{p \over rho}}(48)
Type: Equation(Expression(Integer))
fricas
-- https://en.wikipedia.org/w/index.php?title=Dimensional_analysis
-- Example section 26
vb:Table(Symbol,SI):=table()

\label{eq49} \mbox{\rm table} \left({}\right)(49)
Type: Table(Symbol,SIunit?)
fricas
vb.'l:=%m(1)$SI; vb.A:=%m(1)$SI; vb.rho:=%kg(1)$SI/%m(1)$SI;
Type: SIunit?
fricas
vb.'s:=%kg(1)$SI*%m(1)$SI/%s(2)$SI; vb.E:=%kg(1)$SI*%m(2)$SI/%s(2)$SI

\label{eq50}{{m}^{2}}\  kg \ {{s}^{- 2}}(50)
Type: SIunit?
fricas
bvb:=buckingham vb

\label{eq51}\left[{{A \  s}\over E}, \:{{l \  s}\over E}\right](51)
Type: List(Expression(Integer))
fricas
testEquals("res1","T=sqrt(L/g)")
Type: Void
fricas
testEquals("res2","v=sqrt(p/rho)")
Type: Void
fricas
F:=operator 'F

\label{eq52}F(52)
Type: BasicOperator?
fricas
res3:=F(bvb.2,bvb.1)=0

\label{eq53}{F \left({{{l \  s}\over E}, \:{{A \  s}\over E}}\right)}= 0(53)
Type: Equation(Expression(Integer))
fricas
testEquals("res3","F('l*'s/'E,'A*'s/'E)=0")
Type: Void
fricas
-- Results/Statistics
fricas
)set output algebra on
 
fricas
)version
Value = "FriCAS 1.3.7 compiled at Wed Jun 30 16:44:06 UTC 2021"
fricas
)lisp (lisp-implementation-type)
Value = "SBCL"
fricas
)lisp (lisp-implementation-version)
Value = "1.1.1"
statistics()
============================================================================= General WARNINGS: * do not use ')clear completely' before having used 'statistics()' It clears the statistics without warning! * do not forget to pass the arguments of the testXxxx functions as Strings! Otherwise, the test will fail and statistics() will not notice! * testLibraryError does not prevent FriCAS from aborting the current block. Thus, if a block contains other test functions, they will not be executed and statistics() will not notice! ============================================================================= WARNINGS: Testsuite: PUSYS Testcase: cgs test: 7 testing in a domain without InputForm! Testsuite: DIMAN Testcase: DIMAN(SI) test: 1 testing in a domain without InputForm! Testsuite: DIMAN Testcase: DIMAN(SI) test: 2 testing in a domain without InputForm! Testsuite: DIMAN Testcase: DIMAN(SI) test: 3 testing in a domain without InputForm!
============================================================================= Testsuite: PUSYS failed (total): 0 (2) ============================================================================= Testsuite: PQTY failed (total): 0 (1) ============================================================================= Testsuite: DIMAN failed (total): 0 (1)
============================================================================= testsuite | testcases: failed (total) | tests: failed (total) PUSYS 0 (2) 0 (15) PQTY 0 (1) 0 (5) DIMAN 0 (1) 0 (3) ============================================================================= File summary. unexpected failures: 0 expected failures: 0 unexpected passes: 0 total tests: 23
Type: Void




  Subject:   Be Bold !!
  ( 14 subscribers )  
Please rate this page: