• linkedu视频
  • 平面设计
  • 电脑入门
  • 操作系统
  • 办公应用
  • 电脑硬件
  • 动画设计
  • 3D设计
  • 网页设计
  • CAD设计
  • 影音处理
  • 数据库
  • 程序设计
  • 认证考试
  • 信息管理
  • 信息安全
菜单
linkedu.com
  • 网页制作
  • 数据库
  • 程序设计
  • 操作系统
  • CMS教程
  • 游戏攻略
  • 脚本语言
  • 平面设计
  • 软件教程
  • 网络安全
  • 电脑知识
  • 服务器
  • 视频教程
  • vbs
  • DOS/BAT
  • hta/htc
  • python
  • perl
  • VBA
  • ColdFusion
  • ruby
  • PowerShell
  • Lua
  • Golang
  • linux shell
您的位置:首页 > 脚本语言 >python > Python中计算三角函数之cos()方法的使用简介

Python中计算三角函数之cos()方法的使用简介

作者:goldensun 字体:[增加 减小] 来源:互联网

goldensun 通过本文主要向大家介绍了python 反三角函数,python 三角函数,python cos函数,笨方法学 python,笨方法学python pdf等相关知识,希望对您有所帮助,也希望大家支持linkedu.com www.linkedu.com

 cos()方法返回x弧度的余弦值。
语法

以下是cos()方法的语法:

cos(x)

注意:此函数是无法直接访问的,所以我们需要导入math模块,然后需要用math的静态对象来调用这个函数。
参数

  •     x -- 这必须是一个数值

返回值

此方法返回-1 到 1之间的数值,它表示角度的余弦值
例子

下面的例子展示cos()方法的使用

#!/usr/bin/python
import math

print "cos(3) : ", math.cos(3)
print "cos(-3) : ", math.cos(-3)
print "cos(0) : ", math.cos(0)
print "cos(math.pi) : ", math.cos(math.pi)
print "cos(2*math.pi) : ", math.cos(2*math.pi)

</div>

当我们运行上面的程序,它会产生以下结果:

cos(3) : -0.9899924966
cos(-3) : -0.9899924966
cos(0) : 1.0
cos(math.pi) : -1.0
cos(2*math.pi) : 1.0

</div>

</div>

您可能想查找下面的文章:

  • Python中计算三角函数之cos()方法的使用简介

相关文章

  • python 爬虫出现403禁止访问错误详解
  • 读写json中文ASCII乱码问题的解决方法
  • 跟老齐学Python之开始真正编程
  • pygame学习笔记(1):矩形、圆型画图实例
  • python使用rsa加密算法模块模拟新浪微博登录
  • 实例讲解Python中的私有属性
  • python 正则式 概述及常用字符
  • Python yield 小结和实例
  • Python中super关键字用法实例分析
  • Python创建日历实例

文章分类

  • vbs
  • DOS/BAT
  • hta/htc
  • python
  • perl
  • VBA
  • ColdFusion
  • ruby
  • PowerShell
  • Lua
  • Golang
  • linux shell

最近更新的内容

    • python sort、sorted高级排序技巧
    • Python实现求最大公约数及判断素数的方法
    • Python 26进制计算实现方法
    • python进程类subprocess的一些操作方法例子
    • 详解Python中的__init__和__new__
    • Python实现在线程里运行scrapy的方法
    • 从零学Python之入门(二)基本数据类型
    • 在ironpython中利用装饰器执行SQL操作的例子
    • Python脚本处理空格的方法
    • 使用Python的Tornado框架实现一个简单的WebQQ机器人

关于我们 - 联系我们 - 免责声明 - 网站地图

©2020-2025 All Rights Reserved. linkedu.com 版权所有