Liking cljdoc? Tell your friends :D

emmy.rational-function


->expressionclj/s

(->expression r vars)

Accepts a [[RationalFunction]] r and a sequence of symbols for each indeterminate, and emits the canonical form of the symbolic expression that represents [[RationalFunction]] r.

NOTE: this is the output stage of Rational Function canonical form simplification. The input stage is handled by expression->.

NOTE See analyzer for an instance usable by emmy.expression.analyze/make-analyzer.

Accepts a [[RationalFunction]] `r` and a sequence of symbols for each indeterminate,
and emits the canonical form of the symbolic expression that
represents [[RationalFunction]] `r`.

NOTE: this is the output stage of Rational Function canonical form
simplification. The input stage is handled by [[expression->]].

NOTE See [[analyzer]] for an instance usable
by [[emmy.expression.analyze/make-analyzer]].
sourceraw docstring

absclj/s

(abs r)

If the numerator of r is negative, returns (negate r), else acts as identity.

If the numerator of `r` is negative, returns `(negate r)`, else acts as
identity.
sourceraw docstring

addclj/s

(add r s)

Returns the sum of rational functions r and s, with appropriate handling of [[RationalFunction]], [[polynomial/Polynomial]] or coefficients of neither type on either side.

Returns the sum of rational functions `r` and `s`, with appropriate handling
of [[RationalFunction]], [[polynomial/Polynomial]] or coefficients of neither
type on either side.
sourceraw docstring

analyzerclj/s

Singleton [[a/ICanonicalize]] instance.

Singleton [[a/ICanonicalize]] instance.
sourceraw docstring

arg-scaleclj/s

(arg-scale r factors)

Given some [[RationalFunction]] r, returns a new [[RationalFunction]] generated by substituting each indeterminate x_i for f_i * x_i, where f_i is a factor supplied in the factors sequence.

Given a non-[[RationalFunction]], delegates to polynomial/arg-scale.

Given some [[RationalFunction]] `r`, returns a new [[RationalFunction]]
generated by substituting each indeterminate `x_i` for `f_i * x_i`, where
`f_i` is a factor supplied in the `factors` sequence.

Given a non-[[RationalFunction]], delegates to [[polynomial/arg-scale]].
sourceraw docstring

arg-shiftclj/s

(arg-shift r shifts)

Given some [[RationalFunction]] r, returns a new [[RationalFunction]] generated by substituting each indeterminate x_i for s_i + x_i, where s_i is a shift supplied in the shifts sequence.

Given a non-[[RationalFunction]], delegates to polynomial/arg-shift.

Given some [[RationalFunction]] `r`, returns a new [[RationalFunction]]
generated by substituting each indeterminate `x_i` for `s_i + x_i`, where
`s_i` is a shift supplied in the `shifts` sequence.

Given a non-[[RationalFunction]], delegates to [[polynomial/arg-shift]].
sourceraw docstring

arityclj/s

(arity r)

Returns the declared arity of the supplied [[RationalFunction]] or [[polynomial/Polynomial]], or 0 for arguments of other types.

Returns the declared arity of the supplied [[RationalFunction]]
or [[polynomial/Polynomial]], or `0` for arguments of other types.
sourceraw docstring

coeff?clj/s

(coeff? x)

Returns true if x is explicitly not an instance of [[RationalFunction]] or [[polynomial/Polynomial]], false if it is.

Returns true if `x` is explicitly _not_ an instance of [[RationalFunction]]
or [[polynomial/Polynomial]], false if it is.
sourceraw docstring

cubeclj/s

(cube r)

Returns the cube of rational function r. Equivalent to (mul r (mul r r)).

Returns the cube of rational function `r`. Equivalent to `(mul r (mul r r))`.
sourceraw docstring

divclj/s

(div r s)

Returns the quotient of rational functions r and s, with appropriate handling of [[RationalFunction]], [[polynomial/Polynomial]] or coefficients of neither type on either side.

Returns the quotient of rational functions `r` and `s`, with appropriate
handling of [[RationalFunction]], [[polynomial/Polynomial]] or coefficients of
neither type on either side.
sourceraw docstring

eqclj/s

(eq this that)

Returns true if the [[RationalFunction]] this is equal to that. If that is a [[RationalFunction]], this and that are equal if they have equal u and v and equal arity. u and v entries are compared using emmy.value/=.

If that is non-[[RationalFunction]], eq only returns true if u and v respectively match the [[ratio/numerator]] and [[ratio/denominator]] of that.

Returns true if the [[RationalFunction]] this is equal to `that`. If `that` is
a [[RationalFunction]], `this` and `that` are equal if they have equal `u` and
`v` and equal arity. `u` and `v` entries are compared
using [[emmy.value/=]].

If `that` is non-[[RationalFunction]], `eq` only returns true if `u` and `v`
respectively match the [[ratio/numerator]] and [[ratio/denominator]] of
`that`.
sourceraw docstring

evaluateclj/s

(evaluate r xs)

Given some rational function xs and a sequence of arguments with length >= 0 and < the arity of r, returns the result of evaluating the numerator and denominator using xs and re-forming a rational function with the results.

Supplying fewer arguments than the arity will result in a partial evaluation. Supplying too many arguments will error.

Given some rational function `xs` and a sequence of arguments with length >= 0
and < the [[arity]] of `r`, returns the result of evaluating the numerator and
denominator using `xs` and re-forming a rational function with the results.

Supplying fewer arguments than the arity will result in a partial evaluation.
Supplying too many arguments will error.
sourceraw docstring

expression->clj/s

(expression-> expr)
(expression-> expr cont)
(expression-> expr cont v-compare)

Converts the supplied symbolic expression expr into Rational Function canonical form (i.e., a [[RationalFunction]] instance). expr should be a bare, unwrapped expression built out of Clojure data structures.

Returns the result of calling continuation cont with the [[RationalFunction]] and the list of variables corresponding to each indeterminate in the [[RationalFunction]]. (contdefaults to vector).

The second optional argument v-compare allows you to provide a Comparator between variables. Sorting indeterminates by v-compare will determine the order of the indeterminates in the generated [[RationalFunction]]. The list of variables passed to cont will be sorted using v-compare.

Absorbing an expression with expression-> and emitting it again with ->expression will generate the canonical form of an expression, with respect to the operations in the [[operators-known]] set.

This kind of simplification proceeds purely symbolically over the known Rational Function operations; other operations outside the arithmetic available should be factored out by an expression analyzer (see emmy.expression.analyze/make-analyzer) before calling expression->.

NOTE that cont might receive a scalar, fraction or [[polynomial/Polynomial]] instance; both are valid 'rational functions'. The latter as a rational function with a denominator equal to 1, and the former 2 result from non-polynomial numerator and denominator.

NOTE See analyzer for an instance usable by emmy.expression.analyze/make-analyzer.

Converts the supplied symbolic expression `expr` into Rational Function
canonical form (i.e., a [[RationalFunction]] instance). `expr` should be a bare,
unwrapped expression built out of Clojure data structures.

Returns the result of calling continuation `cont` with
the [[RationalFunction]] and the list of variables corresponding to each
indeterminate in the [[RationalFunction]]. (`cont `defaults to `vector`).

The second optional argument `v-compare` allows you to provide a Comparator
between variables. Sorting indeterminates by `v-compare` will determine the
order of the indeterminates in the generated [[RationalFunction]]. The list of
variables passed to `cont` will be sorted using `v-compare`.

Absorbing an expression with [[expression->]] and emitting it again
with [[->expression]] will generate the canonical form of an expression, with
respect to the operations in the [[operators-known]] set.

This kind of simplification proceeds purely symbolically over the known
Rational Function operations; other operations outside the arithmetic
available should be factored out by an expression
analyzer (see [[emmy.expression.analyze/make-analyzer]]) before
calling [[expression->]].

NOTE that `cont` might receive a scalar, fraction or [[polynomial/Polynomial]]
instance; both are valid 'rational functions'. The latter as a rational
function with a denominator equal to `1`, and the former 2 result from
non-polynomial numerator and denominator.

NOTE See [[analyzer]] for an instance usable
by [[emmy.expression.analyze/make-analyzer]].
sourceraw docstring

exptclj/s

(expt r n)

Returns a rational function generated by raising the input rational function r to the (integer) power n.

Returns a rational function generated by raising the input rational function
`r` to the (integer) power `n`.
sourceraw docstring

from-pointsclj/s

(from-points xs)

Given a sequence of points of the form [x, f(x)], returns a rational function that passes through each input point.

Given a sequence of points of the form `[x, f(x)]`, returns a rational function
that passes through each input point.
sourceraw docstring

gcdclj/s

(gcd r s)

Returns the greatest common divisor of rational functions r and s, with appropriate handling of [[RationalFunction]], [[polynomial/Polynomial]] or coefficients of neither type on either side.

Returns the greatest common divisor of rational functions `r` and `s`, with
appropriate handling of [[RationalFunction]], [[polynomial/Polynomial]] or
coefficients of neither type on either side. 
sourceraw docstring

invertclj/s

(invert r)

Given some rational function r, returns the inverse of r, i.e., a rational function with numerator and denominator reversed. The returned rational function guarantees a positive denominator.

Acts as generic/invert for non-[[RationalFunction]] inputs.

Given some rational function `r`, returns the inverse of `r`, i.e., a rational
function with numerator and denominator reversed. The returned rational
function guarantees a positive denominator.

Acts as [[generic/invert]] for non-[[RationalFunction]] inputs.
sourceraw docstring

makeclj/s

(make u v)

Given a numerator u and denominator v, attempts to form a [[RationalFunction]] instance by

  • cancelling out any common factors between u and v
  • normalizing u and v such that v is always positive
  • multiplying u and v through by a commo factor, such that neither term contains any rational coefficients

Returns a [[RationalFunction]] instance if either u or v remains a [[polynomial/Polynomial]] after this process; else, returns (g/div u' v'), where u' and v' are the reduced numerator and denominator.

Given a numerator `u` and denominator `v`, attempts to form
a [[RationalFunction]] instance by

- cancelling out any common factors between `u` and `v`
- normalizing `u` and `v` such that `v` is always positive
- multiplying `u` and `v` through by a commo factor, such that neither term
  contains any rational coefficients

Returns a [[RationalFunction]] instance if either `u` or `v` remains
a [[polynomial/Polynomial]] after this process; else, returns `(g/div u' v')`,
where `u'` and `v'` are the reduced numerator and denominator.
sourceraw docstring

mulclj/s

(mul r s)

Returns the product of rational functions r and s, with appropriate handling of [[RationalFunction]], [[polynomial/Polynomial]] or coefficients of neither type on either side.

Returns the product of rational functions `r` and `s`, with appropriate
handling of [[RationalFunction]], [[polynomial/Polynomial]] or coefficients of
neither type on either side.
sourceraw docstring

negateclj/s

(negate r)

Returns the negation of rational function r, i.e., a [[RationalFunction]] with its numerator negated.

Acts as generic/negate for non-[[RationalFunction]] inputs.

Returns the negation of rational function `r`, i.e., a [[RationalFunction]] with
its numerator negated.

Acts as [[generic/negate]] for non-[[RationalFunction]] inputs.
sourceraw docstring

negative?clj/s

(negative? r)

Returns true if the numerator of r is polynomial/negative?, false otherwise.

Returns true if the numerator of `r` is [[polynomial/negative?]], false
otherwise.
sourceraw docstring

partial-derivativeclj/s

(partial-derivative r i)

Given some [[RationalFunction]] or [[polynomial/Polynomial]] r, returns the partial derivative of r with respect to the ith indeterminate. Throws if i is an invalid indeterminate index for r.

For non-polynomial or rational function inputs, returns 0.

Given some [[RationalFunction]] or [[polynomial/Polynomial]] `r`, returns the
partial derivative of `r` with respect to the `i`th indeterminate. Throws if
`i` is an invalid indeterminate index for `r`.

For non-polynomial or rational function inputs, returns `0`.
sourceraw docstring

partial-derivativesclj/s

(partial-derivatives r)

Returns the sequence of partial derivatives of [[RationalFunction]] (or [[polynomial/Polynomial]]) r with respect to each indeterminate. The returned sequence has length equal to the arity of r.

For non-polynomial or rational function inputs, returns an empty sequence.

Returns the sequence of partial derivatives
of [[RationalFunction]] (or [[polynomial/Polynomial]]) `r` with respect to
each indeterminate. The returned sequence has length equal to the [[arity]] of
`r`.

For non-polynomial or rational function inputs, returns an empty sequence.
sourceraw docstring

rational-function?clj/s

(rational-function? r)

Returns true if the supplied argument is an instance of [[RationalFunction]], false otherwise.

Returns true if the supplied argument is an instance of [[RationalFunction]],
false otherwise.
sourceraw docstring

squareclj/s

(square r)

Returns the square of rational function r. Equivalent to (mul r r).

Returns the square of rational function `r`. Equivalent to `(mul r r)`.
sourceraw docstring

subclj/s

(sub r s)

Returns the difference of rational functions r and s, with appropriate handling of [[RationalFunction]], [[polynomial/Polynomial]] or coefficients of neither type on either side.

Returns the difference of rational functions `r` and `s`, with appropriate
handling of [[RationalFunction]], [[polynomial/Polynomial]] or coefficients of
neither type on either side.
sourceraw docstring

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close