# Non-homogenous ODE, non-homogenous boundaries

I've made a lot of simplifications to a Joule-heating problem I'm working on. I'm struggling to solve the following one-dimensional, one variable ODE:

Txx + aT = -b

with boundary conditions

T(x=0) = Ts (Dirichlet)
Tx(x=L) = 0 (Neumann)

I've learned that this is a non-homogeneous ODE with non-homogenous boundaries. I've tried using FDM to solve them and then fitting the data to a function, but I didn't get far.

I would love some help on this. I have much more experience with numerical analysis than analytical. I really need a math-wiz's help.

Related Differential Equations News on Phys.org
I apologize for being to lazy to work out where this really comes from, but here's the solution Mathematica gives:

$$T(x)\to \frac{1}{a}\left(-b \cot \left(\sqrt{a} L\right) \sin \left(\sqrt{a} x\right)+b \csc \left(\sqrt{a} L\right) \sin \left(\sqrt{a} x\right)+b \cos \left(\sqrt{a} x\right)-a T_s \cot \left(\sqrt{a} L\right) \sin \left(\sqrt{a} x\right)+a T_s \cos \left(\sqrt{a} x\right)-b\right)$$

I apologize for being to lazy to work out where this really comes from, but here's the solution Mathematica gives:

$$T(x)\to \frac{1}{a}\left(-b \cot \left(\sqrt{a} L\right) \sin \left(\sqrt{a} x\right)+b \csc \left(\sqrt{a} L\right) \sin \left(\sqrt{a} x\right)+b \cos \left(\sqrt{a} x\right)-a T_s \cot \left(\sqrt{a} L\right) \sin \left(\sqrt{a} x\right)+a T_s \cos \left(\sqrt{a} x\right)-b\right)$$
pmsrw3, very close!!! Please see the following two plots:

The equation you gave models the homogenous boundary problem exactly, which is:

Txx + aT = -b, T(x=0) = Ts, T(x=L) = 0 (first plot)

What I need is the solution to the NON-homogenous boundary problem:

Txx + aT = -b, T(x=0) = Ts, Tx(x=L) = 0 (second plot)

the difference being that the x=L boundary is Neumann, not Dirichlet.

Can you do what you did again with this Newmann boundary???

Almost there!

#### Attachments

• 17.5 KB Views: 401
• 20 KB Views: 411
Oops, sorry. I must have left out a '.

$$T(x)\to \frac{(a T_s+b) \sec \left(\sqrt{a} L\right) \cos \left(\sqrt{a} (L-x)\right)-b}{a}$$

I simultaneously found the solution. The form is

T(x) = C1*cos(sqrt(a)*x) + C2*sin(sqrt(a)*x) - b/a

where C1 = Ts + b/a, C2 = C1*tan(sqrt(a)*L)

Your solution looks like it takes this form after some trig flexing.

Thanks!

#### Attachments

• 20.2 KB Views: 408
What do you get when a is negative?

The same result will work. $\sqrt{a}$ is imaginary, but it all works out real in the end. $\cos(i\alpha) = \cosh(\alpha), \sec(i\alpha) = \text{sech}(\alpha)$.

If you want it written in terms of explicitly real functions: Letting alpha = -a, assuming alpha > 0, and solving $T''(x)-\alpha T(x)=-b$, I get

$$T(x)\to \frac{e^{\sqrt{\alpha } (-x)} \left(\alpha T_s \left(e^{2 \sqrt{\alpha } L}+e^{2 \sqrt{\alpha } x}\right)-b \left(e^{\sqrt{\alpha } x}-1\right) \left(e^{\sqrt{\alpha } x}-e^{2 \sqrt{\alpha } L}\right)\right)}{\alpha \left(e^{2 \sqrt{\alpha } L}+1\right)}$$

pmsrw3: Last one...

Quickly, can you do:

y'' = 0
y'(x=0) = inf
y(x=L) = a

I don't know if this is possible.

Thanks!!

I don't need to run that one -- it obviously doesn't have a solution. y'' = 0 says y' is the same everywhere. y' is infinite at 0, so it's infinite everywhere. Obviously this does not have a finite solution.

I FDM'ed this too and I agree. For some reason it wasn't obvious to me at first. Thanks.