Compare commits
8 Commits
0bc1280929
...
dc83f6e7d1
| Author | SHA1 | Date | |
|---|---|---|---|
| dc83f6e7d1 | |||
| 512d441517 | |||
| c6d0207fa5 | |||
| c2abb6af27 | |||
| 37d6eab0cd | |||
| 98447f2cf7 | |||
| df8f21a07b | |||
| 9a0e65632e |
7
Жегалин Михаил/Konkatenatsia.rkt
Normal file
7
Жегалин Михаил/Konkatenatsia.rkt
Normal file
@@ -0,0 +1,7 @@
|
||||
(define (concat li1 li2)
|
||||
(if (empty? li2)
|
||||
li1
|
||||
(concat (append li1 (list (car li2))) (cdr li2))
|
||||
)
|
||||
)
|
||||
(writeln (concat (list 1 2 3) (list 3 4 5)))
|
||||
8
Жегалин Михаил/README.md
Normal file
8
Жегалин Михаил/README.md
Normal file
@@ -0,0 +1,8 @@
|
||||
# Конкатенация
|
||||
## Ссылка на видеоразбор
|
||||
https://youtu.be/UCdiG5nTiFY
|
||||
## Код из книги
|
||||
#let rec append l1 l2 =
|
||||
match l1 with
|
||||
[] -> l2
|
||||
| (h::t) -> h::(append t l2);;
|
||||
29
Ковтун Богдан/Kovtun Bogdan.rkt
Normal file
29
Ковтун Богдан/Kovtun Bogdan.rkt
Normal file
@@ -0,0 +1,29 @@
|
||||
|
||||
#lang racket/base
|
||||
(define (coordinations x1 y1 x2 y2 x3 y3 x4 y4 x5 y5)
|
||||
(define (square x) (* x x))
|
||||
(if (equal? (* (- x1 x2) (- y2 y3)) (* (- y1 y2) (- x2 x3)))
|
||||
(displayln "Points 1, 2 and 3 lie on a common line.")
|
||||
(displayln "Points 1, 2 and 3 do not lie on a common line."))
|
||||
(if (equal? (* (- x1 x2) (- y3 y4)) (* (- y1 y2) (- x3 x4)))
|
||||
(displayln "Lines (1,2) and (3,4) are parallel.")
|
||||
(displayln "Lines (1,2) and (3,4) are not parallel."))
|
||||
(if (equal? (+ (* (- x1 x2) (- x3 x4)) (* (- y1 y2) (- y3 y4))) 0 )
|
||||
(displayln "Lines (1,2) and (3,4) are perpendicular.")
|
||||
(displayln "Lines (1,2) and (3,4) are not perpendicular."))
|
||||
(if (equal? (+ (square(- x1 x2)) (square(- y1 y2))) (+ (square(- x3 x4)) (square(- y3 y4))))
|
||||
(displayln "Lines (1,2) and (3,4) have the same length.")
|
||||
(displayln "Lines (1,2) and (3,4) do not have the same length.."))
|
||||
(if (and (equal? (* 2 x1) (+ x2 x3)) (equal? (* 2 y1) (+ y2 y3)))
|
||||
(displayln "Point 1 is the midpoint of line (2,3).")
|
||||
(displayln "Point 1 is not the midpoint of line (2,3)."))
|
||||
(if (and (equal? (* (- x1 x2) (- y2 y3)) (* (- y1 y2) (- x2 x3)) )
|
||||
(equal? (* (- x1 x4) (- y4 y5)) (* (- y1 y4) (- x4 x5)) ) )
|
||||
(displayln "Lines (2,3) and (4,5) meet at point 1.")
|
||||
(displayln "Lines (2,3) and (4,5) do not intersect at point 1."))
|
||||
(if (and (equal? x1 x2) (equal? y1 y2))
|
||||
(displayln "Points 1 and 2 are the same.")
|
||||
(displayln "Points 1 and 2 are not the same."))
|
||||
|
||||
)
|
||||
(coordinations 0 1 0 0 0 1 1 1 2 2)
|
||||
32
Ковтун Богдан/README.md
Normal file
32
Ковтун Богдан/README.md
Normal file
@@ -0,0 +1,32 @@
|
||||
# Перевод геометрических свойств в координаты
|
||||
## Ссылка на видеоразбор
|
||||
https://youtu.be/Nu43zpDrWuM
|
||||
## Код из книги
|
||||
let coordinations =
|
||||
["collinear", (** Points 1, 2 and 3 lie on a common line **)
|
||||
<<(1_x - 2_x) * (2_y - 3_y) = (1_y - 2_y) * (2_x - 3_x)>>;
|
||||
"parallel", (** Lines (1,2) and (3,4) are parallel **)
|
||||
<<(1_x - 2_x) * (3_y - 4_y) = (1_y - 2_y) * (3_x - 4_x)>>;
|
||||
"perpendicular", (** Lines (1,2) and (3,4) are perpendicular **)
|
||||
<<(1_x - 2_x) * (3_x - 4_x) + (1_y - 2_y) * (3_y - 4_y) = 0>>;
|
||||
"lengths_eq", (** Lines (1,2) and (3,4) have the same length **)
|
||||
<<(1_x - 2_x)^2 + (1_y - 2_y)^2 = (3_x - 4_x)^2 + (3_y - 4_y)^2>>;
|
||||
"is_midpoint", (** Point 1 is the midpoint of line (2,3) **)
|
||||
<<2 * 1_x = 2_x + 3_x /\ 2 * 1_y = 2_y + 3_y>>;
|
||||
"is_intersection", (** Lines (2,3) and (4,5) meet at point 1 **)
|
||||
<<(1_x - 2_x) * (2_y - 3_y) = (1_y - 2_y) * (2_x - 3_x) /\
|
||||
(1_x - 4_x) * (4_y - 5_y) = (1_y - 4_y) * (4_x - 5_x)>>;
|
||||
"=", (** Points 1 and 2 are the same **)
|
||||
<<(1_x = 2_x) /\ (1_y = 2_y)>>];;
|
||||
|
||||
let coordinate = onatoms
|
||||
(fun (R(a,args)) ->
|
||||
let xtms,ytms = unzip
|
||||
(map (fun (Var v) -> Var(v^"_x"),Var(v^"_y")) args) in
|
||||
let xs = map (fun n -> string_of_int n^"_x") (1--length args)
|
||||
and ys = map (fun n -> string_of_int n^"_y") (1--length args) in
|
||||
subst (fpf (xs @ ys) (xtms @ ytms)) (assoc a coordinations));;
|
||||
|
||||
START_INTERACTIVE;;
|
||||
coordinate <<collinear(a,b,c) ==> collinear(b,a,c)>>;;
|
||||
END_INTERACTIVE;;
|
||||
8
Костин Андрей/README.md
Normal file
8
Костин Андрей/README.md
Normal file
@@ -0,0 +1,8 @@
|
||||
# Вычисление степени
|
||||
## Ссылка на видеоразбор
|
||||
https://youtu.be/4LgMiXXWyE4
|
||||
## Код из книги
|
||||
#let rec exp x n =
|
||||
if n = 0 then 1
|
||||
else x * exp x (n - 1);;
|
||||
|
||||
4
Костин Андрей/power.rkt
Normal file
4
Костин Андрей/power.rkt
Normal file
@@ -0,0 +1,4 @@
|
||||
#lang racket
|
||||
(define (power n m)
|
||||
(if (= m 0) 1
|
||||
(* n (power n (- m 1)))))
|
||||
33
Латин Ярослав/1ch.fs
Normal file
33
Латин Ярослав/1ch.fs
Normal file
@@ -0,0 +1,33 @@
|
||||
// For more information see https://aka.ms/fsharp-console-apps
|
||||
|
||||
|
||||
let mutable y1 = 1
|
||||
let _ = y1 <- y1*2 in
|
||||
let _ = y1 <- y1+1 in
|
||||
let _ = y1 <- y1+1 in
|
||||
|
||||
printf "y1 = %A\n"y1
|
||||
|
||||
let mutable x1 = 1
|
||||
let _ = x1 <- x1+1 in
|
||||
let _ = x1 <- x1*2 in
|
||||
let _ = x1 <- x1+1 in
|
||||
|
||||
printf "x1 = %A\n"x1
|
||||
|
||||
let mutable y = 1
|
||||
y <- y * 2
|
||||
y <- y + 1
|
||||
y <- y + 1
|
||||
|
||||
|
||||
printf "y = %A\n"y
|
||||
|
||||
let mutable x = 1
|
||||
x <- x + 1
|
||||
x <- x * 2
|
||||
x <- x + 1
|
||||
|
||||
|
||||
printf "x = %A\n"x
|
||||
|
||||
16
Латин Ярослав/2ch.fs
Normal file
16
Латин Ярослав/2ch.fs
Normal file
@@ -0,0 +1,16 @@
|
||||
// For more information see https://aka.ms/fsharp-console-apps
|
||||
module kolok
|
||||
|
||||
let mutable x = []
|
||||
|
||||
let mutable refx = ref x
|
||||
|
||||
let _ = refx <- ref [2]
|
||||
//let _ = refx <- ref [true]
|
||||
|
||||
|
||||
printf "%O\n" refx
|
||||
printf "%A\n" refx
|
||||
|
||||
|
||||
|
||||
16
Латин Ярослав/README.md
Normal file
16
Латин Ярослав/README.md
Normal file
@@ -0,0 +1,16 @@
|
||||
# Последовательность вычислений и Работа с системой типов
|
||||
## Ссылка на видеоразбор
|
||||
|
||||
## Код из книги
|
||||
Ярик Латин, [5/10/22 4:31 PM]
|
||||
let _ = x := !x + 1 in
|
||||
let _ = x := !x + 1 in
|
||||
let _ = x := !x + 1 in
|
||||
let _ = x := !x + 1 in
|
||||
();;
|
||||
|
||||
Ярик Латин, [5/10/22 4:31 PM]
|
||||
x := !x + 1;
|
||||
x := !x + 1;
|
||||
x := !x + 1;
|
||||
x := !x + 1;;
|
||||
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]);;
|
||||
113
Носов Иван/proizvodnaya.rkt
Normal file
113
Носов Иван/proizvodnaya.rkt
Normal file
@@ -0,0 +1,113 @@
|
||||
#lang racket
|
||||
(define (deriv exp var)
|
||||
(cond ((number? exp) 0)
|
||||
((variable? exp)
|
||||
(if (same-variable? exp var) 1 0))
|
||||
|
||||
((sum? exp)
|
||||
(make-sum (deriv (addend exp) var)
|
||||
(deriv (augend exp) var)))
|
||||
|
||||
((dif? exp)
|
||||
(make-dif (deriv (addend exp) var)
|
||||
(deriv (augend exp) var)))
|
||||
|
||||
((product? exp)
|
||||
(make-sum
|
||||
(make-product (multiplier exp)
|
||||
(deriv (multipicand exp) var))
|
||||
(make-product (deriv (multiplier exp) var)
|
||||
(multipicand exp))))
|
||||
|
||||
((exponentiation? exp)
|
||||
(make-product
|
||||
(make-product (exponent exp)
|
||||
(make-exponentiation (base exp) (- (exponent exp) 1)))
|
||||
(deriv (base exp)
|
||||
var)))
|
||||
|
||||
((sinus? exp)
|
||||
(make-product
|
||||
(deriv (base exp)
|
||||
var)(make-cos (base exp))))
|
||||
|
||||
((cosinus? exp)
|
||||
(make-product
|
||||
(deriv (base exp)var)(make-sin (base exp))))
|
||||
|
||||
((ex? exp)
|
||||
(make-product
|
||||
(deriv (base exp)
|
||||
var)(make-exp (base exp))))
|
||||
|
||||
|
||||
(else
|
||||
error "unknow expression type -- DERIV" exp)))
|
||||
|
||||
(define (ex? x)
|
||||
(and (pair? x) (eq? 'exp (car x))))
|
||||
|
||||
(define (make-exp a0)(list 'exp a0))
|
||||
|
||||
(define (sinus? x)
|
||||
(and (pair? x) (eq? 'sin (car x) )))
|
||||
|
||||
(define (make-cos a0)(list 'cos a0))
|
||||
|
||||
(define (cosinus? x)
|
||||
(and (pair? x) (eq? 'cos (car x) )))
|
||||
|
||||
(define (make-sin a0)(list '-sin a0))
|
||||
|
||||
(define (=number? exp num)
|
||||
(and (number? exp) (= exp num)))
|
||||
|
||||
(define (multipicand p) (caddr p))
|
||||
|
||||
(define (variable? x) (symbol? x))
|
||||
|
||||
(define (same-variable? v0 v1)
|
||||
(and (variable? v0) (variable? v1) (eq? v0 v1)))
|
||||
|
||||
(define (make-sum a0 a1)
|
||||
(cond ((and (number? a0) (number? a1)) (+ a0 a1))
|
||||
(else (list '+ a0 a1))))
|
||||
|
||||
(define (sum? x)
|
||||
(and (pair? x) (eq? (car x) '+)))
|
||||
|
||||
(define (dif? x)
|
||||
(and (pair? x) (eq? (car x) '-)))
|
||||
|
||||
(define (make-dif a0 a1)
|
||||
(cond ((and (number? a0) (number? a1)) (- a0 a1))
|
||||
(else (list '- a0 a1))))
|
||||
|
||||
(define (addend s) (cadr s))
|
||||
|
||||
(define (augend s) (caddr s))
|
||||
|
||||
(define (make-product m0 m1)
|
||||
(cond ((or (=number? m0 0) (=number? m1 0)) 0)
|
||||
((=number? m0 1) m1)
|
||||
((=number? m1 1) m0)
|
||||
((and (number? m0) (number? m1)) (* m0 m1))
|
||||
(else (list '* m0 m1))))
|
||||
|
||||
(define (product? x)
|
||||
(and (pair? x) (eq? (car x) '*)))
|
||||
|
||||
(define (multiplier p) (cadr p))
|
||||
|
||||
(define (make-exponentiation x n)
|
||||
(cond ((= n 0) 1)
|
||||
((= n 1) x)
|
||||
(else (list '** x n))))
|
||||
|
||||
(define (exponentiation? x)
|
||||
(and (pair? x) (eq? (car x) '**)))
|
||||
|
||||
(define (base s) (cadr s))
|
||||
|
||||
(define (exponent s) (caddr s))
|
||||
|
||||
3
Павлова Наташа/README.md
Normal file
3
Павлова Наташа/README.md
Normal file
@@ -0,0 +1,3 @@
|
||||
# Лемма 7.6
|
||||
## Ссылка на видеоразбор
|
||||
https://youtu.be/8mOFRUgdmZU
|
||||
22
Павлова Наташа/lemma_7.6.rkt
Normal file
22
Павлова Наташа/lemma_7.6.rkt
Normal file
@@ -0,0 +1,22 @@
|
||||
#lang racket
|
||||
|
||||
(define (rev lst)
|
||||
(if (null? lst);ф-я принимает пустой список
|
||||
lst;возвращает пустой список
|
||||
(if (= 1 (length lst));ф-я принимает список из 1 элемента
|
||||
lst; возвращает список из 1 элемента
|
||||
;в списке можно выделить голову и хвост
|
||||
(append (rev (cdr lst)); запускаем rev для хвоста (cdr - хвост)
|
||||
(list(car lst));возвращаем голову (car - голова)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
(writeln(rev(rev '(1 2 3 4))))
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
24
Погребицкий Евгений/README.md
Normal file
24
Погребицкий Евгений/README.md
Normal file
@@ -0,0 +1,24 @@
|
||||
# Теорема Симсона
|
||||
## Ссылка на видеоразбор
|
||||
https://youtu.be/_ewjiWIH0VY
|
||||
## Код из книги
|
||||
START_INTERACTIVE;;
|
||||
let simson =
|
||||
<<lengths_eq(o,a,o,b) /\
|
||||
lengths_eq(o,a,o,c) /\
|
||||
lengths_eq(o,a,o,d) /\
|
||||
collinear(e,b,c) /\
|
||||
collinear(f,a,c) /\
|
||||
collinear(g,a,b) /\
|
||||
perpendicular(b,c,d,e) /\
|
||||
perpendicular(a,c,d,f) /\
|
||||
perpendicular(a,b,d,g)
|
||||
==> collinear(e,f,g)>>;;
|
||||
|
||||
let vars =
|
||||
["g_y"; "g_x"; "f_y"; "f_x"; "e_y"; "e_x"; "d_y"; "d_x"; "c_y"; "c_x";
|
||||
"b_y"; "b_x"; "o_x"]
|
||||
and zeros = ["a_x"; "a_y"; "o_y"];;
|
||||
|
||||
wu simson vars zeros;;
|
||||
|
||||
38
Погребицкий Евгений/simson.rkt
Normal file
38
Погребицкий Евгений/simson.rkt
Normal file
@@ -0,0 +1,38 @@
|
||||
#lang racket/base
|
||||
|
||||
(define (square x) (* x x))
|
||||
|
||||
(define (lengths_eq x1 y1 x2 y2 x3 y3)
|
||||
(if (equal? (+ (square(- x1 x2)) (square(- y1 y2))) (+ (square(- x3 x1)) (square(- y3 y1))))
|
||||
#t #f
|
||||
))
|
||||
|
||||
(define (collinear x1 y1 x2 y2 x3 y3)
|
||||
(if (equal? (* (- x1 x2) (- y2 y3)) (* (- y1 y2) (- x2 x3)))
|
||||
#t #f
|
||||
))
|
||||
|
||||
(define (perpendicular x1 y1 x2 y2 x3 y3 x4 y4)
|
||||
(if (equal? (+ (* (- x1 x2) (- x3 x4)) (* (- y1 y2) (- y3 y4))) 0 )
|
||||
#t #f
|
||||
))
|
||||
|
||||
|
||||
|
||||
(define (simson o_x o_y a_x a_y b_x b_y c_x c_y d_x d_y e_x e_y f_x f_y g_x g_y)
|
||||
(if (and
|
||||
(lengths_eq o_x o_y a_x a_y b_x b_y)
|
||||
(lengths_eq o_x o_y a_x a_y c_x c_y)
|
||||
(lengths_eq o_x o_y a_x a_y d_x d_y)
|
||||
(collinear e_x e_y b_x b_y c_x c_y)
|
||||
(collinear f_x f_y a_x a_y c_x c_y)
|
||||
(collinear g_x g_y a_x a_y b_x b_y)
|
||||
(perpendicular b_x b_y c_x c_y d_x d_y e_x e_y)
|
||||
(perpendicular a_x a_y c_x c_y d_x d_y f_x f_y)
|
||||
(perpendicular a_x a_y b_x b_y d_x d_y g_x g_y))
|
||||
|
||||
(begin (displayln "3 Points lie on one line.") (collinear e_x e_y f_x f_y g_x g_y)
|
||||
) (displayln "3 Points do not lie on one line.")
|
||||
))
|
||||
|
||||
(simson 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 )
|
||||
18
Сивочуб Алексей/README.md
Normal file
18
Сивочуб Алексей/README.md
Normal file
@@ -0,0 +1,18 @@
|
||||
# Теорема о квадрате
|
||||
## Ссылка на видеоразбор
|
||||
https://youtu.be/0Yp5sgddlko
|
||||
## Код из сайта
|
||||
START_INTERACTIVE;;
|
||||
let coordinations =
|
||||
["perpendicular", (** Lines (1,2) and (3,4) are perpendicular **)
|
||||
<<(1_x - 2_x) * (3_x - 4_x) + (1_y - 2_y) * (3_y - 4_y) = 0>>;
|
||||
"lengths_eq", (** Lines (1,2) and (3,4) have the same length **)
|
||||
<<(1_x - 2_x)^2 + (1_y - 2_y)^2 = (3_x - 4_x)^2 + (3_y - 4_y)^2>>;
|
||||
"is_midpoint", (** Point 1 is the midpoint of line (2,3) **)
|
||||
<<2 * 1_x = 2_x + 3_x /\ 2 * 1_y = 2_y + 3_y>>];;
|
||||
#Square theorem
|
||||
|
||||
(grobner_decide ** originate)
|
||||
<<is_midpoint(m,a,c) /\ perpendicular(a,c,m,b)
|
||||
==> lengths_eq(a,b,b,c)>>;;
|
||||
END_INTERACTIVE;
|
||||
35
Сивочуб Алексей/square.rkt
Normal file
35
Сивочуб Алексей/square.rkt
Normal file
@@ -0,0 +1,35 @@
|
||||
#lang racket/base
|
||||
|
||||
(define (square x) (* x x))
|
||||
|
||||
(define (lengths_eq x1 y1 x2 y2 x3 y3 x4 y4)
|
||||
(if (equal? (+ (square(- x1 x2)) (square(- y1 y2)))
|
||||
(+ (square(- x3 x4)) (square(- y3 y4))))
|
||||
(displayln "Lines (1,2) and (3,4) have the same length.")
|
||||
(displayln "Lines (1,2) and (3,4) do not have the same length.")))
|
||||
|
||||
(define (perpendicular x1 y1 x2 y2 x3 y3 x4 y4)
|
||||
(if (equal? (+ (* (- x1 x2) (- x3 x4)) (* (- y1 y2) (- y3 y4))) 0 )
|
||||
#t #f
|
||||
))
|
||||
|
||||
(define (is_midpoint x1 y1 x2 y2 x3 y3)
|
||||
(if (and (equal? (* 2 x1) (+ x2 x3)) (equal? (* 2 y1) (+ y2 y3)))
|
||||
(displayln "Point 1 is the midpoint of line (2,3).")
|
||||
(displayln "Point 1 is not the midpoint of line (2,3).")
|
||||
))
|
||||
|
||||
|
||||
(define (grobner_decide_mid a_x a_y b_x b_y c_x c_y d_x d_y m_x m_y)
|
||||
(if (and (is_midpoint m_x m_y a_x a_y c_x c_y)
|
||||
(perpendicular a_x a_y c_x c_y m_x m_y b_x b_y))
|
||||
(begin
|
||||
(lengths_eq a_x a_y b_x b_y b_x b_y c_x c_y)
|
||||
(displayln "This is a square.")
|
||||
)
|
||||
(displayln "This is not a square.")
|
||||
))
|
||||
|
||||
|
||||
|
||||
(grobner_decide_mid 0 0 0 2 2 2 2 0 1 1)
|
||||
Reference in New Issue
Block a user