With MTH229 you can compute integrals with different possibilities. However, what if I want to compute one depending on a constant?
For instance:
integrate(x->x^3, 0, 1)
works perfectly. As well as:
integrate(x->x^3)
But what if I want to compute the exact value depending of C
which is a real constant of this following:
integrate(x->C*x^3) # Obviously doesn't work as C isn't defined.
Note 1: I here use a much simplified function to integrate, the one I need is a polynomial with other degrees and more complicated coefficients.
Note 2: Thus I only use one constant C
, but actually, I have several, C1, C2, C3
etc.
Note 3: I am not closed to MTH229
package. Any Julia package working will be fine :)
EDIT: Actually, what I'm looking is to compute an integral with additional parameters as possible in Python-Scipy but with exact expression (and not evaluated within 0 and 1 like the following picture):
That integrate
is no more than a wrapper around SymPy's integrate for Function
objects. To do what you want you need to uses SymPy
's syntax:
using SymPy # this happens behind the scenes when you load MTH229
@vars x a b # defined some variables
integrate(a*x^2 + b, x) # indefinite integral needs variable to integrate in specified
integrate(a*x^2 + b, (x, 0, 1)) # definite integral example
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.