Różnice

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

Odnośnik do tego porównania

pl:prolog:pllib:derivative_2 [2019/06/27 15:50]
pl:prolog:pllib:derivative_2 [2019/06/27 15:50] (aktualna)
Linia 1: Linia 1:
 +====== Derivative 2 ======
 +{{tag>​math rules}}
 +===== Description =====
 +Derivative rules
 +
 +**Source**: ​ The Art of Prolog
 +===== Download =====
 +Program source code: {{derivative_2.pl}}
 +===== Listing =====
 +<code prolog>
 +/*
 + derivative(Expression,​X,​DifferentiatedExpression) :-
 + DifferentiatedExpression is the derivative of
 + Expression with respect to X.
 +*/
 +
 + derivative(X,​X,​s(0)).
 + derivative(X ^ s(N),X,s(N) * X ^ N).
 + derivative(sin(X),​X,​cos(X)).
 + derivative(cos(X),​X,​-sin(X)).
 + derivative(e ^ X,X,e ^ X).
 + derivative(log(X),​X,​1/​X).
 +
 + derivative(F+G,​X,​DF+DG) :-
 + derivative(F,​X,​DF),​ derivative(G,​X,​DG).
 + derivative(F-G,​X,​DF-DG) :-
 + derivative(F,​X,​DF),​ derivative(G,​X,​DG).
 + derivative(F*G,​X,​F*DG + DF*G) :-
 + derivative(F,​X,​DF),​ derivative(G,​X,​DG).
 + derivative(1/​F,​X,​-DF/​(F*F)) :-
 + derivative(F,​X,​DF).
 + derivative(F/​G,​X,​(G*DF-F*DG)/​(G*G)) :-
 + derivative(F,​X,​DF),​ derivative(G,​X,​DG).
 +
 +% Program 3.30: Derivative rules
 +</​code>​
 +===== Comments =====
  
pl/prolog/pllib/derivative_2.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