0
|
6998 Views
|
10 Replies
|
1 Total Likes
View groups...
Share
GROUPS:

# 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
10 Replies
Sort By:
Posted 11 years ago
 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 11 years ago
 I have learned shorter way to handle it.f[x_] := a x^2;Manipulate[Plot[#, {x, -2, 2}], {a, 0, 1}]&@f[x]
Posted 11 years ago
 when I try to definef[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 11 years ago
 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_cThanks again for helping me..
Posted 11 years ago
 >> Do you think we can remove leftYes, it is possible. To delete the left dote you shoud take only max in VAL  for POINTS .>>  k_c below the right dotDefine the "below" to be - max of y scale and modify the second arg in the LETTERI suggest you to do it on your own, see Graphics[], ListPlot[], Point[] and other related manuals.I.M.
Posted 11 years ago
 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  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 11 years ago
 Ok, you are quite demanding  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 axesI.M.
Posted 11 years ago
 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 11 years ago
 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 11 years ago
 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]