abelsiqueira / playgroundwithgit.jl Goto Github PK
View Code? Open in Web Editor NEWLicense: Other
License: Other
Lines
if a > 0.5
break
end
A docstring is the documentation of the function. You simply have to add a string before the function, for instance:
"""
relu(x)
Rectified Linear Unit returns x if x is positive and 0 otherwise.
"""
function relu(x)
...
end
Currently, we use the bisection method to compute the zero of the function f. Instead, we could implement regula falsi, which is very similar and easy to swap.
A full description is https://en.wikipedia.org/wiki/Regula_falsi but the only part that matters is that instead of
x = (a + b) / 2
we use
x = (a * fb - b * fa) / (fb - fa)
So it isn't called by default.
Create a num_iter = 0
variable, increase it every iteration, and check if num_iter > 100
(for instance). If so, use break
to leave the loop.
Stop the algorithm if either abs(fx)
is small (the implement) case, or if the difference b - a
is small enough.
Create a keyword argument verbose = false
for the loan function and inside the function.
If verbose
, then print the values of a
, b
, f(a)
, and f(b)
each iteration.
To properly format, we can use something like
using Printf
...
@info @sprintf("| %+12.5e | %+12.5e | %+12.5e | %+12.5e |\n", a, b, fa, fb)
We will need to add the package Printf
.
Assuming that interest_rate
is greater than -1, then the equation that defines the relation between the quantities can be manipulated to show that i < monthly_payment / borrowed_amount
. Use this ratio instead of b = 1.0
.
These should be a way to disable on the workflow.
Instead of hard-coding borrowed_amount, number_of_payments, and monthly_payment, make them parameters for the function.
For instance, by creating a new function find_zero(f, a, b)
that returns x such that f(x) is approximately zero.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.