r/ScientificComputing • • 9d ago

Can someone help me verify the numerical solution of an oscillatory boundary value problem?

Post image

I'm developing a numerical equation solver, and I've recently been testing its ability to solve boundary value problems.

One of my test cases is:

0.001y''(x)+xy(x)=2

with boundary conditions:

y(0)=1, y(1)=2

over the interval [0,1].

My solver produces a strongly oscillatory solution, as shown in the attached screenshot.

However, I'd like to independently verify that the solution is correct, particularly the oscillations and their amplitudes.

I tried entering the problem into WolframAlpha, but couldn't obtain a solution. It's possible I'm not using the correct syntax.

Has anyone solved a similar problem using Mathematica, MATLAB, SciPy, or another numerical tool?

I'd be particularly interested in comparing numerical values at a few points along the interval, rather than just the overall shape of the plot.

Any help or suggestions for validating this solution would be greatly appreciated!

3 Upvotes

3 comments sorted by

1

u/[deleted] 9d ago

[removed] — view removed comment

1

u/Vasg 9d ago

I tried your tip on WolframAlpha, but it did not work. Did you write a code to get a solution? If yes, could you share it with me?