Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2009

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Re: simple Question

  • To: mathgroup at smc.vnet.net
  • Subject: [mg99716] Re: [mg99707] Re: simple Question
  • From: DrMajorBob <btreat1 at austin.rr.com>
  • Date: Tue, 12 May 2009 03:08:06 -0400 (EDT)
  • References: <gu667g$9ud$1@smc.vnet.net> <200905111028.GAA07151@smc.vnet.net>
  • Reply-to: drmajorbob at bigfoot.com

This finds a maximum on EACH curve:

Cases[Plot[Sin@x, {x, 0, Pi}],
  Line[pts_List] :> Max@pts[[All, 2]], Infinity
Max@%

{1.}

1.

Cases[Table[Plot[x Sin[k x], {x, 0, Pi}], {k, 0, 13}],
  Line[pts_List] :> Max@pts[[All, 2]], Infinity]

Max@%

{0., 1.81971, 0.909853, 2.63891, 1.97918, 2.83447, 2.36206, 2.92068, \
2.5556, 2.96913, 2.67221, 3.00017, 2.75015, 3.02171}

3.02171

This doesn't require knowing the structure of the Plot or other graphic  
(only that it's made up of Lines), so it might not change from version to  
version.

Bobby

On Mon, 11 May 2009 05:28:11 -0500, Sjoerd C. de Vries  
<sjoerd.c.devries at gmail.com> wrote:

> Hi Oliver,
>
> Various possibilities here:
>
> If you just want to quickly know the maximum value shown in the plot
> you may select the plot, press shift-period and move the cursor to the
> highest point in your plot. The maximum will be in the tooltip.
>
> Second possibility is to examine the graphics commands underlying the
> plot. You can see them if you use FullForm. You have to delve deep for
> the nested data you need, but you can get there. For example:
> (Plot[Sin[x], {x, 0, Pi}] // FullForm)[[1, 1, 1, 3, 2, 1, All,
>    2]] // Max
>
> Third possibility is to use MaxValue or Maximize on the function you
> plotted using the plotrange as constraint:
> MaxValue[{Sin[Cos[5 x]], 0 <= x <= 2 \[Pi]}, x]
>
> Hope this helps.
>
> Cheers -- Sjoerd
>
>
> On May 10, 11:19 am, Oliver <sch_oliver2... at yahoo.de> wrote:
>> Hallo,
>> how can i read the max value in a plot in mathematica?
>> thanks in advance..
>> Oli.
>
>



-- 
DrMajorBob at bigfoot.com


  • Prev by Date: Re: Re: derivative of a well-behaved function
  • Next by Date: Re: Re: Replace specific element with specific value.
  • Previous by thread: Re: simple Question
  • Next by thread: Re: simple question