Code Comments

Programming Forum and web based access to our favorite programming groups.
For Programmers: Free Programming Magazines | New: Database administration forum
Registration is free! Edit your profileCalendarFind other membersFrequently Asked QuestionsSearch -> 
Post New Thread











Thread
Author

relative optimas
Hello group

Is there a function that can help in doing the task below or do I need
to write something up?

I need to get the index of the relative “local” maximums and minimums in
a sequence or real numbers.

Say a={5,4,2,2,2,2,2,7}
The index I need is the one belong to the first occurrence of the number
2, which is the third number in the above sequence for a local minimum.

Say a={5,8,2,1}
The index I need is the one belongs to the number 8, which is the second
in the sequence for the local maximum.

Say a={5,4,2,2,2,7,2}
The index I need is the ones belong to the first 2 and then the 7. as an
index of local minimum and maximum respectively.

Thanks



Report this thread to moderator Post Follow-up to this message
Old Post
Baloff
06-05-05 08:57 PM


Re: relative optimas

>
> Say a={5,4,2,2,2,2,2,7}
> The index I need is the one belong to the first occurrence of the number
> 2, which is the third number in the above sequence for a local minimum.
>
index = minloc(a)

> Say a={5,8,2,1}
> The index I need is the one belongs to the number 8, which is the second
> in the sequence for the local maximum.
>

index = maxloc(a)

> Say a={5,4,2,2,2,7,2}
> The index I need is the ones belong to the first 2 and then the 7. as an
> index of local minimum and maximum respectively.
>
index_min = minloc(a)
index_max = maxloc(a)

Regards,

Mike Metcalf



Report this thread to moderator Post Follow-up to this message
Old Post
Michael Metcalf
06-05-05 08:57 PM


Re: relative optimas
"Michael Metcalf" <michaelmetcalf@compuserve.com> wrote in message
news:d7veje$u19$04$1@news.t-online.com...

> index = minloc(a)

And the answer to his next question is:

index = minloc(a,1)

--
write(*,*) transfer((/17.392111325966148d0,6.5794487871554595D-85, &
6.0134700243160014d-154/),(/'x'/)); end



Report this thread to moderator Post Follow-up to this message
Old Post
James Van Buskirk
06-06-05 01:57 AM


Re: relative optimas
"James Van Buskirk" <not_valid@comcast.net> wrote in message
news:BcCdnXNbc8hw3z7fRVn-jQ@comcast.com...
> "Michael Metcalf" <michaelmetcalf@compuserve.com> wrote in message
> news:d7veje$u19$04$1@news.t-online.com...
> 
>
> And the answer to his next question is:
>
> index = minloc(a,1)
>
Whoops, sure thing.

Mike Metcalf



Report this thread to moderator Post Follow-up to this message
Old Post
Michael Metcalf
06-06-05 01:57 AM


Sponsored Links




Last Thread Next Thread Next
Search this forum -> 
Post New Thread

Fortran archive

Show a Printable Version Send to friend Email This Page to Someone! subscribe to this thread Receive updates to this thread
Computer Consultants
Programming Jobs
Visual Basic Controls
SQL Server Programming
Webservices
Java Security
Visual Studio
C# Programming
Visual J++
Software engineering
Open source Software
Perl Programming
PHP Programming
ASP Programming
ASP .NET Programming
Visual Basic Programming
Windows Scripting Host
Java Programming
Java Help
Java Beans
VBScript
Cobol
MAC Applications
Unix Programming
Forum Jump:
All times are GMT. The time now is 06:45 PM.

 
Free MCSE Braindumps | Real Estate Topics

Programming forum archive

Copyrights CodeComments.com 2004 - 2006

Powered by vBulletin Copyright 2000-2006 Jelsoft Enterprises Limited.