G
G
Gulnara2020-05-02 20:46:17
Python
Gulnara, 2020-05-02 20:46:17

How to calculate the value of a y function in Python?

1. Calculate the value of the function y,
Y(x)=
Given: a, x
a) x=-1.9, a=4.5
b)x=0.5, a=4.5
c)x=1.4, a= 4,5
Find: y
Constraint: 〖ax〗^3>0,

Tried to do something but in vain
import math
X=-1.9,a=4.5
print("y = f(x):\n\t| y = log (a)-x if x < 0\n\t| \
y = a*exp**x - math.cos(x) if 0 <= x < =1\n\t|y = a** 3+x if x > 1")

x = float(input("x = "))

if x < 0:
y = log(a)-x
elif 0 <= x <= 1:
y = a*exp* *x - math.cos(x)
elif x > 1:
y = a**3+x
print(y)

Answer the question

In order to leave comments, you need to log in

1 answer(s)
Y
YarikLtv4k, 2020-05-02
@YarikLtv4k

https://younglinux.info/python/task/maths-function
Hold the rod, not the fish)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question