0
$\begingroup$

I have a differential equation like $y'+a*y+b=0$. I have to find the value of $u=c*y+d$. These are the simplified form of the ODE and equation. Also, I have to plot $y$ and $u$ together.

$\endgroup$
4
  • $\begingroup$ Please include the Mathematica code you already have tried, so that readers can help you improve it.. $\endgroup$
    – bbgodfrey
    Dec 27, 2015 at 13:00
  • 1
    $\begingroup$ Are you sure you are in the correct site? Do you need a Mathematica code, or do you need to solve analytically those equations? In the latter case you should probably go on math.stackexchange.com $\endgroup$
    – mattiav27
    Dec 27, 2015 at 13:38
  • $\begingroup$ Welcome to Mathematica.SE! I suggest the following: 1) As you receive help, try to give it too, by answering questions in your area of expertise. 2) Take the tour! 3) When you see good questions and answers, vote them up by clicking the gray triangles, because the credibility of the system is based on the reputation gained by users sharing their knowledge. Also, please remember to accept the answer, if any, that solves your problem, by clicking the checkmark sign! $\endgroup$
    – Michael E2
    Dec 27, 2015 at 14:19
  • 1
    $\begingroup$ (1) You can do this easily by hand. Wikipedia has an example with $a=3$, $b=-2$. (2) The plot depends on the parameters, or at least the general shape & orientation depend on $a$ and $c$. To plot the functions in Mathematica you would need to assign all four numeric values. What are they? Or are you asking a general mathematics question? $\endgroup$
    – Michael E2
    Dec 27, 2015 at 14:30

1 Answer 1

3
$\begingroup$

$$ \frac{dy}{dx}+ay\left( x\right) =-b $$

For the homogeneous part $\frac{dy}{dx}+ay=0$, $\frac{dy}{y}=-adx$, integrating once gives \begin{align*} \ln y & =-ax+C\\ y_{h} & =C_{1}e^{-ax} \end{align*}

For the particular solution, try $y_{p}=k$. Substitute into the ODE\ gives $ak=-b$ or $k=-\frac{b}{a}$. Hence $y_{p}=\frac{-b}{a}$, therefore the full solution is

\begin{align*} y & =y_{h}+y_{p}\\ & =C_{1}e^{-ax}-\frac{b}{a} \end{align*}

Where $C_{1}$ is constant of integration. Therefore

\begin{align*} u & =cy+d\\ & =c\left( C_{1}e^{-ax}-\frac{b}{a}\right) +d \end{align*}

To plot, need first to determine $C_{1}$ which requires initial conditions. Also need numerical values for $c$ and $b$ and $a$ and $d$. Then use the Plot command in Mathematica.

If you have to use Mathematica to solve the ODE, the command is

DSolve[y'[x] + a*y[x] == -b, y[x], x]

For example, using some numbers:

b = 1; a = 2;
sol = y[x] /. First@DSolve[{y'[x] + a*y[x] == -b, y[0] == 1}, y[x], x];
c = 10; d = 11;
u = c*sol + d;
Plot[u, {x, 0, 10}]

Mathematica graphics

$\endgroup$
1
  • $\begingroup$ this is ok, but i have to plot u and y together in a graph i have to measure change of u with respect to y. Thank u. $\endgroup$
    – Avi2830
    Dec 27, 2015 at 16:35

Not the answer you're looking for? Browse other questions tagged or ask your own question.