0
$\begingroup$

About this post:

Mapping multiple parameters of a function to specific values

I wonder if the parameters a and b have ranges with steps, as: a-> {1,5,0.5}, which means a =1,1.5,2,...,5.

How the definition of the parameters will be written then instead being with fixed values as in the referred post

parameters = {{1/2, 1/2}, {1, 1/3}, {2, 1/4}, {0.5, 1/5}}; ?

$\endgroup$
  • $\begingroup$ Yeah, realized that, deleted comment... $\endgroup$ – ciao May 24 '16 at 6:05
  • $\begingroup$ Please make this question self contained. Prepare minimal example and tell us what exactly do you want to get. Do you want to plot all possible combinations of generated parameters or maybe respective pairs, etc etc. $\endgroup$ – Kuba May 24 '16 at 9:48
  • $\begingroup$ @Kuba. I just will repeat the previous question in the post I referred to ! put as I said in the question I want the parameters go to ranges not for specific values $\endgroup$ – S.S. May 24 '16 at 10:44
  • $\begingroup$ @S.S. What haven't you got from my comment? I understand you want ranges. $\endgroup$ – Kuba May 24 '16 at 10:50
  • $\begingroup$ @ Kuba. Fine !! $\endgroup$ – S.S. May 24 '16 at 11:02
2
$\begingroup$

Use Mapping multiple parameters of a function to specific values and supply it with the following version of parameters.

parameters=Flatten[Table[{a, 1/bInverted}, {a, 1/2, 5, 1/2}, {bInverted, 2, 5}], 1]

Update

Let's redefine myfunction to be a function of a, b and x.

myfunction[a_, b_, x_] := (b/a)*((a/x)^(b + 1))

Now when you generate parameters

parameters = Flatten[
   Table[{a, 1/bInverted}, {a, 1/2, 5, 1/2}, {bInverted, 2, 5}], 1]

and plot it

Plot[myfunction[Sequence @@ #, x] & /@ parameters, {x, 0, 3},
 Evaluated -> True]

Mathematica graphics

you get several lines.

You ask

But is there a way in this case to plot myfunction in a single line instead versus x for continuous regions for a and b ?

Certainly it can't be done as a single line, but you could plot a band between the lowest and highest values similar to Plot confidence interval around curve.

A test shows that the lowest values are achieved with the minimum for a and b and the largest values for the maximum. So we plot two curves and area shade between them.

Plot[{myfunction[1/2, 1/5, x], myfunction[5, 1/2, x]}, {x, 0, 3}, 
 Filling -> {2 -> {1}}, FillingStyle -> Directive[Opacity[.3], Gray], 
 PlotStyle -> Black]

Mathematica graphics

$\endgroup$
  • $\begingroup$ I know that names are arbitrary but x is not a parameter in linked question so it may be confusing here. Also, there is a pair of values and it's not clear if OP wants pair of ranges or multiple pairs. $\endgroup$ – Kuba May 24 '16 at 11:07
  • $\begingroup$ @Kuba I couldn't figure how to get an interator of the form {b, 1/2, 1/5} so thought it would be better to use x. I will change it to bInverted. $\endgroup$ – Jack LaVigne May 24 '16 at 11:24
  • $\begingroup$ @ Jack LaVigne. Ok I used: parameters=Flatten[Table[{a, b}, {a, 1/2, 5, 1/2}, {b, 2, 5,1/2}], 1] , because a and b are the independent parameters and x is the variable i want to plot myfunction versus it as in the previous example. I got a several lines for myfunction according to the {a,b} generated pairs. But is there a way in this case to plot myfunction in a single line instead versus x for continuous regions for a and b ?. $\endgroup$ – S.S. May 24 '16 at 11:39
  • $\begingroup$ Herply thanks @Jack LaVigne for your effort, I will try it.. $\endgroup$ – S.S. May 24 '16 at 14:58
  • $\begingroup$ Hay @Kuba, thanks for your trail to understand my question .. $\endgroup$ – S.S. May 24 '16 at 15:03

Not the answer you're looking for? Browse other questions tagged or ask your own question.