@@ -877,11 +877,125 @@ cdef class Constant(GenExpr):
877877 return self .number
878878
879879
880- exp = lambda x : _wrap_ufunc(x, np.exp)
881- log = lambda x : _wrap_ufunc(x, np.log)
882- sqrt = lambda x : _wrap_ufunc(x, np.sqrt)
883- sin = lambda x : _wrap_ufunc(x, np.sin)
884- cos = lambda x : _wrap_ufunc(x, np.cos)
880+ def exp (x ):
881+ """
882+ returns expression with exp-function
883+
884+ Parameters
885+ ----------
886+ x : Expr, GenExpr, number, np.ndarray, list, or tuple
887+ - If x is a scalar expression or number, apply the exp function directly to it.
888+ And if it's a number, convert it to a Constant expression first.
889+ - If x is a vector (np.ndarray, list, or tuple), apply the exp function
890+ element-wise using np.frompyfunc to convert each element to a Constant if it's
891+ a number, and then apply the exp function.
892+
893+ Returns
894+ -------
895+ GenExpr or MatrixGenExpr
896+ - If x is a scalar expression or number, returns the result of applying the exp
897+ function to it.
898+ - If x is a vector, returns an np.ndarray of the same shape with the exp
899+ function applied element-wise.
900+ """
901+ return _wrap_ufunc(x, np.exp)
902+
903+
904+ def log (x ):
905+ """
906+ returns expression with log-function
907+
908+ Parameters
909+ ----------
910+ x : Expr, GenExpr, number, np.ndarray, list, or tuple
911+ - If x is a scalar expression or number, apply the log function directly to it.
912+ And if it's a number, convert it to a Constant expression first.
913+ - If x is a vector (np.ndarray, list, or tuple), apply the log function
914+ element-wise using np.frompyfunc to convert each element to a Constant if it's
915+ a number, and then apply the log function.
916+
917+ Returns
918+ -------
919+ GenExpr or MatrixGenExpr
920+ - If x is a scalar expression or number, returns the result of applying the log
921+ function to it.
922+ - If x is a vector, returns an np.ndarray of the same shape with the log
923+ function applied element-wise.
924+ """
925+ return _wrap_ufunc(x, np.log)
926+
927+
928+ def sqrt (x ):
929+ """
930+ returns expression with sqrt-function
931+
932+ Parameters
933+ ----------
934+ x : Expr, GenExpr, number, np.ndarray, list, or tuple
935+ - If x is a scalar expression or number, apply the sqrt function directly to it.
936+ And if it's a number, convert it to a Constant expression first.
937+ - If x is a vector (np.ndarray, list, or tuple), apply the sqrt function
938+ element-wise using np.frompyfunc to convert each element to a Constant if it's
939+ a number, and then apply the sqrt function.
940+
941+ Returns
942+ -------
943+ GenExpr or MatrixGenExpr
944+ - If x is a scalar expression or number, returns the result of applying the sqrt
945+ function to it.
946+ - If x is a vector, returns an np.ndarray of the same shape with the sqrt
947+ function applied element-wise.
948+ """
949+ return _wrap_ufunc(x, np.sqrt)
950+
951+
952+ def sin (x ):
953+ """
954+ returns expression with sin-function
955+
956+ Parameters
957+ ----------
958+ x : Expr, GenExpr, number, np.ndarray, list, or tuple
959+ - If x is a scalar expression or number, apply the sin function directly to it.
960+ And if it's a number, convert it to a Constant expression first.
961+ - If x is a vector (np.ndarray, list, or tuple), apply the sin function
962+ element-wise using np.frompyfunc to convert each element to a Constant if it's
963+ a number, and then apply the sin function.
964+
965+ Returns
966+ -------
967+ GenExpr or MatrixGenExpr
968+ - If x is a scalar expression or number, returns the result of applying the sin
969+ function to it.
970+ - If x is a vector, returns an np.ndarray of the same shape with the sin
971+ function applied element-wise.
972+ """
973+ return _wrap_ufunc(x, np.sin)
974+
975+
976+ def cos (x ):
977+ """
978+ returns expression with cos-function
979+
980+ Parameters
981+ ----------
982+ x : Expr, GenExpr, number, np.ndarray, list, or tuple
983+ - If x is a scalar expression or number, apply the cos function directly to it.
984+ And if it's a number, convert it to a Constant expression first.
985+ - If x is a vector (np.ndarray, list, or tuple), apply the cos function
986+ element-wise using np.frompyfunc to convert each element to a Constant if it's
987+ a number, and then apply the cos function.
988+
989+ Returns
990+ -------
991+ GenExpr or MatrixGenExpr
992+ - If x is a scalar expression or number, returns the result of applying the cos
993+ function to it.
994+ - If x is a vector, returns an np.ndarray of the same shape with the cos
995+ function applied element-wise.
996+ """
997+ return _wrap_ufunc(x, np.cos)
998+
885999
8861000cdef inline object _to_const(object x):
8871001 return Constant(< double > x) if _is_number(x) else x
0 commit comments