To search
You are here : Linux > Linux > Science > FuncDesigner 0.51

FuncDesigner 0.51

Freedownload8 rating:
License:
BSD License
Added:
Nov 30, -1
Submit date:
Feb 15, 2015
Publisher:
Dmitrey Kroshko
File size:
Downloads:
282
 

FuncDesigner 0.51

by Dmitrey Kroshko

FuncDesigner is an open source CAS (Computer Algebra System) written in Python. Below are three examples, so you can understand how the project works.

Example:

from FuncDesigner import *

a, b, c = oovars('a', 'b', 'c')

f1, f2 = sin(a) + cos(b) - log2(c) + sqrt(b), sum(c) + c * cosh(b) / arctan(a) + c[0] * c[1] + c[-1] / (a * c.size)

f3 = f1*f2 + 2*a + sin(b) * (1+2*c.size + 3*f2.size)

f = 2*a*b*c + f1*f2 + f3 + dot(a+c, b+c)

point = {a:1, b:2, c:[3, 4, 5]} # however, you'd better use numpy arrays instead of Python lists

print(f(point))

print(f.D(point))

print(f.D(point, a))

print(f.D(point, [b]))

print(f.D(point, fixedVars = [a, c]))

Expected output:
[ 140.9337138 110.16255336 80.67870244]
{a: array([ 69.75779959, 88.89020412, 109.93551537]), b: array([-23.10565554, -39.41138045, -59.08378522]),
c: array([[ 6.19249888, 38.261221 , 38.261221 ],
[ 29.68377935, -0.18961959, 29.68377935],
[ 23.03059873, 23.03059873, -6.22406763]])}
[ 69.75779959 88.89020412 109.93551537]
{b: array([-23.10565554, -39.41138045, -59.08378522])}
{b: array([-23.10565554, -39.41138045, -59.08378522])}

 * You can use "for" cycle in FuncDesigner code

Example:

from FuncDesigner import *

a, b, c = oovars('a', 'b', 'c')

f1, f2 = sin(a) + cos(b) - log2(c) + sqrt(b), sum(c) + c * cosh(b) / arctan(a) + c[0] * c[1] + c[-1] / (a * c.size)

f3 = f1*f2 + 2*a + sin(b) * (1+2*c.size + 3*f2.size)

F = sin(f2)*f3 + 1

M = 15

for i in range(M): F = 0.5*F + 0.4*f3*cos(f1+2*f2)

point = {a:1, b:2, c:[3, 4, 5]} # however, you'd better use numpy arrays instead of Python lists

print(F(point))

print(F.D(point))

print(F.D(point, a))

print(F.D(point, [b]))

print(F.D(point, fixedVars = [a, c]))

[ 4.63468686 0.30782902 1.21725266]
{a: array([-436.83015952, 204.25331181, 186.38788436]), b: array([ 562.63390316, -273.23484496, -256.32464645]),
c: array([[ 395.96975635, 167.24928464, 55.74976155],
 [ -74.80518167, -129.34496329, -19.94804845],
 [ -57.42472654, -45.93978123, -66.30049589]])}
[-436.83015952 204.25331181 186.38788436]
{b: array([ 562.63390316, -273.23484496, -256.32464645])}
{b: array([ 562.63390316, -273.23484496, -256.32464645])}

Example:

from FuncDesigner import *

from openopt import NLP

a, b, c = oovars('a', 'b', 'c')

f = sum(a*[1, 2])**2+b**2+c**2

startPoint = {a:[100, 12], b:2, c:40} # however, you'd better use numpy arrays instead of Python lists

p = NLP(f, startPoint)

p.constraints = [(2*c+a-10)**2 < 1.5 + 0.1*b, (a-10)**28.9, a+b > [ 7.97999836, 7.8552538 ],

a < 9, (c-2)**2 < 1, b < -1.02, c > 1.01, ((b + c * log10(a).sum() - 1) ** 2).eq(0)]

r = p.solve('ralg')

print r.xf

Expected output:
...
objFunValue: 717.75631 (feasible, max constraint = 7.44605e-07)
{a: array([ 8.99999792, 8.87525277]), b: array([-1.01999971]), c: array([ 1.0613562])}

Languages:

OS requirements for FuncDesigner 0.51:

  • Download FuncDesigner 0.51

User comments about FuncDesigner 0.51

Comment FuncDesigner 0.51

  1. What did you think of the program?

    Log in or Create Account to post a comment.
         
    *
    *
  2. Rate this software    
  1. Security Code: Captcha Image Change Image

Get Our News, Everywhere

Popular searches

Linux

Science