Define m
as an integer. I want to specify a Piecewise
function f[x,n]
that takes value n^3 x^2
except when x
divides m(n+1)
. At these values, I want f[x,n]=1
.
I can't figure out how to do this because I can't work out how to include the assumption that m
is an integer. I have
f[x_, n_] :=
Piecewise[{
{1, x ∈ Divisors[m (n + 1)]},
{x^2 n^(1/2), x ∉ Divisors[m (n + 1)]}
},
Assumptions -> m ∈ Integers];
table =Table[f[x, n], {x, 1, 5}, {n, 0, 5}]
This doesn't work. How do I do it?
m
and the assumptions. Ism
symbolic or numerical? If numerical, this is very simple:f[x_, n_] := Piecewise[{{n^3 *x^2, Mod[x, m (m + 1)] != 0}, {1, Mod[x, m (m + 1)] == 0}}]
- but ifm
is symbolic, then this doesn't make any sense. $\endgroup$Mod
trick works if I eliminate the use ofm
entirely - it was just a dummy variable to stand for "integer multiples ofn+1
". Thank you. If you could tweak and post it as an answer, I'll tick it. $\endgroup$ConditionalExpression
is what you need? $\endgroup$