这个数学的逻辑是什么以及我将如何做到这一点? [英] What Is Logic Of This Math And How I Will Do It ?

查看:64
本文介绍了这个数学的逻辑是什么以及我将如何做到这一点?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

通过在系列中添加最多n个项来计算2的自然对数

1 - 1/2 + 1/3 - 1/4 + 1/5 -... 1 / n

其中n是正整数并由用户输入。





i无法理解这个逻辑

Compute the natural logarithm of 2, by adding up to n terms in the series
1 - 1/2 + 1/3 - 1/4 + 1/5 -... 1/n
where n is a positive integer and input by user.


i cant understand this logic

推荐答案

查看2的自然对数的定义这里



数学很漂亮!
Check out the definition of the Natural Logarithm of 2 here.

Maths is beautiful!


给你一个罕见的有机会学习并使用学校的帮助。后来,当你开始工作时,你的时间会越来越少。所以,好好利用这个机会。学习的唯一方法就是自己解决问题。这个练习非常有用。如果其他人会为您开发解决方案,您将失去另一个学习的机会。你不想要它。此外,通过作弊来利用你的学校成员也不好。







所以,从这里开始:

http://en.wikipedia.org/wiki/Taylor_series [ ^ ](数学),

< a href =http://www.cplusplus.com/reference/cmath/log> http://www.cplusplus.com/reference/cmath/log [ ^ ](用于测试代码的结果),

http://www.cprogramming.com/tutorial/c/lesson3.html [ ^ ](编程)。



-SA
You are given a rare chance to learn something and use school assistance. Later on, when you start working, you will have less and less time. So, use this chance well. And the only way to learn something is to solve problems all by yourself. This exercise is quite useful. If someone else will develop a solution for you, you will loose yet another chance to learn. You don't want it. Besides, taking advantage over your school fellows by cheating is not good.



So, start here:
http://en.wikipedia.org/wiki/Taylor_series[^] (mathematics),
http://www.cplusplus.com/reference/cmath/log[^] (for testing the results of your code),
http://www.cprogramming.com/tutorial/c/lesson3.html[^] (programming).

—SA






这里我给的样品是将g你需要的结果...



真诚的建议不要在没有初步努力的情况下寻找别人的解决方案。

int main()

{

Hi,

Here i am giving the sample which will give you required result...

Sincere advise don't look for solution from others without initial effort.
int main()
{
double sum=0,fraction;
    int num;
    printf("Enter the Sequence length\n");
    scanf_s("%d",&num);
    for(int i=1;i<=num;i++)
    {
        if(i%2==0)
        {
            fraction = -(float)1/i;
        }
        else
            fraction = (float)1/i;
        sum = sum + fraction;
    }
    printf("The result of the sequence is %f",sum);



返回0;

}


return 0;
}


这篇关于这个数学的逻辑是什么以及我将如何做到这一点?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆