总结计划 [英] Summation Program

查看:119
本文介绍了总结计划的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好:


我正在尝试制作一个程序,使用梯形法则计算函数的积分。


所以我有这个:

Hello:

I am trying to make a program that will calculate the integral of a function using the Trapezoidal Rule.

So far I have this:

展开 | 选择 | Wrap | 行号

推荐答案

嗨。您获得了什么结果以及您使用什么输入来获得该结果?
Hi. What result are you getting and what input are you using to get that result?


myfunc是代表原始函数还是积分函数?
Is myfunc representing the original function or the integral function?


1你得到了什么答案......在没有你知道的情况下,编译器可能会做一些演员吗? (即结果看起来很可疑接近于int说,当它应该是一个浮点数。


2)我从未见过在方法中声明的原型(这可能不是是不正确的,但我很感兴趣,因为这是我没见过的东西 - 特别是在myfunc看起来是在它的原型之前定义的情况下)


3)你总是在y中添加相同的值...我认为(虽然积分不是我最喜欢的数学)h的每个值必须是不同的...... h应该是给定区域的总和区间,而不仅仅是整个区间....
1) what answer are you getting...could it be some cast that the compiler is doing without you knowing? (ie does the result look suspiciously close to an "int" say, when it should be a float.

2) I have never seen prototypes declared inside a method (this may not be incorrect, but I''m intrigued because it''s something I''ve not seen - especially in the case where myfunc appears to be defined before it''s prototype)

3) you are always adding the same value to y...I think (although integration was not my favourite math) that each value of h must be different.....that h should be the sum of areas along a given interval, not merely the entire inteval....


这篇关于总结计划的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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