Message Boards Message Boards

0
|
6846 Views
|
10 Replies
|
1 Total Likes
View groups...
Share
Share this post:

how to label x-intercept in plot

Posted 11 years ago
Hi All,

I would like to label x-intercept as k_c. Any suggestion.

Thanks in advance..
Manipulate[
Plot[B k^4 (-M + E^-Subscript[h, 0] M - E^-Subscript[h, 0] G M +
      15 M \[Epsilon] - 15 E^-Subscript[h, 0] M \[Epsilon]) +
   k^2 (B E^-Subscript[h, 0] M - B E^-Subscript[h, 0] G M - A Mp +
      B E^-Subscript[h, 0] M \[Epsilon]), {k, 0, 7}, Frame -> True,
  FrameLabel -> {"k", \[Omega]}, RotateLabel -> False,
  FrameTicks -> None], {A, -1, 100}, {Mp, -5, 10}, {Subscript[h, 0],
  1, 4}, {G, 1, 4}, {\[Epsilon], 0, 1/15}, {B, 8, 8}, {M, 1, 1}]

every value is left value but just change A=70
POSTED BY: selahittin cinar
10 Replies
I have learned shorter way to handle it.
f[x_] := a x^2;
Manipulate[Plot[#, {x, -2, 2}], {a, 0, 1}]&@f[x]
POSTED BY: selahittin cinar
That is due to Plot[], because:
Plot has attribute HoldAll and evaluates f only after assigning specific numerical values to x.

This is how you deal with it:
f[x_] := A x^2;
Manipulate[
LIST = {A -> a};
Plot[f[x] /. LIST, {x, -2, 2}] ,
{a, 0, 1}]

I.M.
POSTED BY: Ivan Morozov
when I try to define
f[k_]:=B k^4 (-M+E^-Subscript[h, 0] M-E^-Subscript[h, 0] G M+15 M \[Epsilon]-15 E^-Subscript[h, 0] M \[Epsilon])+k^2 (B E^-Subscript[h, 0] M-B E^-Subscript[h, 0] G M-A Mp+B E^-Subscript[h, 0] M \[Epsilon])
Manipulate does not work, I do not know why.  That's why I pasted long function in code..
 Manipulate[
  Plot[B k^4 (-M + E^-Subscript[h, 0] M - E^-Subscript[h, 0] G M +
       15 M \[Epsilon] - 15 E^-Subscript[h, 0] M \[Epsilon]) +
    k^2 (B E^-Subscript[h, 0] M - B E^-Subscript[h, 0] G M - A Mp +
       B E^-Subscript[h, 0] M \[Epsilon]), {k, 0, 7}, Frame -> True,
   FrameLabel -> {"k", \[Omega]}, RotateLabel -> False,
   FrameTicks -> None,
   Epilog -> {PointSize[
      Large], (Point[{#, (B k^4 (-M + E^-Subscript[h, 0] M -
               E^-Subscript[h, 0] G M + 15 M \[Epsilon] -
               15 E^-Subscript[h, 0] M \[Epsilon]) +
            k^2 (B E^-Subscript[h, 0] M - B E^-Subscript[h, 0] G M -
               A Mp + B E^-Subscript[h, 0] M \[Epsilon])) /.
          k -> #}] &) /@ (k /.
       NSolve[(B k^4 (-M + E^-Subscript[h, 0] M -
               E^-Subscript[h, 0] G M + 15 M \[Epsilon] -
               15 E^-Subscript[h, 0] M \[Epsilon]) +
            k^2 (B E^-Subscript[h, 0] M - B E^-Subscript[h, 0] G M -
               A Mp + B E^-Subscript[h, 0] M \[Epsilon])) == 0 &&
         k > 0, k])}], {A, -1, 100}, {Mp, -5, 10}, {Subscript[h, 0],
  1, 4}, {G, 1, 4}, {\[Epsilon], 0, 1/15}, {B, 8, 8}, {M, 1, 1}]
POSTED BY: selahittin cinar
I figured it out to remove left point. I just modified nsolve like bla bla bla==0&&k>0,k] instead of all reals..

I could not handle to change position of k_c

Thanks again for helping me..
POSTED BY: selahittin cinar
>> Do you think we can remove left
Yes, it is possible. To delete the left dote you shoud take only max in VAL  for POINTS .
>>  k_c below the right dot
Define the "below" to be - max of y scale and modify the second arg in the LETTER

I suggest you to do it on your own, see Graphics[], ListPlot[], Point[] and other related manuals.

I.M.
POSTED BY: Ivan Morozov
This is what I want.. Thank you...  Do you think we can remove left dot  and also write k_c   below the right dot.  if it is hard to do that dont worry, this is quite enough emoticon
 Manipulate[
  VAL = Evaluate[
    k /. NSolve[
      B*k^4*(-M + M/E^Subscript[h, 0] - (G*M)/E^Subscript[h, 0] +
           15*M*\[Epsilon] - (15*M*\[Epsilon])/E^Subscript[h, 0]) +
        k^2*((B*M)/E^Subscript[h, 0] - (B*G*M)/E^Subscript[h, 0] -
           A*Mp + (B*M*\[Epsilon])/E^Subscript[h, 0]) == 0, k, Reals]];
  POINTS =
   Graphics[{PointSize[Large],
    Point[Table[{VAL[[i]], 0}, {i, 1, Length@VAL}]]}];
GRAPH = Plot[
   B*k^4*(-M + M/E^Subscript[h, 0] - (G*M)/E^Subscript[h, 0] +
       15*M*\[Epsilon] - (15*M*\[Epsilon])/E^Subscript[h, 0]) +
    k^2*((B*M)/E^Subscript[h, 0] - (B*G*M)/E^Subscript[h, 0] -
       A*Mp + (B*M*\[Epsilon])/E^Subscript[h, 0]), {k, 0, 7},
   Frame -> True, FrameLabel -> {"k", \[Omega]}, RotateLabel -> False,
    FrameTicks -> None];
LETTER = ListPlot[{{1.1 Max@VAL, 0}}, PlotMarkers -> {"\!\(\*
     StyleBox[\"\!\(\*SubscriptBox[\(k\), \(c\)]\)\",\n\
FontSize->15]\)"}];
Show[GRAPH, POINTS, LETTER], {A, -1, 100}, {Mp, -5,
  10}, {Subscript[h, 0], 1, 4}, {G, 1, 4}, {\[Epsilon], 0, 1/15}, {B,
  8, 8}, {M, 1, 1}]
POSTED BY: selahittin cinar
Ok, you are quite demanding emoticon
 Manipulate[
 
  VAL = Evaluate[
    k /. NSolve[
      B*k^4*(-M + M/E^Subscript[h, 0] - (G*M)/E^Subscript[h, 0] +
           15*M*\[Epsilon] - (15*M*\[Epsilon])/E^Subscript[h, 0]) +
        k^2*((B*M)/E^Subscript[h, 0] - (B*G*M)/E^Subscript[h, 0] -
           A*Mp + (B*M*\[Epsilon])/E^Subscript[h, 0]) == 0, k, Reals]];
  POINTS =   Graphics[{PointSize[Large], Pink,
    Point[Table[{VAL[[i]], 0}, {i, 1, Length@VAL}]]}];
GRAPH = Plot[
   B*k^4*(-M + M/E^Subscript[h, 0] - (G*M)/E^Subscript[h, 0] +
       15*M*\[Epsilon] - (15*M*\[Epsilon])/E^Subscript[h, 0]) +
    k^2*((B*M)/E^Subscript[h, 0] - (B*G*M)/E^Subscript[h, 0] -
       A*Mp + (B*M*\[Epsilon])/E^Subscript[h, 0]), {k, 0, 7},
   Frame -> True, FrameLabel -> {"k", \[Omega]}, RotateLabel -> False,
    GridLines -> {{Max@VAL}, {}}];
LETTER = ListPlot[{{1.1 Max@VAL, 0}}, PlotMarkers -> {"\!\(\*
StyleBox[\"\[HappySmiley]\",\nFontSize->18]\)"}];
Show[GRAPH, POINTS, LETTER], {A, -1, 100}, {Mp, -5,10}, {Subscript[h, 0], 1, 4}, {G, 1, 4}, {\[Epsilon], 0, 1/15}, {B, 8, 8}, {M, 1, 1}]
Also you can add LINE = Graphics[Graphics[Line[{{0, 0}, {Max@VAL, 0}}]]]; instead x=0 axes

I.M.
POSTED BY: Ivan Morozov
Thank you for replying me.

It is kinda right but also I would like to see "k_c"  on my graph at the  x-intercept
POSTED BY: selahittin cinar
Hi,

It this what you need?
 Manipulate[
 
   VAL = Evaluate[ k /. NSolve[
      B*k^4*(-M + M/E^Subscript[h, 0] - (G*M)/E^Subscript[h, 0] +
           15*M*\[Epsilon] - (15*M*\[Epsilon])/E^Subscript[h, 0]) +
        k^2*((B*M)/E^Subscript[h, 0] - (B*G*M)/E^Subscript[h, 0] -
           A*Mp + (B*M*\[Epsilon])/E^Subscript[h, 0]) == 0, k, Reals]];
  POINTS = Graphics[{PointSize[Large], Pink,
     Point[Table[{VAL[[i]], 0}, {i, 1, Length@VAL}]]}];
GRAPH = Plot[
   B*k^4*(-M + M/E^Subscript[h, 0] - (G*M)/E^Subscript[h, 0] +
       15*M*\[Epsilon] - (15*M*\[Epsilon])/E^Subscript[h, 0]) +
    k^2*((B*M)/E^Subscript[h, 0] - (B*G*M)/E^Subscript[h, 0] -
       A*Mp + (B*M*\[Epsilon])/E^Subscript[h, 0]), {k, 0, 7},
    Frame -> True, FrameLabel -> {"k", \[Omega]},
   RotateLabel -> False];
Show[GRAPH, POINTS]
, {A, -1, 100}, {Mp, -5, 10}, {Subscript[h, 0], 1, 4}, {G, 1,4}, {\[Epsilon], 0, 1/15},
   {B, 8, 8}, {M, 1, 1}]

I.M.
POSTED BY: Ivan Morozov
Hello,
Are you sure your x-intercept has real values?
y = B k^4 (-M + E^-Subscript[h, 0] M - E^-Subscript[h, 0] G M +
    15 M \[Epsilon] - 15 E^-Subscript[h, 0] M \[Epsilon]) +
k^2 (B E^-Subscript[h, 0] M - B E^-Subscript[h, 0] G M - A Mp +
    B E^-Subscript[h, 0] M \[Epsilon])

Solve[y==0,k]
POSTED BY: W. Craig Carter
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