Skip to content

Commit

Permalink
x = x + h -> x += h
Browse files Browse the repository at this point in the history
  • Loading branch information
fusion809 committed Sep 5, 2020
1 parent 3071b16 commit b5d0db9
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions src/Rectangle.jl
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ function rectangle_rule_left(f::Function, N::Number, a::Number, b::Number)
x = a;
for i=1:N
y += h*f(x)
x = x + h;
x += h;
end
return y
end
Expand All @@ -35,7 +35,7 @@ function rectangle_rule_midpoint(f::Function, N::Number, a::Number, b::Number)
x = a+h/2;
for i=1:N
y += h*f(x)
x = x + h;
x += h;
end
return y
end
Expand All @@ -56,7 +56,7 @@ function rectangle_rule_right(f::Function, N::Number, a::Number, b::Number)
x = a+h;
for i=1:N
y += h*f(x)
x = x + h;
x += h;
end
return y
end
4 changes: 2 additions & 2 deletions src/Simpson.jl
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ function simpsons_rule(f::Function, N::Number, a::Number, b::Number)
for i=1:N+1
y = y + stepwise_simpsons(f, h, x, i, N);
if i < N+1
x = x + h;
x += h;
end
end
return y
Expand All @@ -59,7 +59,7 @@ function simpsons38_rule(f::Function, N::Number, a::Number, b::Number)
for i=1:N+1
y = y + stepwise_simpsons38(f, h, x, i, N);
if i < N+1
x = x + h;
x += h;
end
end
return y
Expand Down
2 changes: 1 addition & 1 deletion src/Trapezoidal.jl
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ function trapezoidal_rule(f::Function, N::Number, a::Number, b::Number)
for i=1:N+1
y = y + stepwise_trapezoidal(f, h, x, i, N);
if i < N+1
x = x + h;
x += h;
end
end
return y
Expand Down

0 comments on commit b5d0db9

Please sign in to comment.