4

I created a formula that I hope creates a finite straight line between any two points, I wanted to know if my math logic is correct or if I have an error in my formula. The idea is to create a straight line at y=1 between two points and then use that intersection to multiply by any other formula to get the part of the formula that fits within the bounds of my defined limit.

Here is the formula that I created: $$\ln\left(\sqrt{9-x^2}*2\right)-\ln\left(\exp\left(\frac{\ln\left(\left(9-x^2\right)^2\right)}{4}\right)*2\right)+1$$

please note that the 9 can be any number and the square root of that number will be the endpoints of the line, so in the example above I am hoping to get a line between -3 and 3 exclusive.

Can you please tell me if my logic is correct and if this will always return just a positive line at y=1 between two defined endpoints. if not can you please tell me where the issue is.

Thank you for your help!

Thank you all for your feedback. just to clarify why I am doing this, I would like to, using a standard math formula get any section of another formula without the need to to use absolute value, or other math functions like MOD. I would like to be able to create a standard math function that I can insert into any other formula and get a subsection of the formula using standard math.

Thank you and sorry if it is confusing or if I am making things more complicated than they have to be.

My idea is only the first part will be invalid if $9-x^2$ is negative, and the rest of the logic will always be the exact same value without the value returning square root of a negative number so that it does not cancel out. and finally add a one so that if x is within the limit then the value is always 1 to later be able to multiply by any other formula.

My apologies again if I am making things way too complicated for my self.


I now understand what the feedback meant about it being too complicated. her is what I think the formula should be; $$\ln\left(\sqrt{9-x^2}\right)-\frac{\ln\left(\left(9-x^2\right)^2\right)}{4}+1$$

I believe this will be simpler and since $\ln\left(\sqrt{9-x^2}\right)$ does not allow x > 3 but $\frac{\ln\left(\left(9-x^2\right)^2\right)}{4}$ does allow x > 3 then this simpler function can be used to get any slice of a graph.

Please let me know if this is not correct.

Thank you, all again.

  • I think you wanted e^{...}. But why so complicated? – Andrei Dec 22 '20 at 17:47
  • 1
    This is very confusing. The straight line between points $(x_1,y_1)$ and $(x_2,y_2)$ is simply $$y-y_1=\frac{y_2-y_1}{x_2-x_1}(x-x_1)$$ – K.defaoite Dec 22 '20 at 17:48
  • Thank you K defaoite, the reason I created the formula is because I was hoping that the only variable will be x, but in your example you need to know x and x1 and compute y and y1 if I am not mistaken, sorry if i miss understood – Hazem Lotfy Dec 22 '20 at 17:54
  • @HazemLotfy In K.defaoite's example, $x_1,x_2,y_1,y_2$ are not variables; they are known constants. The only variables are $x$ and $y$. Now, since you want the line to have a constant $y$ value of $1$, we would have $y_1=y_2=1$, so the formula would simplify to $y-1 = 0$, which is to say $y=1$. – Théophile Dec 22 '20 at 18:05
  • I just edited your question slightly to make the formula clearer, but I didn't change the meaning. The main change I made was to include the $\exp$, which acts a more concise way of writing $e^x$. $\exp(x)$ is the same as $e^x$, and it can often be easier to read when the exponent has a lot of terms in it. – Robert Howard Dec 22 '20 at 18:13
  • "square root of that number will be the endpoints of the line" $3$ and $-3$ are not the endpoints of the line. The endpoints are $(3,1)$ and $(-3,1)$. $3$ and $-3$ are the $x$ values of the the endpoints. And the standard formula k.defaoite mentions will apply: The equation of the line is $y -1 = \frac {1-1}{3-(-3)}(x-(-3)$ which simplifies to $y = 1$. That's the equation. – fleablood Dec 22 '20 at 18:32

3 Answers3

3

This is absurdly complicated. The simple way would be to write: $$y=1,\quad -3<x<3.$$

But if your goal is just to find a function that implies the domain rather than explicitly writing out $-3<x<3$, then you could do something like $$y = \frac{\sqrt{9-x^2}}{\sqrt{9-x^2}},$$ which is much simpler than what you have.

Théophile
  • 24,627
  • Sorry if I am misunderstanding but, in the formula that you have i think the value is always 1 because if we divide by the same thing then they cancel each other out – Hazem Lotfy Dec 22 '20 at 18:04
  • @HazemLotfy That is exactly right. This is based on your description: "The idea is to create a straight line at $y=1$ between two points." – Théophile Dec 22 '20 at 18:06
  • Thank you Theophile. I will review the formula above. – Hazem Lotfy Dec 22 '20 at 18:09
  • "But if your goal is just to find a function that implies the domain rather than explicitly writing out −3<x<3" I think it should be pointed out, there is really no need to find such a function. It is enough and is perfectly acceptable to simple say $-3\le x \le 3$. – fleablood Dec 22 '20 at 18:58
  • Thanks again fleablood, you are absolutely right, but my problem is most graphing calculators and graphing web pages do not have a way to input the range. I was hoping that with this it will be part of the function it self. Thank you. – Hazem Lotfy Dec 23 '20 at 16:16
  • @HazemLotfy Incidentally, if you want to draw a different line segment (or even a curve such as a parabola, etc.) on that interval ($-3<x<3$), let's say $y=10x+7$, then all you need to do is multiply: $$y = \frac{\sqrt{9-x^2}}{\sqrt{9-x^2}}(10x+7)$$ since the first part cancels out to $1$ but restricts the domain. – Théophile Dec 23 '20 at 17:13
  • Thanks Theophile, I see your point now. – Hazem Lotfy Dec 23 '20 at 18:53
1

One helpful clarification you could make is to describe the graph you want to create as a line segment, not just a line. A line, strictly speaking, has no endpoints, but a line segment does.

The formula you gave does indeed create a line segment at $y=1$ between $x=-\sqrt{a}$ and $x=\sqrt{a}$, so your logic is correct. The way you've written the formula is slightly redundant, though. For example, the $\ln$ and the $e$ in the second term cancel each other out. With a couple other simplifications, your formula can be reduced to $$\ln\left(\sqrt{a-x^2}\right)-\ln\left(\sqrt{a-x^2}\right)+1$$

As you might have already figured out, the fact that this function isn't defined for $-\sqrt{a}<x<\sqrt{a}$ means that even though the first two terms look like they should cancel each other out completely, they still affect the final result. That's pretty cool!


For a more general approach to plotting a function with restricted domain, check out this question and my answer to it. Essentially, for any function $f(x)$, you can plot a modified version (call it $g(x)$) that looks like this: $$g(x)=f(x)\sqrt{\frac{||x-b|-a|}{|x-b|-a}}$$ This will plot the portion of $f(x)$ centered at $x=b$ that is $a$ units wide in either direction.

1

This is rather extremely complicated almost to a ludicrous extreme.

$\ln$ and $\exp$ are inverses so you can simplify this to:

$\ln\left(\sqrt{9-x^2}\right)-\ln\left(\exp\left(\frac{\ln\left(\left(9-x^2\right)^2\right)}{4}\right)\right)+1$

$\ln\left(\sqrt{9-x^2}\right)-\left(\frac{\ln\left(\left(9-x^2\right)^2\right)}{4}\right)+1=$

$\frac 12 \ln(9-x^2) - \frac {2\ln (9-x^2)}4 + 1 =$

$\frac 12 \ln (9-x^2) - \frac 12 \ln (9-x^2) + 1=$

$1$.

....

From what I can figure you have the equation of the line to begin with: $y=1$. So the line is simply all the points $(x, 1)$.

To get the equation from any two endpoints $(-3,1)$ and $(3,1)$ you really should just use the simple equation.

Endpoint 1: is $(x_1, y_1) = (3, 1)$. Endpoint 2: is $(x_2, y_2) = (-3,1)$. Slope is $m = \frac {y_2 - y_1}{x_2 - x_1} = \frac {1-1}{3-(-3)} = \frac 0 6 = 0$.

And the formula is $y - y_1 = m(x - x_1)$ or

$y - 1 = 0(x-3)$ or

$y - 1= 0$ or

$y = 1$.

That's it that's the equation of the line. Which you knew from the very beginning.

fleablood
  • 124,253
  • Thank you Fleablood, I updated the formula to multiple by 2 so that the ln and exp do not cancel out. One question to you please, you say ln((9-x^2)^2)/4 is the same as ln((9-x^2)^.5) but if x was 4 the first one will return a positive number while the other one will be invalid because of a negative square root. Thank you – Hazem Lotfy Dec 22 '20 at 18:44
  • Then use absolute values. $\frac {\ln((9-x^2)^2)}{4} = \frac 12 \ln |9-x^2|$. But notice your first term is $\ln (\sqrt{9-x^2})$ is undefined if $|x| > 3$. This is still proposterously convoluted though. If your goal was to restrict it entirely to points between the end points then... just say that. the formula is $y = 1; -3 \le x \le 3$. Easy peasy. And if your end points were $(a,b)$ and $(j,k)$ the formula is $y = \frac{j-a}{k-b}(x-j)-k; a \le x \le b$. No need to create a complicated formula that can only take restricted values in; just say you are restricting values. – fleablood Dec 22 '20 at 18:56
  • Thanks fleablood – Hazem Lotfy Dec 22 '20 at 18:59