Różnice

Różnice między wybraną wersją a wersją aktualną.

Odnośnik do tego porównania

pl:prolog:pllib:oscillator [2019/06/27 15:50] (aktualna)
Linia 1: Linia 1:
 +====== Oscillator ======
 +{{tag>​model electronics}}
 +===== Description =====
 +An oscillator model with energy constraint.
 +
 +**Source**: ​ PROLOG programming for artificial intelligence,​ 3rd Edition, Harlow, 2001, ISBN 0-201-40375-7.
 +===== Download =====
 +Program source code: {{oscillator.pl}}
 +===== Listing =====
 +<code prolog>
 +% File energy.pl: An oscillator model with energy constraint ​
 +% (alternative to one in Fig. 20.14).
 +
 +:-  op( 200, xfy, [:, ::]).
 +:-  op( 220, xfy, ..).
 +
 +legalstate( [ X, V, A])  :-
 +     ​deriv( X, V),
 +     ​deriv( V, A),
 +     ​MinusA = a:_,
 +     sum( A, MinusA, a:​zero/​std), ​             % MinusA = -A
 +     ​mplus( X, MinusA), ​                       % Spring pulling block back
 +     ​energy( X, V).                            % Weak energy conserv. constraint
 +
 +   ​energy( X, V)  :​-  ​
 +      V = v:v0/_, !, X = x:​zero/​_ ​             % If V=v0, X must be zero
 +      ;
 +      X = x:zero/_, !, V = v:​minf..zero/​_ ​     % Here V must be -v0
 +      ;
 +      true.                                    % Otherwise X non-zero, no constraint on V
 +</​code>​
 +===== Comments =====
  
pl/prolog/pllib/oscillator.txt · ostatnio zmienione: 2019/06/27 15:50 (edycja zewnętrzna)
www.chimeric.de Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0