
Security News
CISA’s 2025 SBOM Guidance Adds Hashes, Licenses, Tool Metadata, and Context
CISA’s 2025 draft SBOM guidance adds new fields like hashes, licenses, and tool metadata to make software inventories more actionable.
Using Newton-Raphson or Secant methods, and within an arbitrary error:
The Newton-Raphson requires:
The Secant method requires:
If the estimates are not "close enough" (and what that means depends on f(x, a, b, ...)), the methods may not converge to a solution.
This may also happen for a "low" number of iterations and/or a "low" error limit.
When no convergence is possible on the set conditions, a NoConvergenceError
is raised.
Add this line to your application's Gemfile:
gem 'rical'
And then execute:
$ bundle
Or install it yourself as:
$ gem install rical
fx1 = -> (x) { x**2 - 2 }
dfx1 = -> (x) { 2*x }
or set function(s) as Proc
fx2 = Proc.new do |x, a, b|
a*x**2 + b
end
dfx2 = Proc.new do |x, a|
2*a*x
end
or set function(s) as existing method(s)
def f3(x, a:, b:)
a*x**2 + b
end
fx3 = method(:f3)
root_for
of inverse_for
passing function(s) and estimate(s):Newton-Raphson's Method
Rical.root_for f: fx1, df: dfx1, x0: 1.0, method: :newton_raphson # :newton_raphson aliased to :n, :newton
Rical.inverse_for f: fx1, df: dfx1, x0: 1.0, y: 2.0, method: :newton
# with fargs and dfargs
Rical.root_for f: fx2, fargs: [1, -2], df: dfx2, dfargs: 2, x0: 1.0, method: :newton
Rical.root_for f: fx3, fargs: { a: 1, b: -2 }, df: dfx3, dfargs: { a: 2 }, x0: 1.0, method: :newton
Secant's Method
Rical.root_for f: fx, x0: 0.0, x1: 1.0, method: :secant # :secant aliased to :sec, :s
Rical.inverse_for f: fx, x0: 0.0, x1: 1.0, y: 2.0, method: :secant
# with fargs and dfargs
Rical.inverse_for f: fx, fargs: [1, -2], x0: 0.0, x1: 1.0, y: 2.0, method: :secant
Rical.root_for f: fx, ......, num: 1e3, err: 1e-12 # defaults num: 100, err: 1e-6
Rical.inverse_for f: fx, ......, num: 1e3, err: 1e-12 # defaults num: 100, err: 1e-6
git checkout -b my-new-feature
)git commit -am 'Add some feature'
)git push origin my-new-feature
)FAQs
Unknown package
We found that rical demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
CISA’s 2025 draft SBOM guidance adds new fields like hashes, licenses, and tool metadata to make software inventories more actionable.
Security News
A clarification on our recent research investigating 60 malicious Ruby gems.
Security News
ESLint now supports parallel linting with a new --concurrency flag, delivering major speed gains and closing a 10-year-old feature request.