Takes a set of inputs that is sufficient information to infer a line and then returns information not provided (either the slope, an x point on the line, or a y point on the line)
Value
A named vector with the missing information from the line:
If m
and x2
are provided, y2
will be returned
If m
and y2
are provided, x2
will be returned
If x2
and y2
are provided, but neither x3
nor
y3
are provided, m
will be returned
If x2
and y2
are provided and one of x3
or
y3
are provided, the other (y3
or x3
) will be
returned
Details
Note that there is no requirement that
x1
< x2
< x3
: the points can be in any order
along the line.
solve_linear
works with vectors of all inputs to solve
multiple lines at once, where the i
th element of each
argument corresponds to the i
th output. Note that all
lines must be missing the same information. Input vectors
will be recycled as necessary.