python中阶乘怎么表示_Python中阶乘的记忆

python中阶乘怎么表示

I am currently working on an article about calculating sines and cosines using Taylor Polynomials. These make heavy use of factorials so I started thinking about ways to streamline the process.

我目前正在撰写一篇有关使用泰勒多项式计算正弦和余弦的文章。 这些大量使用阶乘,因此我开始考虑简化流程的方法。

This article describes a simple project using memoization with a lookup table to pre-calculate factorials and store them for future use.

本文介绍了一个简单的项目,该项目使用带有查找表的备注来预先计算析因并将其存储以备将来使用。

Many algorithms and other processes make heavy and repeated use of values which need to be calculated, often in a way which is expensive in terms of memory and/or time. It therefore makes sense to develop some sort of mechanism whereby the values which are or are likely to be needed frequently are calculated only once.

许多算法和其他过程经常以在存储器和/或时间方面昂贵的方式大量重复使用需要计算的值。 因此,开发某种机制是有意义的,通过这种机制,经常或可能经常需要的值仅计算一次。

The use of factorials in calculating trigonometric functions mentioned above is one example. In a future article I’ll extend the principle to calculating and storing sines and cosines themselves, but of course there are many other common examples.

在上述三角函数的计算中使用阶乘是一个示例。 在以后的文章中,我将把原理扩展到计算和存储正弦和余弦本身,但是当然还有许多其他常见示例。

When considering factorials the broad outline of memoization using a lookup table is simple and obvious: just use a list of integers the highest index of which is the highest number we want the factorial of. The factorial of a given number is therefo

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值