C
C
Coltex2018-04-08 20:32:02
C++ / C#
Coltex, 2018-04-08 20:32:02

Finding on the graph the value of Y, knowing X. How can it be implemented?

Good evening. Let's say I build a graph (connect 3 points). Manually, if I need to find the value of Y, knowing the value of X, I simply find it at the intersection with the graph. How can this be done in a C# program? Not good at programming
5aca51d9c228c429134079.jpeg

Answer the question

In order to leave comments, you need to log in

3 answer(s)
A
Alexander, 2018-04-08
@Coltex

If all points are known - then the shape of the graph between each two points can be considered a straight line - that is, a line - the value is found through a linear equation.
neighboring points [x1,y1] and [x2,y2] are known, we find the coefficients of the linear equation:
(y2-y1)/(x2-x1)=a
y1-x1*a=b
we substitute here
y=x*a+b
we consider desired value between these two points.
in programming, you only need to find which points to take in order to find the desired value - by looping through an array with points.
If 2 points are too rough, then you can build a curve for every 3 points - it will be more accurate, but more difficult.

D
d-stream, 2018-04-08
@d-stream

https://en.wikipedia.org/wiki/%D0%90%D0%BF%D0%BF%D...
en-wiki.org/wiki/%D0%98%D0%BD%D1%82% D0%B5%D1%80%D0...
https://en.wikipedia.org/wiki/%D0%9C%D0%B5%D1%82%D...

I
Igor, 2018-04-09
@assembled

If the function is known, then y = f ( x )

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question