【问题标题】:What sort of Math series is this, what's the equation?这是什么数学系列,方程式是什么?
【发布时间】:2022-01-08 22:14:59
【问题描述】:

我无法弄清楚这个系列的实际公式或名称是什么:

3 : 5; 4:10; 5:15;等等。

代码如下:

        i = 4
        n = 2
        while i <= granularity and i != 3:
            if (i == granularity):
                return 5 * n

            n += 1
            i += 1
        return 5

这里是我用来解决这个系列的更多代码:

    def getChartData(self, sym, timescale="last_day", intraday="Y", granularity="3", ytdate="False", extdhrs="n"):
    dateMin = ""
    dateMax = ""
    alt = "hi" if timescale == "last_hi" else "lo" if timescale == "last_lo" else "cl" if timescale == "last_cl" else ""
    href = ""
    content = ""
    sorted_content = {}

    def granFac():
        gran = int(granularity)
        i = 4
        n = 2
        while i <= gran and i != 3:
            if (i == gran):
                return (dt.now() - td(minutes=(5 * n))).strftime("%Y/%m/%d-%H:%M:%S")

            n += 1
            i += 1
    
    return (dt.now() - td(minutes=5)).strftime("%Y/%m/%d-%H:%M:%S")

【问题讨论】:

  • 能贴出完整的代码sn-p吗?
  • 这听起来像是一道作业题。这些很好,但就像非家庭作业问题一样,请展示你尝试了什么以及你是如何陷入困境的(以便答案对你的学习真正有用)
  • 抱歉,与 numpy 无关,只是认为这些用户会喜欢这类问题。这不是家庭作业,我只是在开发一些图表软件。我已经解决了我或多或少想探索其背后数学的代码。
  • "3 = 5"?这在 Python 中没有任何意义,在数学中也没有多大意义。也许你的意思是3 的输入返回5,比如f(3) = 5?无论如何,Stack Overflow 是关于编程,而不是数学,那么你的编程问题是什么?如果你真的想问数学,有Mathematics
  • 谢谢,你帮了大忙!一个函数,其增量范围从 3 开始,带有 { 5 |领域}。 varsitytutors.com/hotmath/hotmath_help/topics/domain-and-range

标签: python algorithm function math series


【解决方案1】:

序列5, 10, 15, 20, 25, 30, ...可以描述为arithmetic sequence

【讨论】:

    【解决方案2】:

    所以答案很可能是两个建议的组合。结果证明它是一个范围从 3 开始并增加 1 的函数,以及一个从 5 开始的具有 5 的倍数的集合的域。

    function { 3, 4, 5.. }( 5 | {} )
    -or-
    function { x ≥ 3, x ∈ Z+ }( {x|x ∈ Z+, x≡0 (mod 5)} )
    

    根据您来自哪个人群,似乎有几种方法可以编写它。

    我是如何找到答案的:

    Domain & Range

    Notating Multiples

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2020-03-05
      • 2022-08-14
      • 1970-01-01
      • 1970-01-01
      • 2022-01-04
      • 1970-01-01
      • 1970-01-01
      • 2012-06-06
      相关资源
      最近更新 更多