C Library Functions  - scale3 (3)

NAME

scale3(3f) - [M_math] find nice log range

CONTENTS

Synopsis
Description
Example

SYNOPSIS

subroutine scale3(xmin, xmax, n, xminp, xmaxp, dist)

   real,intent(in)      :: xmin, xmax
   integer,intent(in)   :: n
   real,intent(out)     :: xminp, xmaxp, dist

DESCRIPTION

Find nice logarithmic range using "CACM Algorithm 463 scale3". Typically used to find nice ranges for axis scales. Given XMIN, XMAX and N, where N is greater than 1, find new log range. Finds a new range XMINP and XMAXP divisible into exactly N LOGARITHMIC intervals, where the ratio of adjacent uniformly spaced scale values is DIST.

EXAMPLE

Sample program:

    program demo_scale3
    use M_math, only : scale3
    implicit none
    real :: start, end
    real :: xminp, xmaxp, dist
    integer :: intervals
    integer :: iostat
    intervals=5
    write(*,’(a)’,advance=’no’)’Enter start and end values:’
    do
      read(*,*,iostat=iostat)start,end
      if(iostat.ne.0)exit
      call scale3(start,end,intervals,xminp,xmaxp,dist)
      write(*,’(*(g0))’)                                &
      & ’nice log range is 10**’, log10(xminp),         &
      & ’ to 10**’,log10(xmaxp),                        &
      & ’ by ’, nint((log10(xmaxp)-log10(xminp))/dist), &
      & ’ intervals of 10**’,dist
    enddo
    end program demo_scale3


Nemo Release 3.1 scale3 (3) February 23, 2025
Generated by manServer 1.08 from 02871323-94e9-4429-a074-0049e9a31c83 using man macros.