File: wavy.py

package info (click to toggle)
python-bumps 0.7.11-2
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 10,264 kB
  • sloc: python: 22,226; ansic: 4,973; cpp: 4,849; xml: 493; makefile: 163; perl: 108; sh: 101
file content (32 lines) | stat: -rw-r--r-- 566 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#!/usr/bin/env python

"""
simple sine-based multi-minima functions

References::
    None.
"""

from numpy import absolute as abs
from numpy import asarray
from numpy import sin, pi


def wavy1(x):
    """
    Wave function #1: a simple multi-minima function

    minimum is f(x)=0.0 at xi=0.0
    """
    x = asarray(x)
    return abs(x+3.*sin(x+pi)+pi)

def wavy2(x):
    """
    Wave function #2: a simple multi-minima function

    minimum is f(x)=0.0 at xi=0.0
    """

    x = asarray(x)
    return 4 *sin(x)+sin(4*x) + sin(8*x)+sin(16*x)+sin(32*x)+sin(64*x)