3D-Plot with an inequality condition for parameter valuesPlotting a function only non-zero for discrete values of argumentPlotting double inequality only for integer valuesPlot the result of NIntegrate for different parameter values(Naive) Manual implementation of DFT results in long sum which is very inefficient to plot, can my approach be saved?3D plot from listsPlotting for various parameter values with single code3D-Plot optimization results for varying parameter valuesListPlot3D for optimization with varying parameter values3D Plot maximization results with varying parameter values3D Plot multiple maximization results in one same diagram
How to fit a linear model in the Bayesian way in Mathematica?
Will it hurt my career to work as a graphic designer in a startup for beauty and skin care?
How would you write do the dialogues of two characters talking in a chat room?
Why is dry soil hydrophobic? Bad gardener paradox
Won 50K! Now what should I do with it
Adding a vertical line at the right end of the horizontal line in frac
Are lithium batteries allowed in the International Space Station?
What exactly is the Tension force?
Why do they not say "The Baby"
Is this a Lost Mine of Phandelver Plot Hole?
School House Points (Python + SQLite)
Add region constraint to Graphics
What are some symbols representing peasants/oppressed persons fighting back?
Mistakenly modified `/bin/sh'
How to determine port and starboard on a rotating wheel space station?
Concatenation using + and += operator in Python
Why is the collector feedback bias popular in electret-mic preamp circuits?
Integral clarification
Book or series about stones and a magician named Gwydion
Did the Shuttle's rudder or elevons operate when flown on its carrier 747?
What caused Windows ME's terrible reputation?
Why doesn't Anakin's lightsaber explode when it's chopped in half on Geonosis?
Do native speakers use ZVE or CPU?
Are L-functions uniquely determined by their values at negative integers?
3D-Plot with an inequality condition for parameter values
Plotting a function only non-zero for discrete values of argumentPlotting double inequality only for integer valuesPlot the result of NIntegrate for different parameter values(Naive) Manual implementation of DFT results in long sum which is very inefficient to plot, can my approach be saved?3D plot from listsPlotting for various parameter values with single code3D-Plot optimization results for varying parameter valuesListPlot3D for optimization with varying parameter values3D Plot maximization results with varying parameter values3D Plot multiple maximization results in one same diagram
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
$begingroup$
I'm trying to ListPlot3D the following function
$f=frac-frac(t-1) (d-s) left(2 c d (d (q-1)+s)-s left(-2 d^2+d (s+2)+s^2right)right)2 s^2+d^2-d s-d t+s ts$
against $c in [0,1]$ and $q in [1,2]$ under the conditions of $s=2$, $d=0.8$, $t=0$, $0leq c leq 1$, and $1 leq q leq frac1c$.
I'm struggling with how to reflect the last condition, i.e. $1 leq q leq frac1c$ in my Mathematica code. I used Assumption but didn't work.
Here is the code I tried:
Block[s = 2, d = 0.8, t = 0, f = (d^2 - d s - ((d - s) (2 c d (d (-1 + q) + s) - s (-2 d^2 + s^2 + d (2 + s))) (-1 + t))/(2 s^2) - d t + s t)/s; maxn = Flatten[Table[c, q, f, c, 0, 1, .1, q, 1, 2, .1, Assumptions -> 0 < c <= 1, 1 <= q <= 1/c], 1];] ListPlot3D[maxn, AxesLabel -> "c", "q", "V"]
plotting
$endgroup$
add a comment |
$begingroup$
I'm trying to ListPlot3D the following function
$f=frac-frac(t-1) (d-s) left(2 c d (d (q-1)+s)-s left(-2 d^2+d (s+2)+s^2right)right)2 s^2+d^2-d s-d t+s ts$
against $c in [0,1]$ and $q in [1,2]$ under the conditions of $s=2$, $d=0.8$, $t=0$, $0leq c leq 1$, and $1 leq q leq frac1c$.
I'm struggling with how to reflect the last condition, i.e. $1 leq q leq frac1c$ in my Mathematica code. I used Assumption but didn't work.
Here is the code I tried:
Block[s = 2, d = 0.8, t = 0, f = (d^2 - d s - ((d - s) (2 c d (d (-1 + q) + s) - s (-2 d^2 + s^2 + d (2 + s))) (-1 + t))/(2 s^2) - d t + s t)/s; maxn = Flatten[Table[c, q, f, c, 0, 1, .1, q, 1, 2, .1, Assumptions -> 0 < c <= 1, 1 <= q <= 1/c], 1];] ListPlot3D[maxn, AxesLabel -> "c", "q", "V"]
plotting
$endgroup$
add a comment |
$begingroup$
I'm trying to ListPlot3D the following function
$f=frac-frac(t-1) (d-s) left(2 c d (d (q-1)+s)-s left(-2 d^2+d (s+2)+s^2right)right)2 s^2+d^2-d s-d t+s ts$
against $c in [0,1]$ and $q in [1,2]$ under the conditions of $s=2$, $d=0.8$, $t=0$, $0leq c leq 1$, and $1 leq q leq frac1c$.
I'm struggling with how to reflect the last condition, i.e. $1 leq q leq frac1c$ in my Mathematica code. I used Assumption but didn't work.
Here is the code I tried:
Block[s = 2, d = 0.8, t = 0, f = (d^2 - d s - ((d - s) (2 c d (d (-1 + q) + s) - s (-2 d^2 + s^2 + d (2 + s))) (-1 + t))/(2 s^2) - d t + s t)/s; maxn = Flatten[Table[c, q, f, c, 0, 1, .1, q, 1, 2, .1, Assumptions -> 0 < c <= 1, 1 <= q <= 1/c], 1];] ListPlot3D[maxn, AxesLabel -> "c", "q", "V"]
plotting
$endgroup$
I'm trying to ListPlot3D the following function
$f=frac-frac(t-1) (d-s) left(2 c d (d (q-1)+s)-s left(-2 d^2+d (s+2)+s^2right)right)2 s^2+d^2-d s-d t+s ts$
against $c in [0,1]$ and $q in [1,2]$ under the conditions of $s=2$, $d=0.8$, $t=0$, $0leq c leq 1$, and $1 leq q leq frac1c$.
I'm struggling with how to reflect the last condition, i.e. $1 leq q leq frac1c$ in my Mathematica code. I used Assumption but didn't work.
Here is the code I tried:
Block[s = 2, d = 0.8, t = 0, f = (d^2 - d s - ((d - s) (2 c d (d (-1 + q) + s) - s (-2 d^2 + s^2 + d (2 + s))) (-1 + t))/(2 s^2) - d t + s t)/s; maxn = Flatten[Table[c, q, f, c, 0, 1, .1, q, 1, 2, .1, Assumptions -> 0 < c <= 1, 1 <= q <= 1/c], 1];] ListPlot3D[maxn, AxesLabel -> "c", "q", "V"]
plotting
plotting
edited 8 hours ago
ppp
asked 9 hours ago
pppppp
3712 silver badges11 bronze badges
3712 silver badges11 bronze badges
add a comment |
add a comment |
3 Answers
3
active
oldest
votes
$begingroup$
Instead of sampling the function yourself, you can use Plot3D.
expr = Block[s = 2, d = 0.8, t = 0,
(d^2 - d s - ((d - s) (2 c d (d (-1 + q) + s) -
s (-2 d^2 + s^2 + d (2 + s))) (-1 + t))/(2 s^2) - d t + s t)/s
];
Plot3D[expr, c, 0, 1, q, 1, 2,
PlotPoints -> 50,
MaxRecursion -> 5,
RegionFunction ->
Function[c, q, 1 <= q <= 1/(c + $MinMachineNumber)]
]

As you can see, the troubling condition can be incorporated by using RegionFunction.
$endgroup$
add a comment |
$begingroup$
Here's another way: Iterators may depend on iterators that precede them.
expr = Block[s = 2, d = 0.8, t = 0,
(d^2 - d s - ((d - s) (2 c d (d (-1 + q) + s) -
s (-2 d^2 + s^2 + d (2 + s))) (-1 + t))/(2 s^2) - d t + s t)/s];
Plot3D[expr, c, 0, 1, q, 1, Min[2, 1/(c + $MinMachineNumber)]]

This also works, if you don't like fudging with $MinMachineNumber (which doesn't affect the plot at all):
q2[c_?NumericQ] := Min[2, Quiet@Check[1/c, Infinity]];
Plot3D[expr, c, 0, 1, q, 1, q2[c]]
Alternatively, you can special-case zero (the definition for c == 0 must come first):
ClearAll[q2];
q2[0 | 0.] := 2;
q2[c_?NumericQ] := Min[2, 1/c];
$endgroup$
$begingroup$
I should point out that when the boundary can be specified in this way, a crisp, clean boundary can be computed with much less computational effort than the sampling/interpolation method used inRegionFunction.
$endgroup$
– Michael E2
5 hours ago
add a comment |
$begingroup$
Some of your c are zero and Mathematica complains about testing for 1/c
So I assume any result 1<=q<=1/0 is acceptable by checking for c==0 first and only if c !=0 do I also check for 1/c
maxn = Flatten[Table[c, q, f, c, 0, 1, .1, q, 1, 2, .1],1];
newmaxn=Select[maxn,(1<=#[[2]]&&#[[1]]==0)||1<=#[[2]]<=1/#[[1]]&];
ListPlot3D[newmaxn]
$endgroup$
add a comment |
Your Answer
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "387"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmathematica.stackexchange.com%2fquestions%2f202068%2f3d-plot-with-an-inequality-condition-for-parameter-values%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
3 Answers
3
active
oldest
votes
3 Answers
3
active
oldest
votes
active
oldest
votes
active
oldest
votes
$begingroup$
Instead of sampling the function yourself, you can use Plot3D.
expr = Block[s = 2, d = 0.8, t = 0,
(d^2 - d s - ((d - s) (2 c d (d (-1 + q) + s) -
s (-2 d^2 + s^2 + d (2 + s))) (-1 + t))/(2 s^2) - d t + s t)/s
];
Plot3D[expr, c, 0, 1, q, 1, 2,
PlotPoints -> 50,
MaxRecursion -> 5,
RegionFunction ->
Function[c, q, 1 <= q <= 1/(c + $MinMachineNumber)]
]

As you can see, the troubling condition can be incorporated by using RegionFunction.
$endgroup$
add a comment |
$begingroup$
Instead of sampling the function yourself, you can use Plot3D.
expr = Block[s = 2, d = 0.8, t = 0,
(d^2 - d s - ((d - s) (2 c d (d (-1 + q) + s) -
s (-2 d^2 + s^2 + d (2 + s))) (-1 + t))/(2 s^2) - d t + s t)/s
];
Plot3D[expr, c, 0, 1, q, 1, 2,
PlotPoints -> 50,
MaxRecursion -> 5,
RegionFunction ->
Function[c, q, 1 <= q <= 1/(c + $MinMachineNumber)]
]

As you can see, the troubling condition can be incorporated by using RegionFunction.
$endgroup$
add a comment |
$begingroup$
Instead of sampling the function yourself, you can use Plot3D.
expr = Block[s = 2, d = 0.8, t = 0,
(d^2 - d s - ((d - s) (2 c d (d (-1 + q) + s) -
s (-2 d^2 + s^2 + d (2 + s))) (-1 + t))/(2 s^2) - d t + s t)/s
];
Plot3D[expr, c, 0, 1, q, 1, 2,
PlotPoints -> 50,
MaxRecursion -> 5,
RegionFunction ->
Function[c, q, 1 <= q <= 1/(c + $MinMachineNumber)]
]

As you can see, the troubling condition can be incorporated by using RegionFunction.
$endgroup$
Instead of sampling the function yourself, you can use Plot3D.
expr = Block[s = 2, d = 0.8, t = 0,
(d^2 - d s - ((d - s) (2 c d (d (-1 + q) + s) -
s (-2 d^2 + s^2 + d (2 + s))) (-1 + t))/(2 s^2) - d t + s t)/s
];
Plot3D[expr, c, 0, 1, q, 1, 2,
PlotPoints -> 50,
MaxRecursion -> 5,
RegionFunction ->
Function[c, q, 1 <= q <= 1/(c + $MinMachineNumber)]
]

As you can see, the troubling condition can be incorporated by using RegionFunction.
answered 6 hours ago
halirutan♦halirutan
97.3k6 gold badges227 silver badges424 bronze badges
97.3k6 gold badges227 silver badges424 bronze badges
add a comment |
add a comment |
$begingroup$
Here's another way: Iterators may depend on iterators that precede them.
expr = Block[s = 2, d = 0.8, t = 0,
(d^2 - d s - ((d - s) (2 c d (d (-1 + q) + s) -
s (-2 d^2 + s^2 + d (2 + s))) (-1 + t))/(2 s^2) - d t + s t)/s];
Plot3D[expr, c, 0, 1, q, 1, Min[2, 1/(c + $MinMachineNumber)]]

This also works, if you don't like fudging with $MinMachineNumber (which doesn't affect the plot at all):
q2[c_?NumericQ] := Min[2, Quiet@Check[1/c, Infinity]];
Plot3D[expr, c, 0, 1, q, 1, q2[c]]
Alternatively, you can special-case zero (the definition for c == 0 must come first):
ClearAll[q2];
q2[0 | 0.] := 2;
q2[c_?NumericQ] := Min[2, 1/c];
$endgroup$
$begingroup$
I should point out that when the boundary can be specified in this way, a crisp, clean boundary can be computed with much less computational effort than the sampling/interpolation method used inRegionFunction.
$endgroup$
– Michael E2
5 hours ago
add a comment |
$begingroup$
Here's another way: Iterators may depend on iterators that precede them.
expr = Block[s = 2, d = 0.8, t = 0,
(d^2 - d s - ((d - s) (2 c d (d (-1 + q) + s) -
s (-2 d^2 + s^2 + d (2 + s))) (-1 + t))/(2 s^2) - d t + s t)/s];
Plot3D[expr, c, 0, 1, q, 1, Min[2, 1/(c + $MinMachineNumber)]]

This also works, if you don't like fudging with $MinMachineNumber (which doesn't affect the plot at all):
q2[c_?NumericQ] := Min[2, Quiet@Check[1/c, Infinity]];
Plot3D[expr, c, 0, 1, q, 1, q2[c]]
Alternatively, you can special-case zero (the definition for c == 0 must come first):
ClearAll[q2];
q2[0 | 0.] := 2;
q2[c_?NumericQ] := Min[2, 1/c];
$endgroup$
$begingroup$
I should point out that when the boundary can be specified in this way, a crisp, clean boundary can be computed with much less computational effort than the sampling/interpolation method used inRegionFunction.
$endgroup$
– Michael E2
5 hours ago
add a comment |
$begingroup$
Here's another way: Iterators may depend on iterators that precede them.
expr = Block[s = 2, d = 0.8, t = 0,
(d^2 - d s - ((d - s) (2 c d (d (-1 + q) + s) -
s (-2 d^2 + s^2 + d (2 + s))) (-1 + t))/(2 s^2) - d t + s t)/s];
Plot3D[expr, c, 0, 1, q, 1, Min[2, 1/(c + $MinMachineNumber)]]

This also works, if you don't like fudging with $MinMachineNumber (which doesn't affect the plot at all):
q2[c_?NumericQ] := Min[2, Quiet@Check[1/c, Infinity]];
Plot3D[expr, c, 0, 1, q, 1, q2[c]]
Alternatively, you can special-case zero (the definition for c == 0 must come first):
ClearAll[q2];
q2[0 | 0.] := 2;
q2[c_?NumericQ] := Min[2, 1/c];
$endgroup$
Here's another way: Iterators may depend on iterators that precede them.
expr = Block[s = 2, d = 0.8, t = 0,
(d^2 - d s - ((d - s) (2 c d (d (-1 + q) + s) -
s (-2 d^2 + s^2 + d (2 + s))) (-1 + t))/(2 s^2) - d t + s t)/s];
Plot3D[expr, c, 0, 1, q, 1, Min[2, 1/(c + $MinMachineNumber)]]

This also works, if you don't like fudging with $MinMachineNumber (which doesn't affect the plot at all):
q2[c_?NumericQ] := Min[2, Quiet@Check[1/c, Infinity]];
Plot3D[expr, c, 0, 1, q, 1, q2[c]]
Alternatively, you can special-case zero (the definition for c == 0 must come first):
ClearAll[q2];
q2[0 | 0.] := 2;
q2[c_?NumericQ] := Min[2, 1/c];
edited 6 hours ago
answered 6 hours ago
Michael E2Michael E2
155k12 gold badges214 silver badges505 bronze badges
155k12 gold badges214 silver badges505 bronze badges
$begingroup$
I should point out that when the boundary can be specified in this way, a crisp, clean boundary can be computed with much less computational effort than the sampling/interpolation method used inRegionFunction.
$endgroup$
– Michael E2
5 hours ago
add a comment |
$begingroup$
I should point out that when the boundary can be specified in this way, a crisp, clean boundary can be computed with much less computational effort than the sampling/interpolation method used inRegionFunction.
$endgroup$
– Michael E2
5 hours ago
$begingroup$
I should point out that when the boundary can be specified in this way, a crisp, clean boundary can be computed with much less computational effort than the sampling/interpolation method used in
RegionFunction.$endgroup$
– Michael E2
5 hours ago
$begingroup$
I should point out that when the boundary can be specified in this way, a crisp, clean boundary can be computed with much less computational effort than the sampling/interpolation method used in
RegionFunction.$endgroup$
– Michael E2
5 hours ago
add a comment |
$begingroup$
Some of your c are zero and Mathematica complains about testing for 1/c
So I assume any result 1<=q<=1/0 is acceptable by checking for c==0 first and only if c !=0 do I also check for 1/c
maxn = Flatten[Table[c, q, f, c, 0, 1, .1, q, 1, 2, .1],1];
newmaxn=Select[maxn,(1<=#[[2]]&&#[[1]]==0)||1<=#[[2]]<=1/#[[1]]&];
ListPlot3D[newmaxn]
$endgroup$
add a comment |
$begingroup$
Some of your c are zero and Mathematica complains about testing for 1/c
So I assume any result 1<=q<=1/0 is acceptable by checking for c==0 first and only if c !=0 do I also check for 1/c
maxn = Flatten[Table[c, q, f, c, 0, 1, .1, q, 1, 2, .1],1];
newmaxn=Select[maxn,(1<=#[[2]]&&#[[1]]==0)||1<=#[[2]]<=1/#[[1]]&];
ListPlot3D[newmaxn]
$endgroup$
add a comment |
$begingroup$
Some of your c are zero and Mathematica complains about testing for 1/c
So I assume any result 1<=q<=1/0 is acceptable by checking for c==0 first and only if c !=0 do I also check for 1/c
maxn = Flatten[Table[c, q, f, c, 0, 1, .1, q, 1, 2, .1],1];
newmaxn=Select[maxn,(1<=#[[2]]&&#[[1]]==0)||1<=#[[2]]<=1/#[[1]]&];
ListPlot3D[newmaxn]
$endgroup$
Some of your c are zero and Mathematica complains about testing for 1/c
So I assume any result 1<=q<=1/0 is acceptable by checking for c==0 first and only if c !=0 do I also check for 1/c
maxn = Flatten[Table[c, q, f, c, 0, 1, .1, q, 1, 2, .1],1];
newmaxn=Select[maxn,(1<=#[[2]]&&#[[1]]==0)||1<=#[[2]]<=1/#[[1]]&];
ListPlot3D[newmaxn]
answered 6 hours ago
BillBill
6,6756 silver badges9 bronze badges
6,6756 silver badges9 bronze badges
add a comment |
add a comment |
Thanks for contributing an answer to Mathematica Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
Use MathJax to format equations. MathJax reference.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmathematica.stackexchange.com%2fquestions%2f202068%2f3d-plot-with-an-inequality-condition-for-parameter-values%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown