Product of a function

Asked

Viewed 1,017 times

2

Hi, I was wondering if there are any commands to perform the production of a function in Python. I’m creating a function to make the product of another function.

def fx(a, v, t):
    return ( (t[3]/exp(t[2]-(t[1]/v)))*(a/exp(t[2]-(t[1]/v)))^(t[3]-1)*exp(-(a/exp(t[2]-(t[1]/v)))^t[3]) )

def L(x, v, t):
    return (numpy.prod(fx(a=A,v=V,t)) )

1 answer

0


Try the following on:

from functools import reduce # caso utilizes python 3
import operator

reduce(operator.mul, (2, 3, 4), 1)

Being 2, 3 and 4 the numbers to multiply. A similar answer can be seen here.

  • Thank you very much!

Browser other questions tagged

You are not signed in. Login or sign up in order to post.