LibBracket

Aus LaborWiki
Wechseln zu: Navigation, Suche
     
LibBracket

Release status: unknown [box doku]

Description Ein einfacher algebraischer Termumformer
Author(s)  Thomas
Platform  ruby
Download  http://github.com/schnittchen/LibBracket

„alpha“ befindet sich nicht in der Liste (experimental, beta, stable, obsolete, unknown) zulässiger Werte für das Attribut „Pr status“.




LibBracket ist ein Framework zum Bau von algebraischen Termumformern eines bestimmten Musters.

Beispiel[Bearbeiten]

 require 'libbracket'
 
 module Scalars
   include LibBracket::IsSummable
   include LibBracket::IsMultipliable
 end
 
 module Other
   include LibBracket::IsSummable
   include LibBracket::HasScalarsFromLeft
   include LibBracket::ScalarMultipleOperator
   
   include LibBracket::HasInnerProduct
   domain_of_inner_product Scalars
 end
 
 f = LibBracket::Atom.from_domain_and_name Scalars, "f"
 
 A = LibBracket::Atom.from_domain_and_name Other, "A"
 B = LibBracket::Atom.from_domain_and_name Other, "B"
 C = LibBracket::Atom.from_domain_and_name Other, "C"
 
 term = C.inner_product_with(A + Other::ZERO + B*f)
 
 puts term.to_s # => <C, (A + 0) + f*B>
 
 term2 = term.canonicalize_and_replace
 
 puts term2.to_s # => <A, C> + f*<B, C>

Links[Bearbeiten]