Contact
CoCalc Logo Icon
StoreFeaturesDocsShareSupport News AboutSign UpSign In
| Download
Project: pde
Views: 69
︠c4eb26e6-7a6c-440d-bb87-b61e7886f371︠ %md ####The Inhomogeneous Transport Equation: $u_t(x,t) + v\ u_x (x,t)= f(x,t), u(x,0)=g(x)$ If $v$ is constant, the solution is $u(x,t)=g(x-v\ t)+\displaystyle\int_0^t f(x-v(t-s),s)\ ds$. We can plot it for any nice $g$ and $f$. Use the interact below to experiment with changing the right hand side f and the initial condition g to see the effect on u. The graphs shown are of $u_{t_i}(x)=u(x,t_i)$ for $t_i=t_0+i\ step$ for $i=0, \cdots ,5$. They are color-coded black, red, blue, grey, magenta, turquoise in order of increasing time.

####The Inhomogeneous Transport Equation: ut(x,t)+v ux(x,t)=f(x,t),u(x,0)=g(x)u_t(x,t) + v\ u_x (x,t)= f(x,t), u(x,0)=g(x)

If vv is constant, the solution is u(x,t)=g(xv t)+0tf(xv(ts),s) dsu(x,t)=g(x-v\ t)+\displaystyle\int_0^t f(x-v(t-s),s)\ ds. We can plot it for any nice gg and ff.

Use the interact below to experiment with changing the right hand side f and the initial condition g to see the effect on u. The graphs shown are of uti(x)=u(x,ti)u_{t_i}(x)=u(x,t_i) for ti=t0+i stept_i=t_0+i\ step for i=0,,5i=0, \cdots ,5. They are color-coded black, red, blue, grey, magenta, turquoise in order of increasing time.

x,t=var('x t') @interact(layout={'top':[['f','g','v','frames'],['xmin','xmax','t0','step']]}) def getem(f=sin(x+5*t),g=1/exp(x^2),v=1,frames=1,xmin=-1.,xmax=1.,t0=.1,step=.2): def f1(x,t): return f(x=x,t=t) def g1(x): return g(x=x) clrs=['black','red','blue','grey','magenta','turquoise'] def u(x,t): def h(s): return f1(x-v*(t-s),s).n() return numerical_integral(h,(0,t))[0]+g1(x-v*t) G=Graphics() for i in range(frames): def w(x): return u(x,t0) G+=plot(w,(xmin,xmax),color=clrs[i]) if frames==1: tab=[[('x','t0')],['u(x,t0)']] pts=[] x0=xmin dx=(xmax-xmin)/4 for j in range(5): tab[0]+=[(x0.n(digits=6),t0.n(digits=6))] tab[1]+=[u(x0,t0).n(digits=6)] pts+=[(x0,w(x0))] x0+=dx G+=point(pts) t0+=step show(G) if frames==1: print table(tab)
Interact: please open in CoCalc