- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我是一名初级程序员,也是 stackoverflow 的新手。
所以我一直在制作一个数学公式求解器,并且我有 4 个公式并正在运行。我正在研究我的正弦公式求解器,但它不起作用。我使用扫描仪和开关来选择公式并输入变量。这是我所拥有的。
Scanner input = new Scanner(System.in);
System.out.println("Enter '0' for list of formula call numbers");
System.out.print("Enter the formula request number: " );
int mFormula = input.nextInt();
switch(mFormula)
{
case 5 :
System.out.println("Sine Problem Solver, please enter your variables below: ");
System.out.println();
System.out.print("Value for known side: ");
int x = input.nextInt();
System.out.println();
System.out.print("Value for degrees: ");
int x3 = input.nextInt();
System.out.println();
double Sine = (x * Math.sin(x3));
System.out.print("The side length is: " + Sine);break;
}
我真的很困惑为什么它不起作用。
最佳答案
看来你的主要问题是 Math.sin
不采用度数而是弧度。尝试一下
Math.sin(Math.toRadians(x3))
关于java - 为什么我的正弦方法不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29732468/
我写的函数有问题。想法是使用 taylor 展开而不是 js 数学对象来计算 sin 和 cosin 值(在 radians 上运行) .这些是方程式: sin(x) = (x^1)/1! - (x^
我不知道这是编程还是数学问题,但我整理了一些FFT的简短示例。我加载了440hz的波并在顶部添加了一些正弦波,但是由于某种原因,频谱中存在一个我不理解的“波”。 据我了解,频谱应该具有相同的| Y(f
这个问题在这里已经有了答案: Java Math.cos(Math.toRadians()) returns weird values (4 个答案) 关闭 10 年前。 我正在编写一个程序,我必须
我想在 ios4 中实现一个正弦和余弦计算器: if([operation isEqual:@"sin"]){ operand = (operand*M_PI/180.0); oper
我使用 256 个元素为 VHDL 制作了一个正弦 LUT。 我使用 MIDI 输入,因此值范围为 8.17Hz(注 #0)到 12543.85z(注 #127)。 我有另一个 LUT 计算必须发送到
我想在ios4中实现一个正弦和余弦计算器: if([operation isEqual:@"sin"]){ operand = (operand*M_PI/180.0); operan
我是一名优秀的程序员,十分优秀!