mirror of
https://github.com/TheAlgorithms/Python.git
synced 2024-11-28 07:21:07 +00:00
Merge branch 'master' of https://github.com/daniel-s-ingram/PythonAlgorithms
This commit is contained in:
commit
a872085183
|
@ -8,6 +8,8 @@ method 2:
|
||||||
"Simpson Rule"
|
"Simpson Rule"
|
||||||
|
|
||||||
'''
|
'''
|
||||||
|
from __future__ import print_function
|
||||||
|
|
||||||
|
|
||||||
def method_2(boundary, steps):
|
def method_2(boundary, steps):
|
||||||
# "Simpson Rule"
|
# "Simpson Rule"
|
||||||
|
@ -41,7 +43,7 @@ def main():
|
||||||
steps = 10.0 #define number of steps or resolution
|
steps = 10.0 #define number of steps or resolution
|
||||||
boundary = [a, b] #define boundary of integration
|
boundary = [a, b] #define boundary of integration
|
||||||
y = method_2(boundary, steps)
|
y = method_2(boundary, steps)
|
||||||
print 'y = {0}'.format(y)
|
print('y = {0}'.format(y))
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
main()
|
main()
|
||||||
|
|
|
@ -7,6 +7,7 @@ method 1:
|
||||||
"extended trapezoidal rule"
|
"extended trapezoidal rule"
|
||||||
|
|
||||||
'''
|
'''
|
||||||
|
from __future__ import print_function
|
||||||
|
|
||||||
def method_1(boundary, steps):
|
def method_1(boundary, steps):
|
||||||
# "extended trapezoidal rule"
|
# "extended trapezoidal rule"
|
||||||
|
@ -39,7 +40,7 @@ def main():
|
||||||
steps = 10.0 #define number of steps or resolution
|
steps = 10.0 #define number of steps or resolution
|
||||||
boundary = [a, b] #define boundary of integration
|
boundary = [a, b] #define boundary of integration
|
||||||
y = method_1(boundary, steps)
|
y = method_1(boundary, steps)
|
||||||
print 'y = {0}'.format(y)
|
print('y = {0}'.format(y))
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
main()
|
main()
|
||||||
|
|
|
@ -35,4 +35,4 @@ if __name__ == '__main__':
|
||||||
n = int(sys.argv[1])
|
n = int(sys.argv[1])
|
||||||
print(sum_of_primes(n))
|
print(sum_of_primes(n))
|
||||||
except ValueError:
|
except ValueError:
|
||||||
print('Invalid entry - please enter a number.')
|
print('Invalid entry - please enter a number.')
|
||||||
|
|
|
@ -83,7 +83,7 @@ __Properties__
|
||||||
|
|
||||||
###### View the algorithm in [action][shell-toptal]
|
###### View the algorithm in [action][shell-toptal]
|
||||||
|
|
||||||
### Time-Compexity Graphs
|
### Time-Complexity Graphs
|
||||||
|
|
||||||
Comparing the complexity of sorting algorithms (Bubble Sort, Insertion Sort, Selection Sort)
|
Comparing the complexity of sorting algorithms (Bubble Sort, Insertion Sort, Selection Sort)
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
from __future__ import print_function
|
||||||
|
|
||||||
import sys
|
import sys
|
||||||
'''
|
'''
|
||||||
Dynamic Programming
|
Dynamic Programming
|
||||||
|
|
Loading…
Reference in New Issue
Block a user