Дифференцирование
This commit is contained in:
29
Носов Иван/README.md
Normal file
29
Носов Иван/README.md
Normal file
@@ -0,0 +1,29 @@
|
||||
# Дифференцирование
|
||||
## Ссылка на видеоразбор
|
||||
https://youtu.be/Kh0shn9UW6Y
|
||||
## Код из книги
|
||||
#let rec differentiate x tm = match tm with
|
||||
Var y -> if y = x then Const "1" else Const "0"
|
||||
| Const c -> Const "0"
|
||||
| Fn("-",[t]) -> Fn("-",[differentiate x t])
|
||||
| Fn("+",[t1;t2]) -> Fn("+",[differentiate x t1;
|
||||
differentiate x t2])
|
||||
| Fn("-",[t1;t2]) -> Fn("-",[differentiate x t1;
|
||||
differentiate x t2])
|
||||
| Fn("*",[t1;t2]) ->
|
||||
Fn("+",[Fn("*",[differentiate x t1; t2]);
|
||||
Fn("*",[t1; differentiate x t2])])
|
||||
| Fn("inv",[t]) -> chain x t
|
||||
(Fn("-",[Fn("inv",[Fn("^",[t;Const "2"])])]))
|
||||
| Fn("^",[t;n]) -> chain x t
|
||||
(Fn("*",[n; Fn("^",[t; Fn("-",[n; Const "1"])])]))
|
||||
| Fn("exp",[t]) -> chain x t tm
|
||||
| Fn("ln",[t]) -> chain x t (Fn("inv",[t]))
|
||||
| Fn("sin",[t]) -> chain x t (Fn("cos",[t]))
|
||||
| Fn("cos",[t]) -> chain x t
|
||||
(Fn("-",[Fn("sin",[t])]))
|
||||
| Fn("/",[t1;t2]) -> differentiate x
|
||||
(Fn("*",[t1; Fn("inv",[t2])]))
|
||||
| Fn("tan",[t]) -> differentiate x
|
||||
(Fn("/",[Fn("sin",[t]); Fn("cos",[t])]))
|
||||
and chain x t u = Fn("*",[differentiate x t; u]);;
|
||||
Reference in New Issue
Block a user