public void SineHyper(double x, int accuracy) { double accuracity = Math.Pow(10, accuracy); var res = TaylorApproxer.SineHyper(x, accuracy); Assert.AreEqual(Math.Truncate(accuracity * Math.Sinh(Helper.DegreeToRadian(x))) / accuracity, Math.Truncate(accuracity * res) / accuracity); }
private void button1_Click(object sender, EventArgs e) { switch (listBox1.SelectedIndex) { case 0: // Cosh { if (!string.IsNullOrWhiteSpace(textBox1.Text) && !string.IsNullOrWhiteSpace(textBox3.Text)) { textBox4.Text = TaylorApproxer.CosineHyper(Double.Parse(textBox1.Text), Int32.Parse(textBox3.Text)).ToString(); } break; } case 1: // Sinh { if (!string.IsNullOrWhiteSpace(textBox1.Text) && !string.IsNullOrWhiteSpace(textBox3.Text)) { textBox4.Text = TaylorApproxer.SineHyper(Double.Parse(textBox1.Text), Int32.Parse(textBox3.Text)).ToString(); } break; } case 2: { if (!string.IsNullOrWhiteSpace(textBox1.Text) && !string.IsNullOrWhiteSpace(textBox3.Text)) { textBox4.Text = TaylorApproxer.Sine(Double.Parse(textBox1.Text), Int32.Parse(textBox3.Text)).ToString(); } break; } case 3: { if (!string.IsNullOrWhiteSpace(textBox1.Text) && !string.IsNullOrWhiteSpace(textBox3.Text)) { textBox4.Text = TaylorApproxer.Cosine(Double.Parse(textBox1.Text), Int32.Parse(textBox3.Text)).ToString(); } break; } case 4: { if (!string.IsNullOrWhiteSpace(textBox1.Text) && !string.IsNullOrWhiteSpace(textBox3.Text)) { textBox4.Text = TaylorApproxer.Tangent(Double.Parse(textBox1.Text), Int32.Parse(textBox3.Text)).ToString(); } break; } case 5: { if (!string.IsNullOrWhiteSpace(textBox1.Text) && !string.IsNullOrWhiteSpace(textBox3.Text)) { textBox4.Text = TaylorApproxer.Arccosinus(Double.Parse(textBox1.Text), Int32.Parse(textBox3.Text)).ToString(); } break; } case 6: { if (!string.IsNullOrWhiteSpace(textBox1.Text) && !string.IsNullOrWhiteSpace(textBox3.Text)) { textBox4.Text = TaylorApproxer.Arcsinus(Double.Parse(textBox1.Text), Int32.Parse(textBox3.Text)).ToString(); } break; } case 7: { if (!string.IsNullOrWhiteSpace(textBox1.Text) && !string.IsNullOrWhiteSpace(textBox3.Text)) { textBox4.Text = TaylorApproxer.Arctangent(Double.Parse(textBox1.Text), Int32.Parse(textBox3.Text)).ToString(); } break; } case 8: { if (!string.IsNullOrWhiteSpace(textBox1.Text) && !string.IsNullOrWhiteSpace(textBox3.Text)) { textBox4.Text = TaylorApproxer.EExponential(Double.Parse(textBox1.Text), Int32.Parse(textBox3.Text)).ToString(); } break; } case 9: { if (!string.IsNullOrWhiteSpace(textBox1.Text) && !string.IsNullOrWhiteSpace(textBox3.Text)) { textBox4.Text = TaylorApproxer.Logarithm(Double.Parse(textBox1.Text), Int32.Parse(textBox3.Text)).ToString(); } break; } case 10: { if (!string.IsNullOrWhiteSpace(textBox3.Text)) { textBox4.Text = HighPrecisionPi.GetPi(Int32.Parse(textBox3.Text)).ToString(); } break; } case 11: { if (!string.IsNullOrWhiteSpace(textBox1.Text) && !string.IsNullOrWhiteSpace(textBox2.Text) && !string.IsNullOrWhiteSpace(textBox3.Text)) { textBox4.Text = TaylorApproxer.Power(Double.Parse(textBox1.Text), Double.Parse(textBox2.Text), Int32.Parse(textBox3.Text)).ToString(); } break; } case 12: { if (!string.IsNullOrWhiteSpace(textBox1.Text) && !string.IsNullOrWhiteSpace(textBox2.Text) && !string.IsNullOrWhiteSpace(textBox3.Text)) { textBox4.Text = TaylorApproxer.Exponential(Double.Parse(textBox1.Text), Double.Parse(textBox2.Text), Int32.Parse(textBox3.Text)).ToString(); } break; } } }