Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 972039
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T03:03:33+00:00 2026-05-16T03:03:33+00:00

I am trying to do a fit to a given function using Scipy. Scipy.optimize.leastsq

  • 0

I am trying to do a fit to a given function using Scipy. Scipy.optimize.leastsq needs a vectorized function as one of the input parameters.
This all works fine, but now I have a more complicated function which is not vectorized automatically by Scipy/Numpy.

def f1(a, parameters):
    b, c = parameters
    result = scipy.integrate.quad(integrand, lower, upper, (a, b, c))
    return result

or to give a closed example numpy.vectorize also does not work with

def f2(a, parameters):
    b, c = parameters
    return a+b+c

Is there a possibility to vectorize these functions in Scipy/Numpy?

Thank you for any help!
Alexander

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T03:03:34+00:00Added an answer on May 16, 2026 at 3:03 am

    Sorry, I’m not sure what the question is. Python *args collects any number of args,
    which a function can unpack as it pleases; see
    docs.python.org/tutorial/…

    import numpy as np
    from scipy.integrate import quad
    
    def f2( a, *args ):
        print "args:", args
        return a + np.sum( args, axis=0 )
    
    x = np.ones(3)
    print f2( x, x*2, x*3 )
    
    
    def quadf( *args ):
        print "quadf args:", args
        return 1
    
    quad( quadf, 0, 1, (2,3) )
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to get my Jacobian to work with SciPy's Optimize library's leastsq function.
I'm trying to use scipy.leastsq() as a method of finding a best fit point
I'm trying to fit the information from the G function of my data to
I'm trying to fit a 20x20 table into a view using a programmatically built
The task I was trying to accomplish was that given an input pattern, e.g.
I am trying to implement infer_class function that, given a method, figures out the
I'm trying to detect how well an input vector fits a given cluster centre.
I am trying to write a curve fitting function which returns the optimal parameters
I find myself always trying to fit everything into the OOP methodology, when I'm
I have installed rapache and I am trying to fit a linear model inside

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.