0

For the differential equation y'(x)+a*y(x)=d, how to plot y'(x) and y(x) for given values of a and d.

DSolve[y'[x] + a*y[x] == d, y[x], x]
bbgodfrey
  • 61,439
  • 17
  • 89
  • 156
Avi2830
  • 17
  • 5

1 Answers1

1

To solve the differential equation,there should be a initial condition. After solving the differential eq find the derivarive and then use plot. For an example I have taken here $y(0)=4, a=2, d=5$

In[1]:= y[a_, d_, c_] := DSolve[{y'[x] + a*y[x] == d, y[0] == c}, y[x], x]

In[13]:= y[2, 5, 4]

Out[13]= {{y[x] -> 1/2 E^(-2 x) (3 + 5 E^(2 x))}}

In[7]:=D[y[2, 5, 4], x]
Out[7]= {{Derivative[1][y][x] -> 5 - E^(-2 x) (3 + 5 E^(2 x))}}

Plot[{ 1/2 E^(-2 x) (3 + 5 E^(2 x)), 5 - E^(-2 x) (1 + 5 E^(2 x))}, {x, -3, 3}]

enter image description here

Karsten7
  • 27,448
  • 5
  • 73
  • 134
m. bubu
  • 565
  • 2
  • 13