3
$\begingroup$

I need to solve an equation that involves the HeavisideTheta[] function, but regardless of the method I use Mathematica returns an error message. For example,

NSolve[x*HeavisideTheta[x] == 5, x]

returns the message "This system cannot be solved with methods available to NSolve". A similar message occurs with Solve[] and Reduce[]. Clearly the solution to the equation above is x=5. The full equation I need to solve can only be solved numerically. Are there any alternative functions to solve this equation?

$\endgroup$

2 Answers 2

4
$\begingroup$
NSolve[x UnitStep[x] == 5, x]
(* {{x -> 5.}} *)
$\endgroup$
4
$\begingroup$

Try

NMinimize[{1, x*HeavisideTheta[x] == 5}, x]
(*{1., {x -> 5.}}*)
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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