You can use this syntax:
y[t_] := {Cos[n t], Sin[n t]} /; Abs[t] <= Pi/(2 n)
With this, y[t]
stays unevaluated if the condition is not satisfied. This only works if n
is known and a concrete value of t
is plugged in, otherwise it always yields only y[t]
.
If you want to work with the function symbolically, or want n
to stay generic, you may try your luck with
y[t_] := If[Abs[t] <= Pi/(2 n), {Cos[n t], Sin[n t]}]
This stays symbolic (using the If
) for a generic n
and t
, and if they are known, it is simplified to the value if the condition is satisfied and to Null
if not. This may be a problem as Null
does not display in output.
There's also Piecewise
with a single condition:
y[t_] := Piecewise[{{{Cos[n t], Sin[n t]}, Abs[t] <= Pi/(2 n)}}]
but it gives 0
if condition not satisfied. You can change the latter value to something more suitable, but you won't achieve an "unevaluated" result.
Your choice will depend on what you expect in what situations.