Skip to content

Commit adf90cb

Browse files
committed
Update README.md
1 parent 0c40c6c commit adf90cb

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

README.md

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ Bisection Method is a root finding method that solves the form: f(x) = 0.
2424

2525
The current low guess, high guess, tol, and N for demonstration is (1, 2, 10^-5, 100) respectively
2626
* Note these can be changed under:
27-
```
27+
```python
2828
# globals
2929
TOL = 10**-5
3030
A = 1
@@ -34,13 +34,13 @@ N = 100
3434

3535
The current fucntion for demonstration is: f(x) = x^3 - x - 2
3636
* Note this can be changed under:
37-
```
37+
```python
3838
def f(x):
3939
return (math.pow(x,3) - x - 2)
4040
```
4141

4242
Run from command line:
43-
```
43+
```python
4444
$ ./bisection.py
4545
Bisection method soln: x = 1.52138519287
4646
```
@@ -52,7 +52,7 @@ The Fixed-Point Iteration Method finds the root of an equation in the form: x =
5252

5353
The current approx, tol, and N for demonstration is (4.6, 10^-4, 100) respectively
5454
* Note these can be changed under:
55-
```
55+
```python
5656
# globals
5757
APPROX = 4.6
5858
TOL = 10**-4
@@ -61,13 +61,13 @@ N = 100
6161

6262
The current fucntion for demonstration is: f(x) = (1/tan(x))- (1/x) + x
6363
* Note this can be changed under:
64-
```
64+
```python
6565
def f(x):
6666
return (1/math.tan(x)) - (1/x) + x
6767
```
6868

6969
Run from command line:
70-
```
70+
```python
7171
$ ./fixedPoint.py
7272
Fixed point solution: x = 4.49340945791
7373
```
@@ -78,7 +78,7 @@ The Newton's Method finds the root of an equation: x : f(x) = 0
7878

7979
The current approx, tol, and N for demonstration is (4.6, 10^-4, 100) respectively
8080
* Note these can be changed under:
81-
```
81+
```python
8282
# globals
8383
APPROX = 0.1
8484
TOL = 10**-5
@@ -87,20 +87,20 @@ N = 100
8787

8888
The current fucntion for demonstration is: f(x) = (1 + x)^204 - 440x - 1
8989
* Note this can be changed under:
90-
```
90+
```python
9191
def f(x):
9292
return math.pow((1+x),204)-440*x-1
9393
```
9494

9595
For Newton's Method we also need to know f'(x). Currently, f'(x) = 204*(1 + x)^203 - 440
9696
* Note that this MUST be changed when f(x) is changed. Do this under:
97-
```
97+
```python
9898
def fprime(x):
9999
return 204*math.pow((x+1),203) - 440
100100
```
101101

102102
Run from command line:
103-
```
103+
```python
104104
$ ./newtons.py
105105
Newton's Method soln: x = 0.00681932148758
106106
```
@@ -112,7 +112,7 @@ The Newton's Method finds the root of an equation: x : f(x) = 0. Considered an
112112

113113
The current approx, tol, and N for demonstration is (4.6, 10^-4, 100) respectively
114114
* Note these can be changed under:
115-
```
115+
```python
116116
# globals
117117
APPROX = 0.1
118118
TOL = 10**-5
@@ -121,13 +121,13 @@ N = 100
121121

122122
The current fucntion for demonstration is: f(x) = (1 + x)^204 - 440x - 1
123123
* Note this can be changed under:
124-
```
124+
```python
125125
def f(x):
126126
return math.pow((1+x),204)-440*x-1
127127
```
128128

129129
Run from command line:
130-
```
130+
```python
131131
$ ./secant.py
132132
Secant method soln: x = 0.00681932406799
133133
```

0 commit comments

Comments
 (0)