Guest User

Untitled

a guest
Feb 24th, 2018
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.73 KB | None | 0 0
  1. Minimize[{If[x > 0, 3 x, x^2 - x - 4]}, x]
  2.  
  3. Minimize[{If[x > 0, 3 x, x^2 - x - a], -2 < a < 2}, x]
  4.  
  5. If a < 0 min = 0, If a > 0 min = - a
  6.  
  7. Minimize[{If[x > 0, 3 x, x^2 - x - a], -2 < a < 2}, x]
  8.  
  9. Minimize[{If[x > 0, 3 x, x^2 - x - a], -2 < a < 2}, x]
  10.  
  11. $Version
  12.  
  13. (* "10.0 for Mac OS X x86 (64-bit) (December 4, 2014)" *)
  14.  
  15. Clear[f]
  16.  
  17. f[x_, a_] = PiecewiseExpand@If[x > 0, 3 x, x^2 - x - a]
  18.  
  19. (* Piecewise[{{3*x, x > 0}}, -a - x + x^2] *)
  20.  
  21. Plot3D[f[x, a], {x, -3, 3}, {a, -2, 2}]
  22.  
  23. Minimize[{f[x, a], -2 < a < 2}, {x, a}]
  24.  
  25. (* Minimize::wksol: Warning: there is no minimum in the region in which the
  26. objective function is defined and the constraints are satisfied; returning a
  27. result on the boundary. >>
  28.  
  29. {-2, {x -> 0, a -> 2}} *)
Add Comment
Please, Sign In to add comment