Skip to main content
1-Visitor
October 4, 2011
Question

graphing vertical line automatically

  • October 4, 2011
  • 6 replies
  • 6820 views

Working on a larger worksheet a ran into a problem. I couldn't solve. I've broken it down to a simpler problem.

The simple task is, to find the equation und graph a line given by to points. While finding the equation works fine, even with vertical lines, I experience problems to graph automatically, if the line is vertical.

See attached worksheet (MC14 filed as MC11)

Any ideas are welcome any maybe there are better ideas for achieving the equation, too.

Regards

WR

6 replies

24-Ruby IV
October 4, 2011

>The simple task is, to find the equation [and graph] a line given by two points.

Only in Mathcad Prime:

Lsolve-Prime.png

24-Ruby IV
October 4, 2011

While finding the equation works fine, even with vertical lines

Try please the operator on eror in Mathcad ** and the operator try in Mathcad Prime.

rag1-VisitorAuthor
1-Visitor
October 4, 2011

Thanks for trying, but first I don't use Prime (looks to me more like a preview version, lacking of symbolics, etc.).

I have played around with onerror, but it didn't worked out. Think, it is not intended to be used with symbolic expressions/evaluations. I can't catch an undefined function with it or an error in a function definition.

The main goal is that a linear equation is given in the Mathcad-usual form with the boolean equal sign. This equation could have the form y=a.x+b OR x=c and I want to graph it in both cases (and failed to graph it in the latter case). Any solutions are welcome.

On former occasions I often was searching for a possibility to manage part or all of an equation. E.g. extracting the lefthand or righthand side and assign it to a variable or applying an operation (e.g. adding the same term) on both sides of an equation. It would also have been helpful sometimes if I could transform an euqation or another mathematical term into a textstring, manipulate it there and transform it back. I guess, that these kinds of operations are not available in Mathcad because for MC an equation is a simple boolean expression which is subject to be evaluated, but not to be manipulated in the aforementioned ways. If that assumption is wrong and i simply missed the right way, please tell me.

Regards

WR

23-Emerald I
October 4, 2011

How precise do you have to be?

rag1-VisitorAuthor
1-Visitor
October 4, 2011

Thank you, Fred, think that was a helpful answer..

In your worksheet I don't see the vertical g(x) plotted, unless I change your 10^-15 up to 10^-5, which is still optically precise enough. Unfortunately in the original context there ist more than one equation which should be plotted and could be vertical and the equations are derived from a more complex situation. So it would be a lot more work to apply your approximation, but I think it could be done.

What I need/want are the exact(=symbolically) derived equations, but for graphing purpose an approximation like yours will suffice.

It would be helpful if there were a way to evaluate the boolean expression Eq and then decide, what to do, but it seems that this is not possible. I am thinking of something like "if LeftHandSideOf(Eq) is x then ..." or "if Eq is not solvable to y then ...". But it seems that this is beyond the possibilities of MC.

Thanks for your effort

WR

12-Amethyst
October 5, 2011

Winford,

I gave it a try, any closer to what you want?

1-Visitor
October 6, 2011

winfrod rager wrote:

Working on a larger worksheet a ran into a problem. I couldn't solve. I've broken it down to a simpler problem.

The simple task is, to find the equation und graph a line given by to points. While finding the equation works fine, even with vertical lines, I experience problems to graph automatically, if the line is vertical.

See attached worksheet (MC14 filed as MC11)

Any ideas are welcome any maybe there are better ideas for achieving the equation, too.

Regards

WR

Maybe so:

23-Emerald I
October 7, 2011

One last effort.

rag1-VisitorAuthor
1-Visitor
October 13, 2011

Thanks for all the helpful answers and the time you all have put in. I now have the choice among at least three different approches (Wayne's matrix, Fred's approximation, which seems to works now and what looks like a very interesting elegant way introduced by Vyacheslav). I'll be playing around abit with those an we'll see what I can come up with.

Thanks to all of you

WR