Derivative

Description

Derivative rules

Source: PROLOG str. 192 Wydawnictwo PLJ Warszawa 1991 ISBN 83-85190-63-5

Download

Program source code: derivative.pl

Listing

pochodna(X, X, 1) :- !.
pochodna(C, X, 0) :- atomic(C).
pochodna(-Z, X, -C) :- pochodna(Z, X, C).
pochodna(W+Z, X, A+B) :- pochodna(W, X, A), pochodna(Z, X, B).
pochodna(W-Z, X, A-B) :- pochodna(W, X, A), pochodna(Z, X, B).
pochodna(C*Z, X, C*A) :- atomic(C), C \= X, pochodna(Z, X,A), !.
pochodna(W*Z, X, B*W+A*Z) :- pochodna(W, X, A), pochodna(Z, X, B).
 
test :- pochodna(2*x+3, x, K).

Comments

pl/prolog/pllib/derivative.txt · ostatnio zmienione: 2017/07/17 08:08 (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