Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Here is a numerical solution using that suggested from your previous post.

var('u x')
f=x*(unit_step(x)-unit_step(x-1))+(2-x)*(unit_step(x-1))
ode = -1/2*(u)+f
ans=desolve_rk4(ode,u,ics=[-1,3],ivar=x,end_points=2,step=0.1)
solnplot=line(ans,color='red')
dirfield=streamline_plot(ode,(x,-1,2),(u,-1,4))
solnplot+dirfield