123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657 |
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.Windows.Forms;
- using System.Xml.Resolvers;
- using static System.Windows.Forms.VisualStyles.VisualStyleElement;
- namespace Ul_4
- {
- public partial class Form1 : Form
- {
- public Form1()
- {
- InitializeComponent();
- }
- private void Form1_Load(object sender, EventArgs e)
- {
- }
- private double CalculateFunction(double x, double b)
- {
- double result = Math.Pow(10, -3) * Math.Pow(Math.Abs(x), 5.0 / 2.0) + Math.Log(Math.Abs(x + b));
- return result;
- }
- private void button1_Click(object sender, EventArgs e)
- {
- double x0 = 1.75;
- double xk = -2.5;
- double dx = -0.25;
- double b = 35.4;
- int arrayLength = Convert.ToInt32(Math.Abs((xk - x0) / dx)) + 1;
- double[] results = new double[arrayLength];
- int index = 0;
- for (double x = x0; x >= xk; x += dx)
- {
- double result = CalculateFunction(x, b);
- results[index++] = result;
- }
- // вывод результатов на форму
- for (int i = 0; i < arrayLength; i++)
- {
- listBox1.Items.Add($"y = {x0 - i * dx:F2} - f(x) = {results[i]:F4}");
- }
- }
- }
- }
|