File: wavy.py

package info (click to toggle)
python-bumps 0.8.0-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 10,688 kB
  • sloc: python: 24,446; ansic: 4,973; cpp: 4,849; javascript: 639; xml: 493; makefile: 147; perl: 108; sh: 94
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)