2022-08-29 22:05:16 +0200 received badge ● Nice Answer (source) 2018-01-29 19:24:21 +0200 received badge ● Good Question (source) 2017-02-05 14:33:47 +0200 received badge ● Favorite Question (source) 2016-07-22 13:12:41 +0200 received badge ● Teacher (source) 2016-07-22 13:12:41 +0200 received badge ● Necromancer (source) 2015-03-31 17:15:26 +0200 received badge ● Famous Question (source) 2014-01-20 11:18:09 +0200 received badge ● Notable Question (source) 2013-10-17 15:53:04 +0200 received badge ● Popular Question (source) 2013-06-18 03:11:03 +0200 received badge ● Nice Question (source) 2013-04-29 04:00:51 +0200 received badge ● Student (source) 2013-04-28 20:23:36 +0200 asked a question Numerical integral with multiple parameters I am trying to numerically integrate a function with respect to one variable, although the function is of more than one variable. An example: var('x') var('a') f(x,a)=a*x f(x,a) integral(f(x,a),x,0,1)  produces the correct result of 1/2*a g(x,a)=(f(x,a).nintegral(x, 0, 1))  Errors with "ValueError: Maxima (via quadpack) cannot compute the integral", but I probably don't have the syntax correct even if that function can do this. Even if a is given a value prior to the g(x,a) definition, it doesn't work. g(x,a)=numerical_integral(f(x,a),0,1)  Errors with "ValueError: Integrand has wrong number of parameters". I can understand this, as it doesn't quite know what to do with 'a'. g(x,a)=numerical_integral(f(x,a),0,1, params=[a]) g(x,6)  Gives an incorrect result of 0.3333 g(x,a)=numerical_integral(f(x,a),0,1, params=[6]) g(x,a)  Gives the correct result of 2.99996 h(x,a)=integral(f(x,a),x,0,1) h(x,6)  Gives the correct result of 3 What is going on with g(x,a) and the "params" vector? Is what I am attempting to do possible? I would like to make a plot of g(x,a) across a range of a. This is a simplified example, where I could obviously just do it by hand or with a non-numerical integral. The f(x,a) that I am really trying to work with is much more complex. I can upload a .sws workbook with these equations if that helps. The documentation at http://www.sagemath.org/doc/reference/calculus/sage/gsl/integration.html don't give much to go on with respect to params or nintegral. Any other docs out there I am missing? 2013-04-20 20:03:06 +0200 received badge ● Supporter (source) 2013-04-20 20:02:56 +0200 answered a question Running octave from the sage notebook Similar to above, the following worked for me from the notebook interface of sage: os.environ["PATH"]+=":/opt/local/bin"  Octave was installed on my system using MacPorts. I found that octave.eval('2+2') worked immediately in the notebook, but octave(2+2), required: octave = Octave() octave._start()  otherwise it errored with "ValueError: The octave session in which this object was defined is no longer running." Note: octave.eval returns a string, usually with "ans =", whereas octave() returns a number that I could perform further operations on. You may want to put octave.quit(True) at the end. I don't understand what is actually going on well, so take my advice with caution.