Message Boards Message Boards

GROUPS:

Solving the equation dx/dt

Posted 2 years ago
3716 Views
|
1 Reply
|
0 Total Likes
|

Does anyone know how we solve the equation dx/dt =f(x)+u

when

f(x)=-x, if x<1 or x=1? I think it's a simple example but I don't know how we use the function if else. Thank you in advance!

f[x_] = Piecewise[{{-x, x <= 1}, {0, x > 0}}];
sol = DSolve[x'[t] == f[x[t]] + u, x[t], t]

(* {{x[t] -> InverseFunction[Piecewise[{{-Log[u - #1], #1 <= 1}}, -(1/u) - Log[-1 + u] + 
        #1/u] & ][t + C[1]]}}*)

Solution in implicit form:

 ((sol[[1, 1, 2, 0]][[1, 1]]) /. #1 -> x[t] // Simplify) ==  sol[[1, 1, 2, 1]]

 (* Piecewise[{{-Log[u - x[t]], x[t] <= 1}}, (-1 - u*Log[-1 + u] + x[t])/u] == t + C[1] *)
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract