New Reply

Mathematica:how to plot a maximum point in a graph

 
Share Thread Thread Tools
Mar29-12, 01:15 AM   #1
 

Mathematica:how to plot a maximum point in a graph


anyone can help me to plot a point.

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

Code:
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
 
PhysOrg.com
PhysOrg
science news on PhysOrg.com

>> 'Whodunnit' of Irish potato famine solved
>> The mammoth's lament: Study shows how cosmic impact sparked devastating climate change
>> Curiosity Mars rover drills second rock target
Mar29-12, 01:52 AM   #2
 
Quote by shafieza_garl View Post
anyone can help me to plot a point.

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

Code:
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.
 
Mar29-12, 12:26 PM   #3
 
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]
 
Mar30-12, 12:34 AM   #4
 

Mathematica:how to plot a maximum point in a graph


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).
Code:
onedot = ListPlot[{j, k} /. Rest[FindMaximum[Sin[j], {j, Pi}]],  PlotStyle -> {Hue[0.67], AbsolutePointSize[7]}];
is this possible to do?
thanks again.
 
Mar30-12, 01:34 AM   #5
 
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]
 
New Reply
Thread Tools


Similar Threads for: Mathematica:how to plot a maximum point in a graph
Thread Forum Replies
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