File: fosc3d.py

package info (click to toggle)
python-bumps 1.0.0b2-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 6,144 kB
  • sloc: python: 23,941; xml: 493; ansic: 373; makefile: 209; sh: 91; javascript: 90
file content (24 lines) | stat: -rw-r--r-- 419 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#!/usr/bin/env python

"""
the fOsc3D Mathematica function

References::
    [4] Mathematica guidebook
"""

from math import sin, exp


def fOsc3D(x, y):
    """
    fOsc3D Mathematica function:

    fOsc3D[x_,y_] := -4 Exp[(-x^2 - y^2)] + Sin[6 x] Sin[5 y]

    minimum?
    """

    func = -4.0 * exp(-x * x - y * y) + sin(6.0 * x) * sin(5.0 * y)
    penalty = 100.0 * y * y if y < 0 else 0
    return func + penalty