I have a function f(A,B,C)
where for specific A
and B
values I can use Reduce to determine the constraint on C
for my problem using a constraint on f
. I want to plot the resulting surface.
To illustrate, consider
f = A^5 + B^3 + C^2
If A
and B
vary between 1 and 3 then I get the list of constraints (with f<20)
constraints = {{1, 1, C < 18}, {2, 1, C < -13}, {3, 1, C < -224}, {1, 2, C < 11}, {2, 2, C < -20}, {3, 2, C < -231}, {1, 3, C < -8}, {2, 3, C < -39}, {3, 3, C < -250}}
I then want to plot the surface given by
surf = {{1, 1, 18}, {2, 1, -13}, {3, 1, -224}, {1, 2,
11}, {2, 2, -20}, {3, 2, -231}, {1, 3, -8}, {2, 3,
-39}, {3, 3, -250}}
ListPlot3D[surf,Mesh->All]
I can form the list of constraints using For loops
constraints = {};
For[B = 1, B <= 3, B++,
For[A = 1, A <= 3, A++,
f = (A)^5 + B^3 + p;
sol = Reduce[f < 20, p];
constraints = Append[constraints, {A, B, sol}]
]
]
constraints
However I am not sure how to get from the list of constraints to the max permitted value for C
and therefore get to the surf expression.
I also expect that For loops are not an ideal approach, and that I should be able to form lists of the A
and B
values and use another approach (Map, or Thread, or Apply maybe) with Reduce. I find these methods confusing though, and don't really understand anything but the most basic examples (so possibly similar questions have not helped me figure this out).
A
andB
constrained to be integers? $\endgroup$