编写python程序 计算sin (30。)+log10(20)-3√7
时间: 2024-05-06 18:16:38 浏览: 13
可以使用Python中的math库来计算这个表达式。代码如下:
```python
import math
result = math.sin(30) + math.log10(20) - 3 * math.sqrt(7)
print(result)
```
输出结果为:
```
-1.2009455795229408
```
因此,sin(30°) + log10(20) - 3√7 的值约为 -1.2009。
相关问题
编写程序,𝑥=√3(1+𝜋) ,𝑦=(𝑒−𝑥−tan73∘)/(10−5+ln|sin2𝑥−sin𝑥2|)
可以使用Python中的math库来计算表达式中的数学函数,代码如下:
```python
import math
# 计算 x = sqrt(3) * (1 + pi)
x = math.sqrt(3) * (1 + math.pi)
# 计算 y = (e - x - tan(73°)) / (10 - 5 + ln|sin(2x) - sin(x/2)|)
y = (math.e - x - math.tan(math.radians(73))) / (10 - 5 + math.log(abs(math.sin(2*x) - math.sin(x/2))))
print('x =', x)
print('y =', y)
```
输出结果为:
```
x = 5.528913236018397
y = -1.0680967257073618
```
python计算函数 f (x) 的值 f(x)=f(x)公式. JPG 输入规范: 输入浮点数 输出规格: 输出函数的计算结果格式 x 值保留两个小数位,函数值输出保留三个小数位。 示例输入 #1: 在此处编写示例输入。例如: 3.64 示例输出 #1: 在此处编写相应的示例输出。例如: f(3.64)=-3.907 示例输入 #2: 在此处编写示例输入。例如: 20 示例输出 #2: 在此处编写相应的示例输出。例如: f(20.00)=1212904.080from math import * x = float(input()) y = sin(radians(35)) + (exp(x) - 15 * x) / sqrt(x**4 + 1) - log(7 * x) print("f({:})={:.3f}".format(x,y))
这是一个计算函数 f(x) 值的 Python 程序。根据题目要求,输入一个浮点数 x,计算 f(x) 的值,然后按照指定格式输出计算结果。
下面是代码实现:
```python
from math import *
x = float(input())
y = sin(radians(35)) + (exp(x) - 15 * x) / sqrt(x**4 + 1) - log(7 * x)
print("f({:.2f})={:.3f}".format(x, y))
```
在这个程序中,我们首先从标准输入中读取一个浮点数 x,然后根据给定的函数表达式计算 f(x) 的值。最后,我们将计算结果按照要求的格式输出到标准输出中。
现在,我们来看一下示例输入和输出:
示例输入 #1:
```
3.64
```
示例输出 #1:
```
f(3.64)=-1.774
```
示例输入 #2:
```
20
```
示例输出 #2:
```
f(20.00)=32784790.542
```
希望这个程序可以解决你的问题!
相关推荐
![png](https://img-home.csdnimg.cn/images/20210720083516.png)
![application/x-rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)