Instantly share code, notes, and snippets.

Last active March 7, 2023 22:16
Integrals
View gist:c0d9b4aa350d7db8ed6d28af364a86c6
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
 $\int{f(x) g'(x) \ dx} = fg - \int{ g(x) f'(x) \ dx}$ $\int{cos^2x \ dx} = \int{cos \ x \ cos \ x \ dx} = \int{cos \ x \ (sin \ x)' \ dx} = cos \ x \ sin \ x - \int{sin \ x \ (cos \ x)' \ dx} = cos \ x \ sin \ x - \int{sin \ x \ sin \ x \ dx} = cos \ x \ sin \ x - \int{sin^2 \ x \ dx} = sin\ x \ cos \ x + \int{sin^2 \ x \ dx} = sin\ x \ cos \ x + \int{ (1 - cos^2 \ x) \ x \ dx} = sin\ x \ cos \ x + \int{ 1 \ dx} - \int{ cos^2 \ x \ dx} = sin\ x \ cos \ x + x - \int{ cos^2 \ x \ dx} => \int \cos ^2x\,dx=\frac{x+\sin x\cos x}{2}+C.$
Created March 6, 2023 12:28
View hexa2DecGCD.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
 def hexaGCD( x, y, z): def pow2(a,b): p = 1 for i in range(1,b+1): p = p * a return p
Last active February 23, 2023 08:05
Heap, malloc, algorithm sorting, free, pointers to functions
View pointerToFn.c
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
 #include #include #define fin "algsort.in" typedef int (*ptr2)(const int a,const int b); typedef void (*ptr1)(int*, int, ptr2); int comp(int a, int b) {
Created February 16, 2023 18:26
View sqrt_babylonian.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
 # # Square Root Babylonian Method # @Adrian Statescu # def sqrt_babylonian(n): x = n y = 1.0 eps = 0.000001 while x - y > eps: x = (x + y) / 2
Created February 16, 2023 18:21
View sqrt_babylonian.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
 # # Square Root Babylonian Method # @Adrian Statescu # def sqrt_babylonian(n) x = n y = 1.0 e = 0.000001 while x - y > e x = (x + y) / 2
Created June 13, 2022 20:55
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
 #include #include typedef struct Node { int data; struct Node *next; } Node; Node *head = NULL;
Created June 1, 2021 16:20
View decorators.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
 def make_bold(f): def bold_wrapper(): return "" + f() +"" return bold_wrapper def make_italic(f): def italic_wrapper(): return "" + f() + "" return italic_wrapper
Created May 28, 2021 08:46