I'm working with a trigonometric function, so I thought it would be convenient to set a condition to restrict the domain so I wouldn't have to specify it in the solve function each time. Here is a simplified example:
h[t_ /; 0 <= t <= 24] := 20 + 20 Sin[\[Pi]/12 t];
Plotting seems to work just fine, however when I try to solve it using this simple code:
Solve[h[t] == 10, t]
I get an inverse function (?) instead of the usual answer:
{{t -> h^(-1) [10]}}
The normal way works, but as you can see, it is inconvenient to specify the domain every time:
Solve[20 + 20 Sin[\[Pi]/12 t] == 10 && 0 <= t <= 24, t]
(*Output: {{t -> 14}, {t -> 22}} *)
Can anyone please help point out the problem? I would like to define a function with a restricted domain, so that there is no need to specify the domain within solve.
ClearAll[h]; h[t_] := ConditionalExpression[20 + 20 Sin[\[Pi]/12 t], 0 <= t < 24]; Solve[h[t] == 10, t]
an acceptable alternative? $\endgroup$h[t_]:=Piecewise[{{20+20 Sin[Pi/12 t],0<=t<24}},Indeterminate]
$\endgroup$