Giter VIP home page Giter VIP logo

Comments (3)

jmbejara avatar jmbejara commented on August 17, 2024 1

c in fun represents a callable (typically a function). a here is a tuple. hi is a function. hi() is not a function, but whatever the function hi returns. (hi doesn't return anything.) The () on hi() is what causes hi to be "called."

from comp-econ-sp18.

jmbejara avatar jmbejara commented on August 17, 2024

Take a look at the documentation here: https://docs.scipy.org/doc/scipy-0.13.0/reference/generated/scipy.optimize.fmin_slsqp.html

You can supply the constrains using eqcons or f_eqcons. The first requires a list of scalar-valued functions representing the constraints. It should be supplied as a list of functions. The second requires that you write a single, vector-valued function that represents the constraints. It should be supplied as a single callable. You can use either one you choose.

To understand the error, consider the following code:

a = ()

def hi():
    print('hi')

def fun(c):
    c()

The function fun takes a callable. If I supply a, I get the same error you're describing. If I supply hi, it works fine.

image

from comp-econ-sp18.

afgong avatar afgong commented on August 17, 2024

When you mean "callable" in your example, do you mean that c() represents a function? So if we're phrasing the problem differently, a is an empty list, which doesn't correspond to a function. However hi() is a function, so we can "call" it?

Thanks!

from comp-econ-sp18.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.