6
$\begingroup$

Is there an equation that, given the two points of a line segment, will result, when graphed for x on a real graph, in a line segment?

$\endgroup$
3
  • $\begingroup$ Just out of curiosity ... why would you want to represent a line segment as the graph of a real-valued function?? $\endgroup$
    – bubba
    Commented Sep 24, 2013 at 4:44
  • $\begingroup$ I really only asked this question to answer it. If you'll notice, I both asked and answered this. I wanted to put this equation somewhere, so I figured I would share it with this wonderful community. :) $\endgroup$
    – Steven
    Commented Sep 24, 2013 at 17:38
  • $\begingroup$ Put restrictions on the domain. For example: $\{-7<x<7\}$ will graph a line segment from $-7 $ to $7$. If you want the line to go vertically, use $y$ instead of $x$. $\endgroup$
    – user204449
    Commented Jan 2, 2015 at 22:39

8 Answers 8

8
$\begingroup$

Around a year or so ago I came up with an equation that, when graphed on a real graph, graphs a line segment. It does so by making the numbers which are not a part of the segment imaginary, thus unable to be graphed on a real graph. The equation is as follows: $$y=\frac{(B-D)\left(\sqrt{x-A}\sqrt{|x-A|}-\sqrt{C-x}\sqrt{|C-x|}-x\right)+AB-CD}{A-C}$$ where (A,B) is the left-most point and (C,D) is the right-most point (that is, where $C > A$.) $$y \in \begin{cases} \ \mathbb{R} & \iff A \le x \le C,\\ \ \mathbb{I} & \text{otherwise} \end{cases}$$ So, in English, $y$ will be real if and only if $x$ is between $A$ and $C$; otherwise, it will be imaginary. Say for example I wanted to graph a segment from (-4,3) to (5,6). In that case, the equation becomes $$y=\frac{(3-6)\left(\sqrt{x+4}\sqrt{|x+4|}-\sqrt{5-x}\sqrt{|5-x|}-x\right)-(-4\bullet3)-(5\bullet6)}{-4-6}$$ which results in the following: $$\text{when}\; x=-5,\; y=3+\frac{1}{3}i;\; x=-4,\; y=3;\; x=5,\; y=6;\; x=6,\; y=6-\frac{1}{3}i$$ I have no clue for what, if anything, this could be used. I just thought I would share it since it was doing me no good. Anyway, thank you in advance for any positive feedback or constructive criticism.

$\endgroup$
7
  • 1
    $\begingroup$ This is dramatic overkill for pretty much any application I can imagine but is admittedly a pretty neat way to implicitly define the domain. $\endgroup$ Commented Sep 24, 2013 at 0:36
  • $\begingroup$ What your definition is doing is the following: you are assuming $x$ is complex-valued and graphing the pair $(x,y)$ when both coordinates are real-valued. You might object that you are only considering real $x$, but I disagree; your expression is working over the complex numbers, otherwise $\sqrt{x-A}\sqrt{|x-A|}$ is better expressed as $\sqrt{x-A}^2$; if $x-A$ is negative then $\sqrt{x-A}$ is not defined, and so the expression cannot proceed. $\endgroup$ Commented Sep 24, 2013 at 0:40
  • $\begingroup$ More to the point, there is no particularly good reason to prefer $x$ to be "unrestricted" across all of $\mathbb{C}$ (the complex numbers) or even all of $\mathbb{R}$. This is the significance of the domain of a function. Some domain requirements are technical: there is no consistent way to define $\frac00$, so $\frac xx$ is not well-defined at $x=0$. On the other hand, you may explicitly impose restrictions on a domain tell a function to only consider certain values of $x$, even if it "wants to" look at a larger set. $\endgroup$ Commented Sep 24, 2013 at 0:44
  • 2
    $\begingroup$ Not that this isn't interesting, but I always feel like absolute values are "cheating", in these questions. The obvious answer to these questions is to define a function piecewise, but that's unsatisfactory - what we want is something "defined by a formula". But the absolute value function is itself defined piecewise, so we've really just hidden the piecewisedness of the definition under the rug. Of course, in this case there really is no "pure formula" for the desired function, so a solution involving absolute values is still of interest. $\endgroup$
    – Jack M
    Commented Jan 2, 2015 at 23:52
  • 1
    $\begingroup$ I was just trying to graph an arm for my snowman and you blew my damn mind. $\endgroup$
    – Gary
    Commented Dec 4, 2015 at 5:49
3
$\begingroup$

Thinking in another way from the answer from Steven Fontaine, you can use any function that is only defined for some $x\in\Bbb R$ but not other $x$'s.

For example, since $\arcsin x$ is only defined for $[-1,1]$, you can write

$$y = mx + c + \arcsin x - \arcsin x$$

to "capture" the piece of straight line between $[-1,1]$. By adjusting the domain of $\arcsin (m'x+c')$ using $m'$ and $c'$, you can then "capture" any non-vertical finite segment.

Similarly, you may use $\sqrt{x}$ or $\ln{x}$ to graph a ray, the former includes the starting point and the latter does not.

$\endgroup$
3
$\begingroup$

An expression I found that works very well is

$$\frac{-(x-b_1)(x-b_2)}{\sqrt{-(x-b_1)(x-b_2)}^2}$$

This works well as it is equal to 1 and can be inserted into any function in the form $y=mx+b.

The way that I constructed this expression was by realizing that a square root function is only real for x values where $\sqrt{x}$ is positive.

Then I realized that since a quadratic has 2 zeroes that I could use a binomial to insert the values where I want the limits to be.

$\endgroup$
2
$\begingroup$

Or you can just use vectors. $(x,y,z)+t\langle a,b,c\rangle$.

That is to say, for a line going from point $(1,1,1)$ to the point $(21,21,21)$, the equation would be $r(t)=(1,1,1)+t\langle 1,1,1\rangle$ such that $0<t<21$

$\endgroup$
1
$\begingroup$

enter image description here

Let me explain how this works. First ill explain what enter image description heredoes, what is going on is that if x is less than a x-a will always be negative so the square root of x-a when it is negative would be undefined so it can't be graphed.multiplying the square root of x-a by enter image description herejust makes x, x again after it finds out if it is undefined or not. The plus b is just so the line starts at b as y instead of 0 as y. The enter image description hereis so that if x is greater than the set ending point of c it will be negative then be undefined meaning that point can't be graphed.The enter image description hereis just the slope of the line using (y2-y1)/(x2-x1).

$\endgroup$
1
$\begingroup$

A very simple way to do this would be to add and then subtract the square roots of an expression to define the domain. For example:

Given $(3,34)$ and $ (5, 52)$, first find the equation for the line that goes between the two points:

$(52-34)/(5-3)x + b = y$

$y = 9x + b$

$34 = 9(3) + b$

$b = 7$

Therefore, the equation of the line is: $y = 9x + 7$

To restrict the domain to $[3, 5]$ start by adding and subtracting $\sqrt(x-3)$. The equation becomes:

$y = 9x + 7 + \sqrt{x-3}- \sqrt{x-3}$

To restrict the upper part of the domain, add and subtract √(-x+5). The final equation becomes:

$y = 9x + 7 + \sqrt{x-3} - \sqrt{x-3} + \sqrt{-x+5} - \sqrt{-x+5}$

Hope this helps!

$\endgroup$
1
$\begingroup$

I got a rather simple answer here.

I've recently been playing around with shapes on a graphing calculator using this technique I came up with. It has a similar concept with what Harish Chandra Rajpoot posted above but I think I should share this.

Let's just take the equation x=y on a plane, and we want to cut that line to make it a line segment from (-1,-1) to (2,2).

First we remove everything from x=-1 and below by multiplying any side of the equation by √(x+1)/√(x+1). This just multiplies the equation by one and also makes the equation indeterminate whenever x < -1.

Now we got x = y * √(x+1)/√(x+1)

Next step is to remove everything from x=2 and above by multiplying any of the sides by √(-x+2)/√(-x+2). It does the same thing but makes the equation indeterminate whenever x > 2.

Finally, we have x = y * √(x+1)/√(x+1) * √(-x+2)/√(-x+2)

I hope I helped out someone out there.

$\endgroup$
0
$\begingroup$

I made a pretty simple and straightforward equation that can be used to limit any function:

For example: https://i.sstatic.net/pqgOx.png

here sqrt(2) is the lower bound of the function f(x)=x²+4 and 2 is the upper bound.

Keep in mind that sqrt(2) and 2 are not in the domain of f(x)

If you do want them in the domain of your function you can simply do: https://i.sstatic.net/X42S4.png

$\endgroup$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .