Rewriting functions from r to python

Question:

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.

Asked By: D_ZR

||

Answers:

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)))
Answered By: T C Molenaar

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)))
Answered By: ThomasIsCoding
Categories: questions Tags: , ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.