Can the Assuming function be used with ContourPlot or DensityPlot?
Clash Royale CLAN TAG#URR8PPP
$begingroup$
I'm new to Mathematica, and for most purposes the program has served me well and been straightforward. However, I'm hitting a snag while trying to create a contour plot for the distribution function
$qquad f(x,y) = (x,y)^p-1/(alpha + beta,x + gamma,y + delta,x,y)^p + q$
Notice $x,y$ are variables, and $alpha,beta,gamma,delta, p,$ and $q$ are constants. I need to set a list of assumptions for constants in the function, but my attempts have been fruitless. Every command yields a graph without an image.
I first tried assigning my function with its assumptions by:
Assuming[
x > 0, y > 0, p > 0, α > 0, β > 0, γ > 0, δ > 0,
f[x_, y_] :=
(x*y)^(p - 1)/(α + β*x + γ*y + δ*x*y)^(p + q)]
After the assignment, I tried plotting with ContourPlot
and DensityPlot
.
I'll provide just the ContourPlot
expression below because not much changes across them:
ContourPlot[f[x, y], x, 0, 200, y, 0, 200]
In regards to the ContourPlot
code, I've changed the domain to both larger and smaller numbers to no avail. Neither ContourPlot
nor DensityPlot
provides an image. I then try the code without assigning the function beforehand, while including ContourPlot within the Assuming command:
Assuming[
α > 0, β > 0, γ > 0, δ > 0, p > 0,
ContourPlot[(x*y)^(p - 1)/(α + β*x + γ*y + δ*x*y)^(p + q), x, 0, 3, y, 0, 3]]
I know this equation should produce some sort of image since it's simply a type of truncated distribution function. I believe I've narrowed down the issue to one of the following: Mathematica does not allow assumptions to be used with ContourPlot/DensityPlot
, the distribution function is too complicated for Mathematica, or my user error is hindering me. My next step is to try creating different plots on the same graph for various pre-determined values of the parameters.
Any help is much appreciated. As previously mentioned, I'm not very experienced with Mathematica, so I'm more than willing to learn something new or help further explain my goals.
plotting assumptions
$endgroup$
|
show 1 more comment
$begingroup$
I'm new to Mathematica, and for most purposes the program has served me well and been straightforward. However, I'm hitting a snag while trying to create a contour plot for the distribution function
$qquad f(x,y) = (x,y)^p-1/(alpha + beta,x + gamma,y + delta,x,y)^p + q$
Notice $x,y$ are variables, and $alpha,beta,gamma,delta, p,$ and $q$ are constants. I need to set a list of assumptions for constants in the function, but my attempts have been fruitless. Every command yields a graph without an image.
I first tried assigning my function with its assumptions by:
Assuming[
x > 0, y > 0, p > 0, α > 0, β > 0, γ > 0, δ > 0,
f[x_, y_] :=
(x*y)^(p - 1)/(α + β*x + γ*y + δ*x*y)^(p + q)]
After the assignment, I tried plotting with ContourPlot
and DensityPlot
.
I'll provide just the ContourPlot
expression below because not much changes across them:
ContourPlot[f[x, y], x, 0, 200, y, 0, 200]
In regards to the ContourPlot
code, I've changed the domain to both larger and smaller numbers to no avail. Neither ContourPlot
nor DensityPlot
provides an image. I then try the code without assigning the function beforehand, while including ContourPlot within the Assuming command:
Assuming[
α > 0, β > 0, γ > 0, δ > 0, p > 0,
ContourPlot[(x*y)^(p - 1)/(α + β*x + γ*y + δ*x*y)^(p + q), x, 0, 3, y, 0, 3]]
I know this equation should produce some sort of image since it's simply a type of truncated distribution function. I believe I've narrowed down the issue to one of the following: Mathematica does not allow assumptions to be used with ContourPlot/DensityPlot
, the distribution function is too complicated for Mathematica, or my user error is hindering me. My next step is to try creating different plots on the same graph for various pre-determined values of the parameters.
Any help is much appreciated. As previously mentioned, I'm not very experienced with Mathematica, so I'm more than willing to learn something new or help further explain my goals.
plotting assumptions
$endgroup$
1
$begingroup$
MemberQ[Keys[Options[ContourPlot]], Assumptions]
returnsFalse
, so you can't use assumptions onContourPlot
. Your more pressing problem is that you have neglected to provide concrete values for your parameters, so there really is nothing for the plotter to do. (Also,xy
andx y
are very different things, which contributes to why you can't plot.)
$endgroup$
– J. M. is slightly pensive♦
Mar 4 at 2:47
$begingroup$
That makes sense. I'll stop trying to useAssumptions
withContourPlot
now. I don't know how I didn't catch myself sooner, but I now realize I had typedxy
instead ofx*y
. This actually fixes another, unrelated issue I was having with the code. That said, thank you so much for your help!
$endgroup$
– Banks Osborne
Mar 4 at 3:09
1
$begingroup$
Shouldn't(xy)^(p - 1)/(α + βx + γy + δxy)^(p + q)]
be(x y)^(p - 1)/(α + β x + γ y + δ x y)^(p + q)]
The additional spaces make a big difference.
$endgroup$
– m_goldberg
Mar 4 at 3:59
$begingroup$
Yes, was thinking the same thing, otherwise Mathematica thinks each term is one variable for examplexy
and not the product of these.
$endgroup$
– mjw
Mar 4 at 4:08
$begingroup$
You also need to set the constants to some values to plot your function. To take a simpler example, to plotExp[-x^2 / (2 sigma^2)] / (sigma Sqrt[2 pi]
, you would need to specifysigma
.
$endgroup$
– mjw
Mar 4 at 4:11
|
show 1 more comment
$begingroup$
I'm new to Mathematica, and for most purposes the program has served me well and been straightforward. However, I'm hitting a snag while trying to create a contour plot for the distribution function
$qquad f(x,y) = (x,y)^p-1/(alpha + beta,x + gamma,y + delta,x,y)^p + q$
Notice $x,y$ are variables, and $alpha,beta,gamma,delta, p,$ and $q$ are constants. I need to set a list of assumptions for constants in the function, but my attempts have been fruitless. Every command yields a graph without an image.
I first tried assigning my function with its assumptions by:
Assuming[
x > 0, y > 0, p > 0, α > 0, β > 0, γ > 0, δ > 0,
f[x_, y_] :=
(x*y)^(p - 1)/(α + β*x + γ*y + δ*x*y)^(p + q)]
After the assignment, I tried plotting with ContourPlot
and DensityPlot
.
I'll provide just the ContourPlot
expression below because not much changes across them:
ContourPlot[f[x, y], x, 0, 200, y, 0, 200]
In regards to the ContourPlot
code, I've changed the domain to both larger and smaller numbers to no avail. Neither ContourPlot
nor DensityPlot
provides an image. I then try the code without assigning the function beforehand, while including ContourPlot within the Assuming command:
Assuming[
α > 0, β > 0, γ > 0, δ > 0, p > 0,
ContourPlot[(x*y)^(p - 1)/(α + β*x + γ*y + δ*x*y)^(p + q), x, 0, 3, y, 0, 3]]
I know this equation should produce some sort of image since it's simply a type of truncated distribution function. I believe I've narrowed down the issue to one of the following: Mathematica does not allow assumptions to be used with ContourPlot/DensityPlot
, the distribution function is too complicated for Mathematica, or my user error is hindering me. My next step is to try creating different plots on the same graph for various pre-determined values of the parameters.
Any help is much appreciated. As previously mentioned, I'm not very experienced with Mathematica, so I'm more than willing to learn something new or help further explain my goals.
plotting assumptions
$endgroup$
I'm new to Mathematica, and for most purposes the program has served me well and been straightforward. However, I'm hitting a snag while trying to create a contour plot for the distribution function
$qquad f(x,y) = (x,y)^p-1/(alpha + beta,x + gamma,y + delta,x,y)^p + q$
Notice $x,y$ are variables, and $alpha,beta,gamma,delta, p,$ and $q$ are constants. I need to set a list of assumptions for constants in the function, but my attempts have been fruitless. Every command yields a graph without an image.
I first tried assigning my function with its assumptions by:
Assuming[
x > 0, y > 0, p > 0, α > 0, β > 0, γ > 0, δ > 0,
f[x_, y_] :=
(x*y)^(p - 1)/(α + β*x + γ*y + δ*x*y)^(p + q)]
After the assignment, I tried plotting with ContourPlot
and DensityPlot
.
I'll provide just the ContourPlot
expression below because not much changes across them:
ContourPlot[f[x, y], x, 0, 200, y, 0, 200]
In regards to the ContourPlot
code, I've changed the domain to both larger and smaller numbers to no avail. Neither ContourPlot
nor DensityPlot
provides an image. I then try the code without assigning the function beforehand, while including ContourPlot within the Assuming command:
Assuming[
α > 0, β > 0, γ > 0, δ > 0, p > 0,
ContourPlot[(x*y)^(p - 1)/(α + β*x + γ*y + δ*x*y)^(p + q), x, 0, 3, y, 0, 3]]
I know this equation should produce some sort of image since it's simply a type of truncated distribution function. I believe I've narrowed down the issue to one of the following: Mathematica does not allow assumptions to be used with ContourPlot/DensityPlot
, the distribution function is too complicated for Mathematica, or my user error is hindering me. My next step is to try creating different plots on the same graph for various pre-determined values of the parameters.
Any help is much appreciated. As previously mentioned, I'm not very experienced with Mathematica, so I'm more than willing to learn something new or help further explain my goals.
plotting assumptions
plotting assumptions
edited Mar 4 at 18:47
Banks Osborne
asked Mar 4 at 2:40
Banks OsborneBanks Osborne
183
183
1
$begingroup$
MemberQ[Keys[Options[ContourPlot]], Assumptions]
returnsFalse
, so you can't use assumptions onContourPlot
. Your more pressing problem is that you have neglected to provide concrete values for your parameters, so there really is nothing for the plotter to do. (Also,xy
andx y
are very different things, which contributes to why you can't plot.)
$endgroup$
– J. M. is slightly pensive♦
Mar 4 at 2:47
$begingroup$
That makes sense. I'll stop trying to useAssumptions
withContourPlot
now. I don't know how I didn't catch myself sooner, but I now realize I had typedxy
instead ofx*y
. This actually fixes another, unrelated issue I was having with the code. That said, thank you so much for your help!
$endgroup$
– Banks Osborne
Mar 4 at 3:09
1
$begingroup$
Shouldn't(xy)^(p - 1)/(α + βx + γy + δxy)^(p + q)]
be(x y)^(p - 1)/(α + β x + γ y + δ x y)^(p + q)]
The additional spaces make a big difference.
$endgroup$
– m_goldberg
Mar 4 at 3:59
$begingroup$
Yes, was thinking the same thing, otherwise Mathematica thinks each term is one variable for examplexy
and not the product of these.
$endgroup$
– mjw
Mar 4 at 4:08
$begingroup$
You also need to set the constants to some values to plot your function. To take a simpler example, to plotExp[-x^2 / (2 sigma^2)] / (sigma Sqrt[2 pi]
, you would need to specifysigma
.
$endgroup$
– mjw
Mar 4 at 4:11
|
show 1 more comment
1
$begingroup$
MemberQ[Keys[Options[ContourPlot]], Assumptions]
returnsFalse
, so you can't use assumptions onContourPlot
. Your more pressing problem is that you have neglected to provide concrete values for your parameters, so there really is nothing for the plotter to do. (Also,xy
andx y
are very different things, which contributes to why you can't plot.)
$endgroup$
– J. M. is slightly pensive♦
Mar 4 at 2:47
$begingroup$
That makes sense. I'll stop trying to useAssumptions
withContourPlot
now. I don't know how I didn't catch myself sooner, but I now realize I had typedxy
instead ofx*y
. This actually fixes another, unrelated issue I was having with the code. That said, thank you so much for your help!
$endgroup$
– Banks Osborne
Mar 4 at 3:09
1
$begingroup$
Shouldn't(xy)^(p - 1)/(α + βx + γy + δxy)^(p + q)]
be(x y)^(p - 1)/(α + β x + γ y + δ x y)^(p + q)]
The additional spaces make a big difference.
$endgroup$
– m_goldberg
Mar 4 at 3:59
$begingroup$
Yes, was thinking the same thing, otherwise Mathematica thinks each term is one variable for examplexy
and not the product of these.
$endgroup$
– mjw
Mar 4 at 4:08
$begingroup$
You also need to set the constants to some values to plot your function. To take a simpler example, to plotExp[-x^2 / (2 sigma^2)] / (sigma Sqrt[2 pi]
, you would need to specifysigma
.
$endgroup$
– mjw
Mar 4 at 4:11
1
1
$begingroup$
MemberQ[Keys[Options[ContourPlot]], Assumptions]
returns False
, so you can't use assumptions on ContourPlot
. Your more pressing problem is that you have neglected to provide concrete values for your parameters, so there really is nothing for the plotter to do. (Also, xy
and x y
are very different things, which contributes to why you can't plot.)$endgroup$
– J. M. is slightly pensive♦
Mar 4 at 2:47
$begingroup$
MemberQ[Keys[Options[ContourPlot]], Assumptions]
returns False
, so you can't use assumptions on ContourPlot
. Your more pressing problem is that you have neglected to provide concrete values for your parameters, so there really is nothing for the plotter to do. (Also, xy
and x y
are very different things, which contributes to why you can't plot.)$endgroup$
– J. M. is slightly pensive♦
Mar 4 at 2:47
$begingroup$
That makes sense. I'll stop trying to use
Assumptions
with ContourPlot
now. I don't know how I didn't catch myself sooner, but I now realize I had typed xy
instead of x*y
. This actually fixes another, unrelated issue I was having with the code. That said, thank you so much for your help!$endgroup$
– Banks Osborne
Mar 4 at 3:09
$begingroup$
That makes sense. I'll stop trying to use
Assumptions
with ContourPlot
now. I don't know how I didn't catch myself sooner, but I now realize I had typed xy
instead of x*y
. This actually fixes another, unrelated issue I was having with the code. That said, thank you so much for your help!$endgroup$
– Banks Osborne
Mar 4 at 3:09
1
1
$begingroup$
Shouldn't
(xy)^(p - 1)/(α + βx + γy + δxy)^(p + q)]
be (x y)^(p - 1)/(α + β x + γ y + δ x y)^(p + q)]
The additional spaces make a big difference.$endgroup$
– m_goldberg
Mar 4 at 3:59
$begingroup$
Shouldn't
(xy)^(p - 1)/(α + βx + γy + δxy)^(p + q)]
be (x y)^(p - 1)/(α + β x + γ y + δ x y)^(p + q)]
The additional spaces make a big difference.$endgroup$
– m_goldberg
Mar 4 at 3:59
$begingroup$
Yes, was thinking the same thing, otherwise Mathematica thinks each term is one variable for example
xy
and not the product of these.$endgroup$
– mjw
Mar 4 at 4:08
$begingroup$
Yes, was thinking the same thing, otherwise Mathematica thinks each term is one variable for example
xy
and not the product of these.$endgroup$
– mjw
Mar 4 at 4:08
$begingroup$
You also need to set the constants to some values to plot your function. To take a simpler example, to plot
Exp[-x^2 / (2 sigma^2)] / (sigma Sqrt[2 pi]
, you would need to specify sigma
.$endgroup$
– mjw
Mar 4 at 4:11
$begingroup$
You also need to set the constants to some values to plot your function. To take a simpler example, to plot
Exp[-x^2 / (2 sigma^2)] / (sigma Sqrt[2 pi]
, you would need to specify sigma
.$endgroup$
– mjw
Mar 4 at 4:11
|
show 1 more comment
2 Answers
2
active
oldest
votes
$begingroup$
As has been said in the comments to your question, because all plotting functions are based on strictly numerical calculations, you must give definite values to all six parameters. If you are in the position where you have no good idea how the function behaves as the parameters vary, you can explore the situation with Manipulate
. Here is an example.
f[α_, β_, γ_, δ_, p_, q_][x_, y_] := (x y)^(p - 1)/(α + β x + γ y + δ x y)^(p + q)
With[ϵ = .0001,
Manipulate[
ContourPlot[f[α, β, γ, δ, p, q][x, y], x, 0, 2, y, 0, 2],
α, ϵ, 1, Appearance -> "Labeled",
β, ϵ, 1, Appearance -> "Labeled",
γ, ϵ, 1, Appearance -> "Labeled",
δ, ϵ, 1, Appearance -> "Labeled",
p, 1, 4, 1, Appearance -> "Labeled",
q, 1, 4, 1, Appearance -> "Labeled"]]
Note: I have no clue about what comprise good ranges for either the parameters or the variables. I made some simple assumptions about them. You should revise these assumptions to suit your needs.
$endgroup$
$begingroup$
It looks like you separated out the "constants" and the "variables" in your function definition. Is there any significance to that other than convenience of notation? Where is this documented (just did a quick search for defining functions and did not see it)? Thanks!
$endgroup$
– mjw
Mar 4 at 5:33
$begingroup$
@mjw, this tutorial might be of interest. It is not necessary to separate parameters and variables in this way, but it is definitely convenient.
$endgroup$
– J. M. is slightly pensive♦
Mar 4 at 5:46
$begingroup$
@mjw. It is documented as J.M. points out. A higher level reference which a list of links about topics concerning functions is this one, which included the link given by J.M.
$endgroup$
– m_goldberg
Mar 4 at 5:50
$begingroup$
@mjw. I use this style more for reasons of clarity than convenience.
$endgroup$
– m_goldberg
Mar 4 at 5:54
$begingroup$
@J.M. Thank you! So what isf[a_,b_][x_,y_]
, a function? Or a function of a function? I guess that I understand that now the head of the expression is f[a,b].
$endgroup$
– mjw
Mar 4 at 5:57
|
show 6 more comments
$begingroup$
One way is to simply set the constants as variables in your function definition, and then set them to the values you want when you call the function:
f[x_, y_, α_, β_, γ_, δ_, p_, q_] := (x y)^(p -1)/(α + β x + γ y + δ x y)^(p + q);
ContourPlot[f[x, y, 2, 3, 4, 5, .5, .5], x, 0, 200, y, 0, 200]
$endgroup$
add a comment |
StackExchange.ifUsing("editor", function ()
return StackExchange.using("mathjaxEditing", function ()
StackExchange.MarkdownEditor.creationCallbacks.add(function (editor, postfix)
StackExchange.mathjaxEditing.prepareWmdForMathJax(editor, postfix, [["$", "$"], ["\\(","\\)"]]);
);
);
, "mathjax-editing");
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%2f192559%2fcan-the-assuming-function-be-used-with-contourplot-or-densityplot%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
$begingroup$
As has been said in the comments to your question, because all plotting functions are based on strictly numerical calculations, you must give definite values to all six parameters. If you are in the position where you have no good idea how the function behaves as the parameters vary, you can explore the situation with Manipulate
. Here is an example.
f[α_, β_, γ_, δ_, p_, q_][x_, y_] := (x y)^(p - 1)/(α + β x + γ y + δ x y)^(p + q)
With[ϵ = .0001,
Manipulate[
ContourPlot[f[α, β, γ, δ, p, q][x, y], x, 0, 2, y, 0, 2],
α, ϵ, 1, Appearance -> "Labeled",
β, ϵ, 1, Appearance -> "Labeled",
γ, ϵ, 1, Appearance -> "Labeled",
δ, ϵ, 1, Appearance -> "Labeled",
p, 1, 4, 1, Appearance -> "Labeled",
q, 1, 4, 1, Appearance -> "Labeled"]]
Note: I have no clue about what comprise good ranges for either the parameters or the variables. I made some simple assumptions about them. You should revise these assumptions to suit your needs.
$endgroup$
$begingroup$
It looks like you separated out the "constants" and the "variables" in your function definition. Is there any significance to that other than convenience of notation? Where is this documented (just did a quick search for defining functions and did not see it)? Thanks!
$endgroup$
– mjw
Mar 4 at 5:33
$begingroup$
@mjw, this tutorial might be of interest. It is not necessary to separate parameters and variables in this way, but it is definitely convenient.
$endgroup$
– J. M. is slightly pensive♦
Mar 4 at 5:46
$begingroup$
@mjw. It is documented as J.M. points out. A higher level reference which a list of links about topics concerning functions is this one, which included the link given by J.M.
$endgroup$
– m_goldberg
Mar 4 at 5:50
$begingroup$
@mjw. I use this style more for reasons of clarity than convenience.
$endgroup$
– m_goldberg
Mar 4 at 5:54
$begingroup$
@J.M. Thank you! So what isf[a_,b_][x_,y_]
, a function? Or a function of a function? I guess that I understand that now the head of the expression is f[a,b].
$endgroup$
– mjw
Mar 4 at 5:57
|
show 6 more comments
$begingroup$
As has been said in the comments to your question, because all plotting functions are based on strictly numerical calculations, you must give definite values to all six parameters. If you are in the position where you have no good idea how the function behaves as the parameters vary, you can explore the situation with Manipulate
. Here is an example.
f[α_, β_, γ_, δ_, p_, q_][x_, y_] := (x y)^(p - 1)/(α + β x + γ y + δ x y)^(p + q)
With[ϵ = .0001,
Manipulate[
ContourPlot[f[α, β, γ, δ, p, q][x, y], x, 0, 2, y, 0, 2],
α, ϵ, 1, Appearance -> "Labeled",
β, ϵ, 1, Appearance -> "Labeled",
γ, ϵ, 1, Appearance -> "Labeled",
δ, ϵ, 1, Appearance -> "Labeled",
p, 1, 4, 1, Appearance -> "Labeled",
q, 1, 4, 1, Appearance -> "Labeled"]]
Note: I have no clue about what comprise good ranges for either the parameters or the variables. I made some simple assumptions about them. You should revise these assumptions to suit your needs.
$endgroup$
$begingroup$
It looks like you separated out the "constants" and the "variables" in your function definition. Is there any significance to that other than convenience of notation? Where is this documented (just did a quick search for defining functions and did not see it)? Thanks!
$endgroup$
– mjw
Mar 4 at 5:33
$begingroup$
@mjw, this tutorial might be of interest. It is not necessary to separate parameters and variables in this way, but it is definitely convenient.
$endgroup$
– J. M. is slightly pensive♦
Mar 4 at 5:46
$begingroup$
@mjw. It is documented as J.M. points out. A higher level reference which a list of links about topics concerning functions is this one, which included the link given by J.M.
$endgroup$
– m_goldberg
Mar 4 at 5:50
$begingroup$
@mjw. I use this style more for reasons of clarity than convenience.
$endgroup$
– m_goldberg
Mar 4 at 5:54
$begingroup$
@J.M. Thank you! So what isf[a_,b_][x_,y_]
, a function? Or a function of a function? I guess that I understand that now the head of the expression is f[a,b].
$endgroup$
– mjw
Mar 4 at 5:57
|
show 6 more comments
$begingroup$
As has been said in the comments to your question, because all plotting functions are based on strictly numerical calculations, you must give definite values to all six parameters. If you are in the position where you have no good idea how the function behaves as the parameters vary, you can explore the situation with Manipulate
. Here is an example.
f[α_, β_, γ_, δ_, p_, q_][x_, y_] := (x y)^(p - 1)/(α + β x + γ y + δ x y)^(p + q)
With[ϵ = .0001,
Manipulate[
ContourPlot[f[α, β, γ, δ, p, q][x, y], x, 0, 2, y, 0, 2],
α, ϵ, 1, Appearance -> "Labeled",
β, ϵ, 1, Appearance -> "Labeled",
γ, ϵ, 1, Appearance -> "Labeled",
δ, ϵ, 1, Appearance -> "Labeled",
p, 1, 4, 1, Appearance -> "Labeled",
q, 1, 4, 1, Appearance -> "Labeled"]]
Note: I have no clue about what comprise good ranges for either the parameters or the variables. I made some simple assumptions about them. You should revise these assumptions to suit your needs.
$endgroup$
As has been said in the comments to your question, because all plotting functions are based on strictly numerical calculations, you must give definite values to all six parameters. If you are in the position where you have no good idea how the function behaves as the parameters vary, you can explore the situation with Manipulate
. Here is an example.
f[α_, β_, γ_, δ_, p_, q_][x_, y_] := (x y)^(p - 1)/(α + β x + γ y + δ x y)^(p + q)
With[ϵ = .0001,
Manipulate[
ContourPlot[f[α, β, γ, δ, p, q][x, y], x, 0, 2, y, 0, 2],
α, ϵ, 1, Appearance -> "Labeled",
β, ϵ, 1, Appearance -> "Labeled",
γ, ϵ, 1, Appearance -> "Labeled",
δ, ϵ, 1, Appearance -> "Labeled",
p, 1, 4, 1, Appearance -> "Labeled",
q, 1, 4, 1, Appearance -> "Labeled"]]
Note: I have no clue about what comprise good ranges for either the parameters or the variables. I made some simple assumptions about them. You should revise these assumptions to suit your needs.
edited Mar 4 at 5:58
answered Mar 4 at 4:42
m_goldbergm_goldberg
88k872199
88k872199
$begingroup$
It looks like you separated out the "constants" and the "variables" in your function definition. Is there any significance to that other than convenience of notation? Where is this documented (just did a quick search for defining functions and did not see it)? Thanks!
$endgroup$
– mjw
Mar 4 at 5:33
$begingroup$
@mjw, this tutorial might be of interest. It is not necessary to separate parameters and variables in this way, but it is definitely convenient.
$endgroup$
– J. M. is slightly pensive♦
Mar 4 at 5:46
$begingroup$
@mjw. It is documented as J.M. points out. A higher level reference which a list of links about topics concerning functions is this one, which included the link given by J.M.
$endgroup$
– m_goldberg
Mar 4 at 5:50
$begingroup$
@mjw. I use this style more for reasons of clarity than convenience.
$endgroup$
– m_goldberg
Mar 4 at 5:54
$begingroup$
@J.M. Thank you! So what isf[a_,b_][x_,y_]
, a function? Or a function of a function? I guess that I understand that now the head of the expression is f[a,b].
$endgroup$
– mjw
Mar 4 at 5:57
|
show 6 more comments
$begingroup$
It looks like you separated out the "constants" and the "variables" in your function definition. Is there any significance to that other than convenience of notation? Where is this documented (just did a quick search for defining functions and did not see it)? Thanks!
$endgroup$
– mjw
Mar 4 at 5:33
$begingroup$
@mjw, this tutorial might be of interest. It is not necessary to separate parameters and variables in this way, but it is definitely convenient.
$endgroup$
– J. M. is slightly pensive♦
Mar 4 at 5:46
$begingroup$
@mjw. It is documented as J.M. points out. A higher level reference which a list of links about topics concerning functions is this one, which included the link given by J.M.
$endgroup$
– m_goldberg
Mar 4 at 5:50
$begingroup$
@mjw. I use this style more for reasons of clarity than convenience.
$endgroup$
– m_goldberg
Mar 4 at 5:54
$begingroup$
@J.M. Thank you! So what isf[a_,b_][x_,y_]
, a function? Or a function of a function? I guess that I understand that now the head of the expression is f[a,b].
$endgroup$
– mjw
Mar 4 at 5:57
$begingroup$
It looks like you separated out the "constants" and the "variables" in your function definition. Is there any significance to that other than convenience of notation? Where is this documented (just did a quick search for defining functions and did not see it)? Thanks!
$endgroup$
– mjw
Mar 4 at 5:33
$begingroup$
It looks like you separated out the "constants" and the "variables" in your function definition. Is there any significance to that other than convenience of notation? Where is this documented (just did a quick search for defining functions and did not see it)? Thanks!
$endgroup$
– mjw
Mar 4 at 5:33
$begingroup$
@mjw, this tutorial might be of interest. It is not necessary to separate parameters and variables in this way, but it is definitely convenient.
$endgroup$
– J. M. is slightly pensive♦
Mar 4 at 5:46
$begingroup$
@mjw, this tutorial might be of interest. It is not necessary to separate parameters and variables in this way, but it is definitely convenient.
$endgroup$
– J. M. is slightly pensive♦
Mar 4 at 5:46
$begingroup$
@mjw. It is documented as J.M. points out. A higher level reference which a list of links about topics concerning functions is this one, which included the link given by J.M.
$endgroup$
– m_goldberg
Mar 4 at 5:50
$begingroup$
@mjw. It is documented as J.M. points out. A higher level reference which a list of links about topics concerning functions is this one, which included the link given by J.M.
$endgroup$
– m_goldberg
Mar 4 at 5:50
$begingroup$
@mjw. I use this style more for reasons of clarity than convenience.
$endgroup$
– m_goldberg
Mar 4 at 5:54
$begingroup$
@mjw. I use this style more for reasons of clarity than convenience.
$endgroup$
– m_goldberg
Mar 4 at 5:54
$begingroup$
@J.M. Thank you! So what is
f[a_,b_][x_,y_]
, a function? Or a function of a function? I guess that I understand that now the head of the expression is f[a,b].$endgroup$
– mjw
Mar 4 at 5:57
$begingroup$
@J.M. Thank you! So what is
f[a_,b_][x_,y_]
, a function? Or a function of a function? I guess that I understand that now the head of the expression is f[a,b].$endgroup$
– mjw
Mar 4 at 5:57
|
show 6 more comments
$begingroup$
One way is to simply set the constants as variables in your function definition, and then set them to the values you want when you call the function:
f[x_, y_, α_, β_, γ_, δ_, p_, q_] := (x y)^(p -1)/(α + β x + γ y + δ x y)^(p + q);
ContourPlot[f[x, y, 2, 3, 4, 5, .5, .5], x, 0, 200, y, 0, 200]
$endgroup$
add a comment |
$begingroup$
One way is to simply set the constants as variables in your function definition, and then set them to the values you want when you call the function:
f[x_, y_, α_, β_, γ_, δ_, p_, q_] := (x y)^(p -1)/(α + β x + γ y + δ x y)^(p + q);
ContourPlot[f[x, y, 2, 3, 4, 5, .5, .5], x, 0, 200, y, 0, 200]
$endgroup$
add a comment |
$begingroup$
One way is to simply set the constants as variables in your function definition, and then set them to the values you want when you call the function:
f[x_, y_, α_, β_, γ_, δ_, p_, q_] := (x y)^(p -1)/(α + β x + γ y + δ x y)^(p + q);
ContourPlot[f[x, y, 2, 3, 4, 5, .5, .5], x, 0, 200, y, 0, 200]
$endgroup$
One way is to simply set the constants as variables in your function definition, and then set them to the values you want when you call the function:
f[x_, y_, α_, β_, γ_, δ_, p_, q_] := (x y)^(p -1)/(α + β x + γ y + δ x y)^(p + q);
ContourPlot[f[x, y, 2, 3, 4, 5, .5, .5], x, 0, 200, y, 0, 200]
edited Mar 4 at 6:14
m_goldberg
88k872199
88k872199
answered Mar 4 at 4:20
mjwmjw
1,21810
1,21810
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%2f192559%2fcan-the-assuming-function-be-used-with-contourplot-or-densityplot%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
1
$begingroup$
MemberQ[Keys[Options[ContourPlot]], Assumptions]
returnsFalse
, so you can't use assumptions onContourPlot
. Your more pressing problem is that you have neglected to provide concrete values for your parameters, so there really is nothing for the plotter to do. (Also,xy
andx y
are very different things, which contributes to why you can't plot.)$endgroup$
– J. M. is slightly pensive♦
Mar 4 at 2:47
$begingroup$
That makes sense. I'll stop trying to use
Assumptions
withContourPlot
now. I don't know how I didn't catch myself sooner, but I now realize I had typedxy
instead ofx*y
. This actually fixes another, unrelated issue I was having with the code. That said, thank you so much for your help!$endgroup$
– Banks Osborne
Mar 4 at 3:09
1
$begingroup$
Shouldn't
(xy)^(p - 1)/(α + βx + γy + δxy)^(p + q)]
be(x y)^(p - 1)/(α + β x + γ y + δ x y)^(p + q)]
The additional spaces make a big difference.$endgroup$
– m_goldberg
Mar 4 at 3:59
$begingroup$
Yes, was thinking the same thing, otherwise Mathematica thinks each term is one variable for example
xy
and not the product of these.$endgroup$
– mjw
Mar 4 at 4:08
$begingroup$
You also need to set the constants to some values to plot your function. To take a simpler example, to plot
Exp[-x^2 / (2 sigma^2)] / (sigma Sqrt[2 pi]
, you would need to specifysigma
.$endgroup$
– mjw
Mar 4 at 4:11