Hello, this may be a simple question (haven’t seen DE in a while) or misunderstanding.

Using the test u(x) = x^2, without loss of generality the question states that g(x) and gamma(x) are given, and I can see that on the boundaries x=a and x=b gamma is defined as gamma = u = x^2, which for a=0 and b=2, gamma(0)=0 and gamma(2)=4.

How is g(x) found given u(x) here? Are we simply deriving g(x) ourselves using u(x) and the combinations of p, q, and r and then using the derived g(x) in our finite difference method? I remember in lectures you mentioning that we shouldn’t be calculating derivatives ourselves because it’s expensive, but I’m assuming for the sake of testing our finite difference method with the actual solutions (u=x^2, u=x^3, u=exp(x)) and comparing error values we’re allowed to do this?