# Applying Dirichlet and Neumann Boundary Condition for DSolve and NDSolve not computing [closed]

I'm interesting in solving this problem where I have a Dirichlet boundary condition at $\ x=0, u(x)=1$ and a Neumann boundary condition where at $\ x=25, du/dx=0$

I was able to get it to work when having 2 Dirichlet boundary conditions $\ x=0, u(x)=1$ and $\ x=25, u(x)=0$ and wanted to compare if I would get a similar answer if I applied a Neumann boundary condition instead. I was also interested in comparing both answers with DSolve and NDSolve.

Here is my code. Am I setting up the NeumannValue function incorrectly?

Clear["Global`*"]

k = 0.25;
diffCo = 1*10^-6;

bc1 = DirichletCondition[u[x] == 1, x == 0];
bc2 = NeumannValue[0, x == 25];

eqn = diffCo*u''[x] - k*u[x] == 0;

solDSolve = u[x] /. First@DSolve[{eqn, bc1, bc2}, u[x], {x, 0, 25}]

solNDSolve =
NDSolve[{eqn, bc}, u, {x, 0, 25},
Method -> {"FiniteElement", MeshOptions -> MaxCellMeasure -> 0.001}]

I get the error

DSolve::deqn: Equation or list of equations expected instead of NeumannValue[0.,x==25] in the first argument {-0.25 u[x]+(u^\[Prime]\[Prime])[x]/1000000==0,{u[0]==1},NeumannValue[0.,x==25]}.

and

NDSolve::deqn: Equation or list of equations expected instead of bc in the first argument {-0.25 u[x]+(u^\[Prime]\[Prime])[x]/1000000==0,bc}.

Any help is greatly appreciated. Thank you!

## closed as off-topic by xzczd, Henrik Schumacher, MarcoB, Coolwater, gwrJun 7 '18 at 10:36

This question appears to be off-topic. The users who voted to close gave this specific reason:

• "This question arises due to a simple mistake such as a trivial syntax error, incorrect capitalization, spelling mistake, or other typographical error and is unlikely to help any future visitors, or else it is easily found in the documentation." – xzczd, Henrik Schumacher, MarcoB, Coolwater, gwr
If this question can be reworded to fit the rules in the help center, please edit the question.

• NeumannValue has to be a part of equation eqn. See similar examples in documentation for this symbol. – Pinti Jun 6 '18 at 7:29
• And zero NeumannValue doesn't need to be set actually. It's the default value. – xzczd Jun 6 '18 at 7:58
• @Pinti @xzczd Ohhh. I completely missed that when looking at the examples. Thank you! Although, now I'm getting an error saying RowReduce::luc: Result for RowReduce of badly conditioned matrix {{1.,1.,-1.},{-1.042188348916432*10^-5426,2.398798645752719*10^5431,0.}} may contain significant numerical errors. What is causing this and how do I to resove this? – AhWee Jun 6 '18 at 21:31