Mathematica:how to plot a maximum point in a graph


by shafieza_garl
Tags: graph, mathematicahow, maximum, plot, point
shafieza_garl
shafieza_garl is offline
#1
Mar29-12, 01:15 AM
P: 20
anyone can help me to plot a point.

 r = Plot[Sin[j], {j, 0, Pi}];
what i am doing is i use FindMaximum first to know the point of maximum.
FindMaximum[Sin[j], {j, Pi}]
then i manually key in the x,y coordinate from the search.

onedot = ListPlot[{{1.5707963267948966, 1}}, 
   PlotStyle -> {Hue[0.67], AbsolutePointSize[7]}];
Show[r, onedot]
is there any way i can plot the maximum point without key-in manually using the findmaximum point.
thanks
Phys.Org News Partner Science news on Phys.org
Lemurs match scent of a friend to sound of her voice
Repeated self-healing now possible in composite materials
'Heartbleed' fix may slow Web performance
chiro
chiro is offline
#2
Mar29-12, 01:52 AM
P: 4,570
Quote Quote by shafieza_garl View Post
anyone can help me to plot a point.

 r = Plot[Sin[j], {j, 0, Pi}];
what i am doing is i use FindMaximum first to know the point of maximum.
FindMaximum[Sin[j], {j, Pi}]
then i manually key in the x,y coordinate from the search.

onedot = ListPlot[{{1.5707963267948966, 1}}, 
   PlotStyle -> {Hue[0.67], AbsolutePointSize[7]}];
Show[r, onedot]
is there any way i can plot the maximum point without key-in manually using the findmaximum point.
thanks
One suggestion I have is to create a test function with {-1,0} {0,maxpoint} and {+1,0) and then plot that data like any other data. If you need to adjust scaling or if Mathematica produces a very narrow graph then make the non-max points larger in the respective directions.

If you need the point at its original position then just add the x coordinate to every x point in the dataset.
Bill Simpson
Bill Simpson is offline
#3
Mar29-12, 12:26 PM
P: 971
r = Plot[Sin[j], {j, 0, Pi}];
onedot = ListPlot[{j, 1} /. Rest[FindMaximum[Sin[j], {j, Pi}]], PlotStyle -> {Hue[0.67], AbsolutePointSize[7]}];
Show[r, onedot]

shafieza_garl
shafieza_garl is offline
#4
Mar30-12, 12:34 AM
P: 20

Mathematica:how to plot a maximum point in a graph


Quote Quote by Bill Simpson View Post
r = Plot[Sin[j], {j, 0, Pi}];
onedot = ListPlot[{j, 1} /. Rest[FindMaximum[Sin[j], {j, Pi}]], PlotStyle -> {Hue[0.67], AbsolutePointSize[7]}];
Show[r, onedot]
thanx 4 ur reply.1 more question. if i dont want to put value 1 by myself and i want the same as finding the j-value(using findmaximum).
onedot = ListPlot[{j, k} /. Rest[FindMaximum[Sin[j], {j, Pi}]],  PlotStyle -> {Hue[0.67], AbsolutePointSize[7]}];
is this possible to do?
thanks again.
Bill Simpson
Bill Simpson is offline
#5
Mar30-12, 01:34 AM
P: 971
r = Plot[Sin[j], {j, 0, Pi}];
onedot = ListPlot[{j, Sin[j]} /. Rest[FindMaximum[Sin[j], {j, Pi}]], \
PlotStyle -> {Hue[0.67], AbsolutePointSize[7]}];
Show[r, onedot]


Register to reply

Related Discussions
Plot 3D matrix as 2D plot and 3rd dimension as color in Mathematica Math & Science Software 8
How to plot it graph in Mathematica General Physics 4
Creating equation out of 5 point or more from graph plot. Calculus 5
Rasterized density plot + countour plot in Mathematica (to solve EPS issues) Math & Science Software 0
Tracing a point on a graph and displaying the y value - Mathematica Math & Science Software 0