# Plot a sinusoidal function with some parameters

I have the function

myfun[a1_, a2_, a3_, b_, θ_, ϕ_] =
a1 + 2 a2 + 3 a3 + b Cos[θ] + (a1 Cos[ϕ] + a2 Sin[ϕ]) Sin[θ];


The parameters satisfy $$\sqrt{a1^2+a2^2+a3^2} + |b| \le 1$$. I want to plot myfun with respect to $$\theta$$ and $$\phi$$. However, I want to do this for "various" combinations of the parameters $$a1$$,$$a2$$,$$a3$$ and $$b$$, satisfying above condition. Doing this by hand is very hard. Can we do this by Mathematica?

This may be what you mean:

Clear[myfun, plotfn]
myfun[a1_, a2_, a3_, b_, \[Theta]_, \[Phi]_] := a1 + 2 a2 + 3 a3 + b Cos[\[Theta]] + (a1 Cos[\[Phi]] + a2 Sin[\[Phi]]) Sin[\[Theta]]


Then, a plot function which plots what you ask for if the condition that you define is satisfied. Otherwise, it prints the result of the condition

plotfn[a1_, a2_, a3_, b_] /; (Sqrt[a1^2 + a2^2 + a3^2] + Abs[b] <= 1) :=
ContourPlot[
myfun[a1, a2, a3,
b, \[Tau], \[Phi]], {\[Tau], -\[Pi], \[Pi]}, {\[Phi], -\[Pi], \
\[Pi]}];
plotfn[a1_, a2_, a3_, b_] :=
"Sqrt[\!$$\*SuperscriptBox[\(a1$$, \
$$2$$]\)+\!$$\*SuperscriptBox[\(a2$$, \
$$2$$]\)+\!$$\*SuperscriptBox[\(a3$$, $$2$$]\)]+|b|" ->
N[Sqrt[a1^2 + a2^2 + a3^2] + Abs@b]


A Manipulate allows to vary a bit

Manipulate[
plotfn[\[Alpha]1, \[Alpha]2, \[Alpha]3, \[Beta]], {{\[Alpha]1, .1}, \
-1, 1}, {{\[Alpha]2, .1}, -1, 1}, {{\[Alpha]3, .1}, -1,
1}, {{\[Beta], .1}, -1, 1}]


edit: forgot the Abs around b in the condition