Home > Net >  Rewriting functions from r to python
Rewriting functions from r to python

Time:11-02

I have function written in R.

V <- function(c, E, HS, EC_50) E   (1 - E) / (1   exp(HS * (c - EC_50))

I would like to get the same function in Python but I don't know how. I haven't used Python very much before. Therefore, I am asking for forum help.

CodePudding user response:

I think this is what you are looking for:

import numpy as np

def v(c, E, HS, EC_50):
    return E   (1 - E) / (1   np.exp(HS * (c - EC_50)))

CodePudding user response:

You can use lambda expression

import numpy as np
v = lambda c, E, HS, EC_50: E   (1 - E) / (1   np.exp(HS * (c - EC_50)))
  • Related