Message Boards Message Boards

0
|
6690 Views
|
1 Reply
|
0 Total Likes
View groups...
Share
Share this post:

Solving the equation dx/dt

Posted 5 years ago

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!

POSTED BY: Evina Konti
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] *)
POSTED BY: Mariusz Iwaniuk
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