Message Boards Message Boards

0
|
3013 Views
|
1 Reply
|
1 Total Likes
View groups...
Share
Share this post:

Manipulate Question

Posted 10 years ago

Hello,

I'm new to Manipulations in Mathematica. I built a manipulation, but I'm having problems adding dashed lines and dynamic numerical labels. Here's what I have so far:

Manipulate[Plot[((a/(1 - b)) + (b/(1 - b))*c), {c, 0, 100}, 
  PlotRange -> {{0, 100}, {0, 300}}, AxesOrigin -> {0, 0}, 
  AxesLabel -> {Xaxis, Yaxis}], {{a, 30}, 0, 50}, {{b, .6}, .0000001, 
  1}, {{c, 90}, 0, 100}]

The initial value of the independent variable (c) is 90. When the independent variable is (c) is 90, the dependent variable is 210.

How can I add a dashed line from the value of the independent variable (90) to the curve? How can I add a dashed line from curve to the value of the dependent variable on the y-axis (210)?

For example, this demonstration has dashed lines from each axis to the curve(s): http://www.demonstrations.wolfram.com/BasicSupplyAndDemand/ ... I would like to add similar dashed lines to my manipulation. How is this done?

Finally, how can I add a dynamic label to the x-axis that indicates the value of the independent variable? How can I do the same for the y-axis? The demonstration in the link above has such labels, but they are not numerical. I'm looking to add dynamic numerical labels to both axes that will change as the independent variable changes. How is this done?

Thanks for your help, I appreciate it!

Attachments:
POSTED BY: Edo Nomics
 Manipulate[Plot[((a/(1 - b)) + (b/(1 - b))*c), {c, 0, 100}, 
       PlotRange -> {{0, 100}, {0, 300}}, AxesOrigin -> {0, 0}, 
       AxesLabel -> {"X", "Y"}], {{a, 30}, 0, 50}, {{b, .6}, .0000001, 1}, {{c, 90}, 0, 100}]

you cannot use the same variable c for that task: inside Plot[] as well as dynamic variable. Use x as running variable in the Plot[] instead. An Epilog with the dynamic variable c does it

Manipulate[Plot[((a/(1 - b)) + (b/(1 - b))*x), {x, 0, 100}, 
  PlotRange -> {{-30, 100}, {-60, 300}}, 
  AxesOrigin -> {0, 0}, AxesLabel -> {"X", "Y"}, 
  Epilog -> {{Dashed, Red, Line[{{c, 0}, {c, ((a/(1 - b)) + (b/(1 - b))*c)}}]},
    {Dashed, Green, Line[{{0, ((a/(1 - b)) + (b/(1 - b))*c)}, {c, ((a/(1 - b)) + (b/(1 - b))*c)}}]}, 
    Style[Text[c, {c, -40}], Medium],
    Style[Text[((a/(1 - b)) + (b/(1 - b))*c), {-20, ((a/(1 - b)) + (b/(1 - b))*c)}], Medium]}], 
  {{a, 30}, 0, 50}, {{b, .6}, .0000001, 1}, {{c, 90}, 0, 100}] 

One should also use a function definition in order not to be forced to type in the same function four times, the so called single point of definition principle.

enter image description here

POSTED BY: Udo Krause
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract