I know [itex]y[/itex] is a function of [itex]x[/itex] [i.e. [itex]y=f\left(x\right)[/itex]] with two known boundary conditions, that is [itex]f\left(x=A\right)=C[/itex] and [itex]f\left(x=B\right)=D[/itex] where [itex]C[/itex] and [itex]D[/itex] are known constants (please see figure). I do not know the form of this function and therefore I am trying to find the form of [itex]y[/itex] as a function of [itex]x[/itex] over the whole interval [itex]A<x<B[/itex]. I have an additional condition that is if I discretize the interval I can obtain the folowing relation [itex]g(A,c)=g(c,d)=g(d,e)=g(e,B)=E[/itex] where [itex]g[/itex] is a known function of the given arguments and [itex]E[/itex] is a known constant. I think this problem can be solved by using the variational principle possibly with the use of Lagrange multipliers. I did some initial attempts but I am not sure about the results. Can you suggest a method (variational or not) that can solve this problem so that we can obtain the form of [itex]y[/itex] as a function of [itex]x[/itex] over the whole interval. Many thanks in advance!