Solving an equation for x, characteristics

102 Views Asked by At

I am trying to plot characteristics on Matlab for a hyperbolic pde.

I need to compute \begin{equation} x=\frac{t}{(1+x^2)}+x_i \end{equation} for every spatial step.

Any help with how to do this?

This is the original question, enter image description here

I have managed to obtain the result above for the characteristics but I'm unsure how I can plot these curves into a plot. I thought I had to rearrange for x and then solve using a linspace for t and x for the initial x values, x_i.

1

There are 1 best solutions below

0
On

$\dfrac{\partial u}{\partial t}+\dfrac{1+x^2}{(1+x^2)^2+2xt}\dfrac{\partial u}{\partial x}=0$

$\left(\dfrac{2xt}{x^2+1}+x^2+1\right)\dfrac{\partial u}{\partial t}+\dfrac{\partial u}{\partial x}=0$

Case $1$: $t\geq0$

Take Laplace transform on $t$ :

$\mathcal{L}_{t\to s}\left\{\left(\dfrac{2xt}{x^2+1}+x^2+1\right)\dfrac{\partial u}{\partial t}\right\}+\mathcal{L}_{t\to s}\left\{\dfrac{\partial u}{\partial x}\right\}=0$

$-\dfrac{\partial}{\partial s}\left(\dfrac{2xsU(x,s)}{x^2+1}-\dfrac{2xu(x,0)}{x^2+1}\right)+(x^2+1)sU(x,s)-(x^2+1)u(x,0)+\dfrac{\partial U(x,s)}{\partial x}=0$

$\dfrac{\partial U(x,s)}{\partial x}-\dfrac{2xs}{x^2+1}\dfrac{\partial U(x,s)}{\partial s}-\dfrac{2xU(x,s)}{x^2+1}+(x^2+1)sU(x,s)=(x^2+1)\prod_{0.2,0.4}(x)$

$\dfrac{\partial U(x,s)}{\partial x}-\dfrac{2xs}{x^2+1}\dfrac{\partial U(x,s)}{\partial s}=\left(\dfrac{2x}{x^2+1}-(x^2+1)s\right)U(x,s)+(x^2+1)\prod_{0.2,0.4}(x)$

Follow the method in http://en.wikipedia.org/wiki/Method_of_characteristics#Example:

$\dfrac{dx}{dr}=1$ , letting $x(0)=0$ , we have $x=r$

$\dfrac{ds}{dr}=-\dfrac{2xs}{x^2+1}=-\dfrac{2rs}{r^2+1}$ , letting $s(0)=s_0$ , we have $s=\dfrac{s_0}{r^2+1}=\dfrac{s_0}{x^2+1}$

$\dfrac{dU}{dr}=\left(\dfrac{2x}{x^2+1}-(x^2+1)s\right)U+(x^2+1)\prod_{0.2,0.4}(x)=\left(\dfrac{2r}{r^2+1}-s_0\right)U+(r^2+1)\prod_{0.2,0.4}(r)$ , letting $U(0)=f(s_0)$ , we have

$U(x,s)=(r^2+1)e^{-s_0r}f(s_0)+(r^2+1)e^{-s_0r}\int_0^r\prod_{0.2,0.4}(p)e^{s_0p}~dp$

$U(x,s)=\begin{cases}(r^2+1)e^{-s_0r}f(s_0)&\text{when}~r\leq0.2\\(r^2+1)e^{-s_0r}f(s_0)+(r^2+1)e^{-s_0r}\dfrac{e^{s_0r}-e^{0.2s_0}}{s_0}&\text{when}~0.2\leq r\leq0.4\\(r^2+1)e^{-s_0r}f(s_0)+(r^2+1)e^{-s_0r}\dfrac{e^{0.4s_0}-e^{0.2s_0}}{s_0}&\text{when}~r\geq0.4\end{cases}$

$U(x,s)=\begin{cases}(x^2+1)e^{-(x^2+1)xs}f((x^2+1)s)&\text{when}~x\leq0.2\\(x^2+1)e^{-(x^2+1)xs}f((x^2+1)s)+\dfrac{1-e^{(0.2-x)(x^2+1)s}}{s}&\text{when}~0.2\leq x\leq0.4\\(x^2+1)e^{-(x^2+1)xs}f((x^2+1)s)+\dfrac{e^{(0.4-x)(x^2+1)s}-e^{(0.2-x)(x^2+1)s}}{s}&\text{when}~x\geq0.4\end{cases}$

$u(0,t)=0$ , i.e. $U(0,s)=0$ :

$f(s)=0$

$\therefore U(x,s)=\begin{cases}0&\text{when}~x\leq0.2\\\dfrac{1-e^{(0.2-x)(x^2+1)s}}{s}&\text{when}~0.2\leq x\leq0.4\\\dfrac{e^{(0.4-x)(x^2+1)s}-e^{(0.2-x)(x^2+1)s}}{s}&\text{when}~x\geq0.4\end{cases}$

$u(x,t)=\begin{cases}\mathcal{L}^{-1}_{s\to t}\{0\}&\text{when}~x\leq0.2\\\mathcal{L}^{-1}_{s\to t}\left\{\dfrac{1-e^{(0.2-x)(x^2+1)s}}{s}\right\}&\text{when}~0.2\leq x\leq0.4\\\mathcal{L}^{-1}_{s\to t}\left\{\dfrac{e^{(0.4-x)(x^2+1)s}-e^{(0.2-x)(x^2+1)s}}{s}\right\}&\text{when}~x\geq0.4\end{cases}$

$u(x,t)=\begin{cases}0&\text{when}~x\leq0.2\\1-H((0.2-x)(x^2+1)+t)&\text{when}~0.2\leq x\leq0.4\\H((0.4-x)(x^2+1)+t)-H((0.2-x)(x^2+1)+t)&\text{when}~x\geq0.4\end{cases}$

Case $2$: $t\leq0$

Let $\begin{cases}x_1=x\\t_1=-t\end{cases}$ ,

Then $\dfrac{\partial u}{\partial x}=\dfrac{\partial u}{\partial x_1}\dfrac{\partial x_1}{\partial x}+\dfrac{\partial u}{\partial t_1}\dfrac{\partial t_1}{\partial x}=\dfrac{\partial u}{\partial x_1}$

$\dfrac{\partial u}{\partial t}=\dfrac{\partial u}{\partial x_1}\dfrac{\partial x_1}{\partial t}+\dfrac{\partial u}{\partial t_1}\dfrac{\partial t_1}{\partial t}=-\dfrac{\partial u}{\partial t_1}$

$\therefore-\left(-\dfrac{2x_1t_1}{x_1^2+1}+x_1^2+1\right)\dfrac{\partial u}{\partial t_1}+\dfrac{\partial u}{\partial x_1}=0$

$\left(\dfrac{2x_1t_1}{x_1^2+1}-x_1^2-1\right)\dfrac{\partial u}{\partial t_1}+\dfrac{\partial u}{\partial x_1}=0$

Take Laplace transform on $t_1$ :

$\mathcal{L}_{t_1\to s_1}\left\{\left(\dfrac{2x_1t_1}{x_1^2+1}-x_1^2-1\right)\dfrac{\partial u}{\partial t_1}\right\}+\mathcal{L}_{t_1\to s_1}\left\{\dfrac{\partial u}{\partial x_1}\right\}=0$

$-\dfrac{\partial}{\partial s_1}\left(\dfrac{2x_1s_1U(x_1,s_1)}{x_1^2+1}-\dfrac{2x_1u(x_1,0)}{x_1^2+1}\right)-(x_1^2+1)s_1U(x_1,s_1)+(x_1^2+1)u(x_1,0)+\dfrac{\partial U(x_1,s_1)}{\partial x_1}=0$

$\dfrac{\partial U(x_1,s_1)}{\partial x_1}-\dfrac{2x_1s_1}{x_1^2+1}\dfrac{\partial U(x_1,s_1)}{\partial s_1}-\dfrac{2x_1U(x_1,s_1)}{x_1^2+1}-(x_1^2+1)s_1U(x_1,s_1)=-(x_1^2+1)\prod_{0.2,0.4}(x_1)$

$\dfrac{\partial U(x_1,s_1)}{\partial x_1}-\dfrac{2x_1s_1}{x_1^2+1}\dfrac{\partial U(x_1,s_1)}{\partial s_1}=\left(\dfrac{2x_1}{x_1^2+1}+(x_1^2+1)s_1\right)U(x_1,s_1)-(x_1^2+1)\prod_{0.2,0.4}(x_1)$

Follow the method in http://en.wikipedia.org/wiki/Method_of_characteristics#Example:

$\dfrac{dx_1}{dr_1}=1$ , letting $x_1(0)=0$ , we have $x_1=r_1$

$\dfrac{ds_1}{dr_1}=-\dfrac{2x_1s_1}{x_1^2+1}=-\dfrac{2r_1s_1}{r_1^2+1}$ , letting $s_1(0)=s_1'$ , we have $s_1=\dfrac{s_1'}{r_1^2+1}=\dfrac{s_1'}{x_1^2+1}$

$\dfrac{dU}{dr_1}=\left(\dfrac{2x_1}{x_1^2+1}+(x_1^2+1)s_1\right)U-(x_1^2+1)\prod_{0.2,0.4}(x_1)=\left(\dfrac{2r_1}{r_1^2+1}+s_1'\right)U-(r_1^2+1)\prod_{0.2,0.4}(r_1)$ , letting $U(0)=f(s_1')$ , we have

$U(x_1,s_1)=(r_1^2+1)e^{s_1'r_1}f(s_1')-(r_1^2+1)e^{s_1'r_1}\int_0^{r_1}\prod_{0.2,0.4}(p_1)e^{-s_1'p_1}~dp_1$

$U(x_1,s_1)=\begin{cases}(r_1^2+1)e^{s_1'r_1}f(s_1')&\text{when}~r_1\leq0.2\\(r_1^2+1)e^{s_1'r_1}f(s_1')+(r_1^2+1)e^{s_1'r_1}\dfrac{e^{-s_1'r_1}-e^{-0.2s_1'}}{s_1'}&\text{when}~0.2\leq r_1\leq0.4\\(r_1^2+1)e^{s_1'r_1}f(s_1')+(r_1^2+1)e^{s_1'r_1}\dfrac{e^{-0.4s_1'}-e^{-0.2s_1'}}{s_1'}&\text{when}~r_1\geq0.4\end{cases}$

$U(x_1,s_1)=\begin{cases}(x_1^2+1)e^{(x_1^2+1)x_1s_1}f((x_1^2+1)s_1)&\text{when}~x_1\leq0.2\\(x_1^2+1)e^{(x_1^2+1)x_1s_1}f((x_1^2+1)s_1)+\dfrac{1-e^{(x_1-0.2)(x_1^2+1)s_1}}{s_1}&\text{when}~0.2\leq x_1\leq0.4\\(x_1^2+1)e^{(x_1^2+1)x_1s_1}f((x_1^2+1)s_1)+\dfrac{e^{(x_1-0.4)(x_1^2+1)s_1}-e^{(x_1-0.2)(x_1^2+1)s_1}}{s_1}&\text{when}~x_1\geq0.4\end{cases}$

$u(0,-t_1)=0$ , i.e. $U(0,s_1)=0$ :

$f(s_1)=0$

$\therefore U(x_1,s_1)=\begin{cases}0&\text{when}~x_1\leq0.2\\\dfrac{1-e^{(x_1-0.2)(x_1^2+1)s_1}}{s_1}&\text{when}~0.2\leq x_1\leq0.4\\\dfrac{e^{(x_1-0.4)(x_1^2+1)s_1}-e^{(x_1-0.2)(x_1^2+1)s_1}}{s_1}&\text{when}~x_1\geq0.4\end{cases}$

$u(x_1,t_1)=\begin{cases}\mathcal{L}^{-1}_{s_1\to t_1}\{0\}&\text{when}~x_1\leq0.2\\\mathcal{L}^{-1}_{s_1\to t_1}\left\{\dfrac{1-e^{(x_1-0.2)(x_1^2+1)s_1}}{s_1}\right\}&\text{when}~0.2\leq x_1\leq0.4\\\mathcal{L}^{-1}_{s_1\to t_1}\left\{\dfrac{e^{(x_1-0.4)(x_1^2+1)s_1}-e^{(x_1-0.2)(x_1^2+1)s_1}}{s_1}\right\}&\text{when}~x_1\geq0.4\end{cases}$

$u(x_1,t_1)=\begin{cases}0&\text{when}~x_1\leq0.2\\1-H((x_1-0.2)(x_1^2+1)+t_1)&\text{when}~0.2\leq x_1\leq0.4\\H((x_1-0.4)(x_1^2+1)+t_1)-H((x_1-0.2)(x_1^2+1)+t_1)&\text{when}~x_1\geq0.4\end{cases}$

$u(x,t)=\begin{cases}0&\text{when}~x\leq0.2\\1-H((x-0.2)(x^2+1)-t)&\text{when}~0.2\leq x\leq0.4\\H((x-0.4)(x^2+1)-t)-H((x-0.2)(x^2+1)-t)&\text{when}~x\geq0.4\end{cases}$