# Thread: solving a diffusion pde

1. ## solving a diffusion pde

Hallo everyone

Please may I ask for some tips to help me solving this question.

I have this equation:

$\displaystyle \frac{\partial^2t}{\partial{x^2}}+\frac{\partial^2 t}{\partial{y^2}}=-2$

this equation needs to be solved using the conditions where $\displaystyle t(x,y)=0$ with diffusion between circles $\displaystyle x^2+y^2=1$ and $\displaystyle x^2+y^2=e^2$

we assume we can solve with form $\displaystyle t(x,y)=f(z)$ with $\displaystyle z=x^2+y^2$

how can first equation with conditions now be written as:
$\displaystyle z\frac{d^2{f}}{d{z^2}}+\frac{df}{dz}=-0.5,$ $\displaystyle \left\{\begin{array}{cc}f(1)=0,\\f(e^2)=0, \end{array}\right.$

if someone can please give me tip with how i work out $\displaystyle \frac{df}{dz}$ (because i am confuse thinking what this means) maybe I can give question a go!

Thank you

2. Hi jescavez
Originally Posted by jescavez
I have this equation:

$\displaystyle \frac{\partial^2t}{\partial{x^2}}+\frac{\partial^2 t}{\partial{y^2}}=-2$

this equation needs to be solved using the conditions where $\displaystyle t(x,y)=0$ with diffusion between circles $\displaystyle x^2+y^2=1$ and $\displaystyle x^2+y^2=e^2$

we assume we can solve with form $\displaystyle t(x,y)=f(z)$ with $\displaystyle z=x^2+y^2$

how can first equation with conditions now be written as:
$\displaystyle z\frac{d^2{f}}{d{z^2}}+\frac{df}{dz}=-0.5,$ $\displaystyle \left\{\begin{array}{cc}f(1)=0,\\f(e^2)=0, \end{array}\right.$

if someone can please give me tip with how i work out $\displaystyle \frac{df}{dz}$ (because i am confuse thinking what this means) maybe I can give question a go!

We have the equation $\displaystyle \frac{\partial^2t}{\partial{x^2}}+\frac{\partial^2 t}{\partial{y^2}}=-2$ and we want to replace $\displaystyle x$ and $\displaystyle y$ by $\displaystyle z=x^2+y^2$ so we need to compute $\displaystyle \frac{\partial^2t}{\partial{y^2}}=\frac{\partial^2 f}{\partial{y^2}}$ and $\displaystyle \frac{\partial^2t}{\partial{x^2}}=\frac{\partial^2 f}{\partial{x^2}}$ in terms of $\displaystyle f''(z)$ and $\displaystyle f'(z)$. Let's start with $\displaystyle \frac{\partial t(x,y)}{\partial x}=\frac{\partial f(z)}{\partial x}$ :

The chain rule states that $\displaystyle \big( v\circ u\big) ' = u'\cdot v'\circ u$ hence $\displaystyle \frac{\partial f(z)}{\partial x}=\frac{\partial z}{\partial x}\cdot f'(z)=2x f'(z)$

Let's differentiate $\displaystyle f$ a second time with respect to $\displaystyle x$ :

\displaystyle \begin{aligned} \frac{\partial ^2 f(z)}{\partial x^2}&=\frac{\partial }{\partial x}\Big[2x f'(z)\Big]\\ &=2f'(z)+2x\frac{\partial f'(z)}{\partial x} \end{aligned}

Now what is $\displaystyle \frac{\partial f'(z)}{\partial x}$ ? Again, let's use the chain rule :

$\displaystyle \frac{\partial f'(z)}{\partial x}=\frac{\partial z}{\partial x}\cdot f''(z)=2xf''(z)$

hence $\displaystyle \frac{\partial ^2 f(z)}{\partial x^2}=2f'(z)+4x^2f''(z)$

Following this idea you can compute $\displaystyle \frac{\partial ^2 t}{\partial y^2}= \frac{\partial ^2 f}{\partial y^2}$. Substituting $\displaystyle \frac{\partial ^2 t}{\partial y^2}$ and $\displaystyle \frac{\partial ^2 t}{\partial y^2}$ by their expressions in terms of $\displaystyle f''(z)$ and $\displaystyle f'(z)$ in the differential equation will give you the equation $\displaystyle zf''(z)+f'(z)=-1/2$ you're looking for.

Hope it helps !

3. Thank you flying squirrel that was a great explanation I have it now.

May I to clarify one other point? It is very relate to this, I have equation:

$\displaystyle t(x,y)=\frac{1}{2}(1-(x^2+y^2))+\frac{1}{4}(e^2-1)log(x^2+y^2)$

I see that $\displaystyle (1-(x^2+y^2))=0$ and $\displaystyle (e^2-1)=0$ and $\displaystyle log(x^2+y^2)=2$ and I think it is trying to say $\displaystyle t(x,y)=0$ but I don't understand why the $\displaystyle \frac{1}{2}$ and $\displaystyle \frac{1}{4}$ are need or must to be there as I think they are multiplying by 0 anyway?

Thank you and sorry for extra question!

4. Originally Posted by jescavez
May I to clarify one other point? It is very relate to this, I have equation:

$\displaystyle t(x,y)=\frac{1}{2}(1-(x^2+y^2))+\frac{1}{4}(e^2-1)log(x^2+y^2)$

I see that $\displaystyle (1-(x^2+y^2))=0$ and $\displaystyle (e^2-1)=0$ and $\displaystyle log(x^2+y^2)=2$ and I think it is trying to say $\displaystyle t(x,y)=0$ but I don't understand why the $\displaystyle \frac{1}{2}$ and $\displaystyle \frac{1}{4}$ are need or must to be there as I think they are multiplying by 0 anyway?
I'm not sure to understand what you mean : if one replaces $\displaystyle \frac{1}{2}$ by say $\displaystyle 42$, the new function is not a solution of our problem anymore :

We know that the solutions of $\displaystyle zf''(z)+f'(z)=-\frac{1}{2}$ are $\displaystyle A\ln z-\frac{1}{2}z+B$. The two constants $\displaystyle A$ and $\displaystyle B$ are obtained with the two following conditions

$\displaystyle \begin{cases} f(1)=0\\ f(e^2)=0 \end{cases} \implies\begin{cases} 1\ln 1-\frac{1}{2}\cdot 1+B=0\\ A\ln e^2-\frac{1}{2}e^2+B=0 \end{cases} \implies \begin{cases} B=\displaystyle\frac{1}{2}\\ A=\displaystyle\frac{1-e^2}{4{\color{red}\ln e}} \end{cases}$

Changing the value of $\displaystyle A$ or the value $\displaystyle B$ makes at least one of the these conditions become false : the function with the new value of $\displaystyle A$ or $\displaystyle B$ can't be a solution of this problem.

EDIT : If $\displaystyle e=\exp 1$ don't take into account what I wrote in red.

5. Ah, ok I did not realise the solution would take this form. please could you explain me where $\displaystyle A\ln z-\frac{1}{2}z+B$ come from?
Thank you.

6. Originally Posted by jescavez
Ah, ok I did not realise the solution would take this form. please could you explain me where $\displaystyle A\ln z-\frac{1}{2}z+B$ come from?
I thought you'd solved it.

Let $\displaystyle y=f'(z)$.

The differential equation $\displaystyle zf''(z)+f'(z)=-\frac{1}{2}$ can be written $\displaystyle zy'+y=-\frac{1}{2} \implies y'=-\frac{1}{z}\left(y+\frac{1}{2}\right) \Longleftrightarrow \left( y+\frac{1}{2}\right)'=-\frac{1}{z}\left( y+\frac{1}{2}\right)$

This is a first-order ODE which solutions are $\displaystyle y+\frac{1}{2}=\exp\left(\int -\frac{\mathrm{d}u}{u}\right)=\exp\left(-\ln z + C \right)=\frac{A}{z}$. Thus $\displaystyle f'(z)=\frac{A}{z}-\frac{1}{2}$ which gives us $\displaystyle f(z)=A\ln z-\frac{1}{2}z+B$ when integrated.

7. Thanks flying squirrel. What is that technique called?

a couple of Qs. why in:

$\displaystyle zy'+y=-\frac{1}{2} \implies y'=-\frac{1}{z}\left(y+\frac{1}{2}\right) \Longleftrightarrow \left( y+\frac{1}{2}\right)'=-\frac{1}{z}\left( y+\frac{1}{2}\right)$

does the implied bit work?
and I'm not quite sure how you get to:

$\displaystyle y+\frac{1}{2}=\exp\left(\int -\frac{\mathrm{d}u}{u}\right)$

(And last question, hopefully, sorry!)For this bit:

$\displaystyle \begin{cases} f(1)=0\\ f(e^2)=0 \end{cases} \implies\begin{cases} 1\ln 1-\frac{1}{2}\cdot 1+B=0\\ A\ln e^2-\frac{1}{2}e^2+B=0 \end{cases} \implies \begin{cases} B=\displaystyle\frac{1}{2}\\ A=\displaystyle\frac{e^2-1}{4{\color{red}\ln e}} \end{cases}$
we are adding the solutions right to get to final equation? then what happens to the $\displaystyle -\frac{1}{2}e^2+B$ part of $\displaystyle f(e^2)$? we do not seem to use it?

Thank you again.

8. Originally Posted by jescavez
What is that technique called?
I don't think it has a name.

why in:

$\displaystyle zy'+y=-\frac{1}{2} \implies y'=-\frac{1}{z}\left(y+\frac{1}{2}\right) \Longleftrightarrow \left( y+\frac{1}{2}\right)'=-\frac{1}{z}\left( y+\frac{1}{2}\right)$

does the implied bit work?
I don't understand what you mean

and I'm not quite sure how you get to:

$\displaystyle y+\frac{1}{2}=\exp\left(\int -\frac{\mathrm{d}u}{u}\right)$

(And last question, hopefully, sorry!)
There is no need to apologize each time you ask a question.
For this bit:

$\displaystyle \begin{cases} f(1)=0\\ f(e^2)=0 \end{cases} \implies\begin{cases} 1\ln 1-\frac{1}{2}\cdot 1+B=0\\ A\ln e^2-\frac{1}{2}e^2+B=0 \end{cases} \implies \begin{cases} B=\displaystyle\frac{1}{2}\\ A=\displaystyle\frac{e^2-1}{4{\color{red}\ln e}} \end{cases}$
we are adding the solutions right to get to final equation? then what happens to the $\displaystyle -\frac{1}{2}e^2+B$ part of $\displaystyle f(e^2)$? we do not seem to use it?
We do use this term :

\displaystyle \begin{aligned} A\ln e^2-\frac{1}{2}e^2+B=0 &\implies A\ln e^2-\frac{1}{2}e^2+\frac{1}{2}=0\\ &\implies 2A\ln e = \frac{e^2-1}{2}\\ &\implies A=\frac{e^2-1}{4\ln e}\\ \end{aligned}

If you want to do this by subtracting one equation to the other :

\displaystyle \begin{aligned} \begin{cases} 1\ln 1-\frac{1}{2}\cdot 1+B=0 & (1)\\ A\ln e^2-\frac{1}{2}e^2+B=0 &(2) \end{cases} &\implies (2)-(1) : A\ln e^2-\frac{1}{2}e^2+\frac{1}{2}=0\\ &\implies A=\frac{\frac{1}{2}e^2-\frac{1}{2}}{2\ln e}\\ &\implies A=\frac{e^2-1}{4\ln e} \end{aligned}

9. Originally Posted by flyingsquirrel

I don't understand what you mean
I mean the $\displaystyle y'$ going to $\displaystyle y' + \frac{1}{2}$ without anything else changing. I don't understand why that is ok to do (I see that once differentiated the 1/2 goes but I would have thought you can say same about any constant...)

Thank you

10. Originally Posted by jescavez
I mean the $\displaystyle y'$ going to $\displaystyle y' + \frac{1}{2}$ without anything else changing. I don't understand why that is ok to do (I see that once differentiated the 1/2 goes but I would have thought you can say same about any constant...)
Yes, it would also have been right with any other constant. Choosing $\displaystyle \frac{1}{2}$ allows one to write the differential equation $\displaystyle \left(y+\frac{1}{2}\right)'=-\frac{1}{z}\left(y+\frac{1}{2}\right)$ as $\displaystyle Y'=-\frac{Y}{z}$ with $\displaystyle Y=y+\frac{1}{2}$. I found this interesting since the equation in terms of $\displaystyle Y$ is a little bit easier to solve than $\displaystyle zy'+y=-\frac{1}{2}$ : with the notations used in the link given in my previous post, for the equation $\displaystyle Y'=-\frac{Y}{z}$ we have $\displaystyle q(z)=0$ hence $\displaystyle Y$ is simply $\displaystyle \frac{C}{u(z)}$ whereas for the equation $\displaystyle zy'+y=-\frac{1}{2}$ we have $\displaystyle q(z)=-\frac{1}{2z}$ so one has to compute $\displaystyle y=-\frac{\int \frac{1}{2z} u(z)\,\mathrm{d}z+C'}{u(z)}$ ...