feat: Kombinatorik, Denklem Kökü Bulucu ve Nümerik Türev modüllerinin kapsamlı UI/UX ve analitik modernizasyonu (v3.4.0)
This commit is contained in:
parent
ac6d09ba1b
commit
6026945615
13 changed files with 2726 additions and 919 deletions
29
README.md
29
README.md
|
|
@ -1,4 +1,4 @@
|
||||||
# 📐 ttCalculator v3.3.0
|
# 📐 ttCalculator v3.4.0
|
||||||
|
|
||||||
[](https://github.com/LilDosto/ttCalculator/releases)
|
[](https://github.com/LilDosto/ttCalculator/releases)
|
||||||
[](LICENSE)
|
[](LICENSE)
|
||||||
|
|
@ -13,11 +13,11 @@ Tüm matematiksel çekirdek, otomatik test paketinden **%100 başarıyla (0 hata
|
||||||
|
|
||||||
## 🚀 Hızlı Başlangıç & Kurulum
|
## 🚀 Hızlı Başlangıç & Kurulum
|
||||||
|
|
||||||
1. **[Releases](https://github.com/LilDosto/ttCalculator/releases/tag/v3.3.0)** sayfasına gidin.
|
1. **[Releases](https://github.com/LilDosto/ttCalculator/releases/tag/v3.4.0)** sayfasına gidin.
|
||||||
2. İhtiyacınıza göre indirin:
|
2. İhtiyacınıza göre indirin:
|
||||||
- **`ttCalculator-v3.3.0-Setup.exe` (Önerilen)**: Standart Windows kurulum sihirbazı. Masaüstüne ve Başlat Menüsüne kısayol oluşturur, Denetim Masası / Program Ekle-Kaldır entegrasyonu sağlar.
|
- **`ttCalculator-v3.4.0-Setup.exe` (Önerilen)**: Standart Windows kurulum sihirbazı. Masaüstüne ve Başlat Menüsüne kısayol oluşturur, Denetim Masası / Program Ekle-Kaldır entegrasyonu sağlar.
|
||||||
- **`ttCalculator.exe`**: Kurulumsuz doğrudan çalıştırılabilen tek dosya taşınabilir (portable) sürüm.
|
- **`ttCalculator.exe`**: Kurulumsuz doğrudan çalıştırılabilen tek dosya taşınabilir (portable) sürüm.
|
||||||
- **`ttCalculator-v3.3.0-win-x64.zip`**: Taşınabilir arşiv paketi.
|
- **`ttCalculator-v3.4.0-win-x64.zip`**: Taşınabilir arşiv paketi.
|
||||||
3. Çift tıklayarak doğrudan çalıştırın — ek bağımlılık gerektirmez!
|
3. Çift tıklayarak doğrudan çalıştırın — ek bağımlılık gerektirmez!
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
@ -109,17 +109,26 @@ Uygulama modern koyu tema (Dark Theme) arayüzü ile 13 ana modülden oluşmakta
|
||||||
$$v_t = D_v \cdot v_{xx} + G(u, v)$$
|
$$v_t = D_v \cdot v_{xx} + G(u, v)$$
|
||||||
* Sıfır-akı (Neumann) sınır koşulları, Turing deseni oluşumu (Gray-Scott, Schnakenberg, FitzHugh-Nagumo modelleri).
|
* Sıfır-akı (Neumann) sınır koşulları, Turing deseni oluşumu (Gray-Scott, Schnakenberg, FitzHugh-Nagumo modelleri).
|
||||||
|
|
||||||
### 6. 🔍 Çoklu Kök Taramalı Kök Bulucu (Root Finder)
|
### 6. 🔍 Denklem Kökü Bulucu (Root Finder v3.4)
|
||||||
* **🎯 Otomatik Çoklu Kök Taraması:** Verilen $[a, b]$ aralığındaki tüm tekil ve çoklu kökleri ardışık/paralel nümerik tarama ile bularak temiz bir kök tablosunda sunar.
|
* **Dinamik Parametre Girişi:** Seçilen yönteme göre (Newton-Raphson, Bisection, Secant, Regula Falsi, Çoklu Kök Taraması) dinamik parametre alanları.
|
||||||
* **Klasik Nümerik Yöntemler:** Newton-Raphson, Bisection (İkiye Bölme), Secant (Kiriş), Regula Falsi (Illinois hızlandırmalı).
|
* **Vurgulu KPI Kartı & Durum Rozetleri:** Büyük tipografiyle hesaplanan kök $x^*$, adım sayısı, son hata ve yakınsama durumu.
|
||||||
|
* **İterasyon Adımları Tablosu & Yakınsama Hızı Grafiği:** DataGridView tablosu (zebra striping) ve $\log_{10}(\epsilon)$ hata düşüşünü gösteren canlı 2B yakınsama grafiği.
|
||||||
|
* **Grafik Stüdyosu Entegrasyonu:** `[📈 Kökü Grafikte Göster]` butonu ile kök noktasını ve fonksiyonu anında Grafik Çizici sekmesine aktarma.
|
||||||
|
* **Nümerik Koruma:** $f'(x) \approx 0$ sıfıra bölme ve ıraksama (divergence) denetimleri.
|
||||||
|
|
||||||
### 7. 📜 Taylor Serisi Açılımı (Kesirli & Faktöriyelli Form)
|
### 7. 📜 Taylor Serisi Açılımı (Kesirli & Faktöriyelli Form)
|
||||||
* Tek ve çok değişkenli Taylor açılımlarında katsayılar hem ondalıklı, hem **sadeleştirilmiş kesirli formda**, hem de formülasyona tam uygun **analitik faktöriyelli formda** ($\frac{f^{(k)}(a)}{k!}$) gösterilir.
|
* Tek ve çok değişkenli Taylor açılımlarında katsayılar hem ondalıklı, hem **sadeleştirilmiş kesirli formda**, hem de formülasyona tam uygun **analitik faktöriyelli formda** ($\frac{f^{(k)}(a)}{k!}$) gösterilir.
|
||||||
|
|
||||||
### 8. 🎲 Kombinatorik, Polar Dönüşüm ve Özel Fonksiyonlar
|
### 8. 🎲 Kombinatorik, Polar Dönüşüm ve Özel Fonksiyonlar (v3.4)
|
||||||
* Düzeltilmiş Taban ($b$) arayüz kutusu, taşmasız $C(n, k)$ ve $P(n, k)$ kombinatorik motoru, Pascal üçgeni ve polar/kartezyen dönüşümler.
|
* **4 Kartlı Modern Mimari:** Ayrık Matematik ($n!, P, C$), Asenkron Dizi Üreteci (güvenlik koruması ve sayfalamalı gösterim), Vektörel Polar Dönüşüm (canlı vektör açısı ve büyüklük diyagramı) ve İleri Analitik Fonksiyonlar ($\sinh, \cosh, \tanh, \log_b$).
|
||||||
|
* **Zengin Sekmeli Çıktı Alanı:** Özet Kartı, Pascal Üçgeni Piramidi, Sayfalamalı Kombinasyon Listesi, `[JSON İndir]` ve `[Kopyala]` araçları.
|
||||||
|
|
||||||
### 9. 🔢 Basit & Bilimsel Hesap Makinesi
|
### 9. 📐 Nümerik Türev, Kısmi Türev & Hessian Stüdyosu (v3.4)
|
||||||
|
* **Nümerik Ayar Çubuğu:** $h$ adım boyutu hızlı seçimleri (`1e-3`, `1e-5`, `1e-7`), Merkezi/İleri/Geri fark formülleri, $O(h^2), O(h^4), O(h^6)$ doğruluk derecesi.
|
||||||
|
* **Tek Değişkenli Türev & Teğet Çizici:** $f^{(n)}(x_0)$ hesabı, teğet ve normal doğru denklemleri, `[📈 Teğeti Grafikte Çiz]` entegrasyonu.
|
||||||
|
* **Çok Değişkenli Analiz, Gradyan & Hessian:** Dinamik değişken ekleme, $\nabla f$ gradyan vektörü, birim $\vec{u}$ vektörü ile yönlü türev ($D_{\vec{u}} f$) ve 2. mertebe Hessian simetrik matrisi ile yerel ekstremum (min/max/eyer) testi.
|
||||||
|
|
||||||
|
### 10. 🔢 Basit & Bilimsel Hesap Makinesi
|
||||||
* 128-bit `decimal` motoru, RAD/DEG modları, otomatik parantez tamamlama ve geçmiş paneli.
|
* 128-bit `decimal` motoru, RAD/DEG modları, otomatik parantez tamamlama ve geçmiş paneli.
|
||||||
|
|
||||||
### 10. ⚖️ Doğrusal & Doğrusal Olmayan Denklem Sistemleri
|
### 10. ⚖️ Doğrusal & Doğrusal Olmayan Denklem Sistemleri
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
; Script generated by Antigravity for ttCalculator
|
; Script generated by Antigravity for ttCalculator
|
||||||
#define MyAppName "ttCalculator"
|
#define MyAppName "ttCalculator"
|
||||||
#define MyAppVersion "3.3.0"
|
#define MyAppVersion "3.4.0"
|
||||||
#define MyAppPublisher "LilDosto"
|
#define MyAppPublisher "LilDosto"
|
||||||
#define MyAppURL "https://github.com/LilDosto/ttCalculator"
|
#define MyAppURL "https://github.com/LilDosto/ttCalculator"
|
||||||
#define MyAppExeName "ttCalculator.exe"
|
#define MyAppExeName "ttCalculator.exe"
|
||||||
|
|
@ -25,7 +25,7 @@ DefaultGroupName={#MyAppName}
|
||||||
AllowNoIcons=yes
|
AllowNoIcons=yes
|
||||||
LicenseFile=..\LICENSE
|
LicenseFile=..\LICENSE
|
||||||
OutputDir=..\Release
|
OutputDir=..\Release
|
||||||
OutputBaseFilename=ttCalculator-v3.3.0-Setup
|
OutputBaseFilename=ttCalculator-v3.4.0-Setup
|
||||||
SetupIconFile=..\Release\logo.ico
|
SetupIconFile=..\Release\logo.ico
|
||||||
Compression=lzma2/ultra64
|
Compression=lzma2/ultra64
|
||||||
SolidCompression=yes
|
SolidCompression=yes
|
||||||
|
|
|
||||||
|
|
@ -6,21 +6,28 @@ namespace MathApp.Controls
|
||||||
partial class CombinatoricsControl
|
partial class CombinatoricsControl
|
||||||
{
|
{
|
||||||
private System.ComponentModel.IContainer components = null;
|
private System.ComponentModel.IContainer components = null;
|
||||||
private Panel pnlLeft;
|
|
||||||
private Label lblTitle;
|
|
||||||
private Label lblDesc;
|
|
||||||
|
|
||||||
// Group 1: Combinatorics & Permutations
|
// Main Layout
|
||||||
private GroupBox grpComb;
|
private Panel pnlLeft;
|
||||||
|
private Panel pnlRight;
|
||||||
|
private Panel pnlHeader;
|
||||||
|
private Label lblMainTitle;
|
||||||
|
private Label lblMainSubtitle;
|
||||||
|
|
||||||
|
// Card 1: Combinatorics
|
||||||
|
private Panel cardComb;
|
||||||
|
private Label lblCard1Title;
|
||||||
private Label lblN;
|
private Label lblN;
|
||||||
private NumericUpDown numN;
|
private NumericUpDown numN;
|
||||||
private Label lblR;
|
private Label lblR;
|
||||||
private NumericUpDown numR;
|
private NumericUpDown numR;
|
||||||
private Button btnCalcComb;
|
private Button btnCalcComb;
|
||||||
private Button btnPascal;
|
private Button btnPascal;
|
||||||
|
private Label lblFormulaPreview;
|
||||||
|
|
||||||
// Group 2: String Combination Generator
|
// Card 2: String Generator
|
||||||
private GroupBox grpStrings;
|
private Panel cardStrings;
|
||||||
|
private Label lblCard2Title;
|
||||||
private Label lblAlphabet;
|
private Label lblAlphabet;
|
||||||
private TextBox txtAlphabet;
|
private TextBox txtAlphabet;
|
||||||
private Label lblPrefix;
|
private Label lblPrefix;
|
||||||
|
|
@ -28,27 +35,56 @@ namespace MathApp.Controls
|
||||||
private Label lblLength;
|
private Label lblLength;
|
||||||
private NumericUpDown numLength;
|
private NumericUpDown numLength;
|
||||||
private Button btnGenStrings;
|
private Button btnGenStrings;
|
||||||
|
private ProgressBar pbStrings;
|
||||||
|
private Label lblStringsStatus;
|
||||||
|
|
||||||
// Group 3: Polar & Vector Coordinates
|
// Card 3: Polar & Vector
|
||||||
private GroupBox grpPolar;
|
private Panel cardPolar;
|
||||||
|
private Label lblCard3Title;
|
||||||
private Label lblCoordX;
|
private Label lblCoordX;
|
||||||
private TextBox txtCoordX;
|
private TextBox txtCoordX;
|
||||||
private Label lblCoordY;
|
private Label lblCoordY;
|
||||||
private TextBox txtCoordY;
|
private TextBox txtCoordY;
|
||||||
private Button btnPolarConvert;
|
private Button btnPolarConvert;
|
||||||
|
private Panel pnlVectorCanvas;
|
||||||
|
|
||||||
// Group 4: Special Functions
|
// Card 4: Special Functions
|
||||||
private GroupBox grpSpecial;
|
private Panel cardSpecial;
|
||||||
|
private Label lblCard4Title;
|
||||||
private Label lblSpecialX;
|
private Label lblSpecialX;
|
||||||
private TextBox txtSpecialX;
|
private TextBox txtSpecialX;
|
||||||
private Label lblBase;
|
private Label lblBase;
|
||||||
private TextBox txtBase;
|
private TextBox txtBase;
|
||||||
private Button btnSpecialCalc;
|
private Button btnSpecialCalc;
|
||||||
|
|
||||||
private RichTextBox txtOutput;
|
// Right Panel: Output & Reporting
|
||||||
private Panel pnlRightHeader;
|
private Panel pnlToolbar;
|
||||||
private Label lblOutputTitle;
|
private Label lblOutputTitle;
|
||||||
private Button btnCopyOutput;
|
private Button btnCopyOutput;
|
||||||
|
private Button btnExportJson;
|
||||||
|
private Button btnClearOutput;
|
||||||
|
|
||||||
|
private TabControl tabOutput;
|
||||||
|
private TabPage tabSummary;
|
||||||
|
private TabPage tabPascal;
|
||||||
|
private TabPage tabStrings;
|
||||||
|
|
||||||
|
// Summary Tab Controls
|
||||||
|
private Panel pnlKpiCard;
|
||||||
|
private Label lblKpiTitle;
|
||||||
|
private Label lblKpiValue;
|
||||||
|
private Label lblKpiSubtitle;
|
||||||
|
private RichTextBox txtSummaryDetails;
|
||||||
|
|
||||||
|
// Pascal Tab Controls
|
||||||
|
private RichTextBox txtPascalView;
|
||||||
|
|
||||||
|
// Strings Tab Controls
|
||||||
|
private Panel pnlPagination;
|
||||||
|
private Button btnPrevPage;
|
||||||
|
private Button btnNextPage;
|
||||||
|
private Label lblPageInfo;
|
||||||
|
private RichTextBox txtStringsView;
|
||||||
|
|
||||||
protected override void Dispose(bool disposing)
|
protected override void Dispose(bool disposing)
|
||||||
{
|
{
|
||||||
|
|
@ -59,18 +95,24 @@ namespace MathApp.Controls
|
||||||
private void InitializeComponent()
|
private void InitializeComponent()
|
||||||
{
|
{
|
||||||
this.pnlLeft = new Panel();
|
this.pnlLeft = new Panel();
|
||||||
this.lblTitle = new Label();
|
this.pnlRight = new Panel();
|
||||||
this.lblDesc = new Label();
|
this.pnlHeader = new Panel();
|
||||||
|
this.lblMainTitle = new Label();
|
||||||
|
this.lblMainSubtitle = new Label();
|
||||||
|
|
||||||
this.grpComb = new GroupBox();
|
// Cards
|
||||||
|
this.cardComb = new Panel();
|
||||||
|
this.lblCard1Title = new Label();
|
||||||
this.lblN = new Label();
|
this.lblN = new Label();
|
||||||
this.numN = new NumericUpDown();
|
this.numN = new NumericUpDown();
|
||||||
this.lblR = new Label();
|
this.lblR = new Label();
|
||||||
this.numR = new NumericUpDown();
|
this.numR = new NumericUpDown();
|
||||||
this.btnCalcComb = new Button();
|
this.btnCalcComb = new Button();
|
||||||
this.btnPascal = new Button();
|
this.btnPascal = new Button();
|
||||||
|
this.lblFormulaPreview = new Label();
|
||||||
|
|
||||||
this.grpStrings = new GroupBox();
|
this.cardStrings = new Panel();
|
||||||
|
this.lblCard2Title = new Label();
|
||||||
this.lblAlphabet = new Label();
|
this.lblAlphabet = new Label();
|
||||||
this.txtAlphabet = new TextBox();
|
this.txtAlphabet = new TextBox();
|
||||||
this.lblPrefix = new Label();
|
this.lblPrefix = new Label();
|
||||||
|
|
@ -78,255 +120,536 @@ namespace MathApp.Controls
|
||||||
this.lblLength = new Label();
|
this.lblLength = new Label();
|
||||||
this.numLength = new NumericUpDown();
|
this.numLength = new NumericUpDown();
|
||||||
this.btnGenStrings = new Button();
|
this.btnGenStrings = new Button();
|
||||||
|
this.pbStrings = new ProgressBar();
|
||||||
|
this.lblStringsStatus = new Label();
|
||||||
|
|
||||||
this.grpPolar = new GroupBox();
|
this.cardPolar = new Panel();
|
||||||
|
this.lblCard3Title = new Label();
|
||||||
this.lblCoordX = new Label();
|
this.lblCoordX = new Label();
|
||||||
this.txtCoordX = new TextBox();
|
this.txtCoordX = new TextBox();
|
||||||
this.lblCoordY = new Label();
|
this.lblCoordY = new Label();
|
||||||
this.txtCoordY = new TextBox();
|
this.txtCoordY = new TextBox();
|
||||||
this.btnPolarConvert = new Button();
|
this.btnPolarConvert = new Button();
|
||||||
|
this.pnlVectorCanvas = new Panel();
|
||||||
|
|
||||||
this.grpSpecial = new GroupBox();
|
this.cardSpecial = new Panel();
|
||||||
|
this.lblCard4Title = new Label();
|
||||||
this.lblSpecialX = new Label();
|
this.lblSpecialX = new Label();
|
||||||
this.txtSpecialX = new TextBox();
|
this.txtSpecialX = new TextBox();
|
||||||
this.lblBase = new Label();
|
this.lblBase = new Label();
|
||||||
this.txtBase = new TextBox();
|
this.txtBase = new TextBox();
|
||||||
this.btnSpecialCalc = new Button();
|
this.btnSpecialCalc = new Button();
|
||||||
|
|
||||||
this.txtOutput = new RichTextBox();
|
// Right
|
||||||
|
this.pnlToolbar = new Panel();
|
||||||
|
this.lblOutputTitle = new Label();
|
||||||
|
this.btnCopyOutput = new Button();
|
||||||
|
this.btnExportJson = new Button();
|
||||||
|
this.btnClearOutput = new Button();
|
||||||
|
|
||||||
|
this.tabOutput = new TabControl();
|
||||||
|
this.tabSummary = new TabPage();
|
||||||
|
this.tabPascal = new TabPage();
|
||||||
|
this.tabStrings = new TabPage();
|
||||||
|
|
||||||
|
this.pnlKpiCard = new Panel();
|
||||||
|
this.lblKpiTitle = new Label();
|
||||||
|
this.lblKpiValue = new Label();
|
||||||
|
this.lblKpiSubtitle = new Label();
|
||||||
|
this.txtSummaryDetails = new RichTextBox();
|
||||||
|
|
||||||
|
this.txtPascalView = new RichTextBox();
|
||||||
|
|
||||||
|
this.pnlPagination = new Panel();
|
||||||
|
this.btnPrevPage = new Button();
|
||||||
|
this.btnNextPage = new Button();
|
||||||
|
this.lblPageInfo = new Label();
|
||||||
|
this.txtStringsView = new RichTextBox();
|
||||||
|
|
||||||
this.SuspendLayout();
|
this.SuspendLayout();
|
||||||
|
|
||||||
this.BackColor = Color.FromArgb(24, 25, 32);
|
// Base control
|
||||||
|
this.BackColor = Color.FromArgb(15, 23, 42); // Modern Dark Slate
|
||||||
this.Dock = DockStyle.Fill;
|
this.Dock = DockStyle.Fill;
|
||||||
this.Padding = new Padding(12);
|
this.Padding = new Padding(10);
|
||||||
|
|
||||||
|
// ==========================================
|
||||||
|
// Left Panel (Cards)
|
||||||
|
// ==========================================
|
||||||
this.pnlLeft.Dock = DockStyle.Left;
|
this.pnlLeft.Dock = DockStyle.Left;
|
||||||
this.pnlLeft.Width = 380;
|
this.pnlLeft.Width = 430;
|
||||||
this.pnlLeft.BackColor = Color.FromArgb(30, 32, 42);
|
this.pnlLeft.BackColor = Color.FromArgb(15, 23, 42);
|
||||||
this.pnlLeft.Padding = new Padding(12);
|
this.pnlLeft.Padding = new Padding(0, 0, 10, 0);
|
||||||
this.pnlLeft.AutoScroll = true;
|
this.pnlLeft.AutoScroll = true;
|
||||||
|
|
||||||
this.lblTitle.Text = "Kombinatorik & Özel Fonksiyonlar";
|
// Header in Left Panel
|
||||||
this.lblTitle.Font = new Font("Segoe UI", 12.5F, FontStyle.Bold);
|
this.pnlHeader.Dock = DockStyle.Top;
|
||||||
this.lblTitle.ForeColor = Color.White;
|
this.pnlHeader.Height = 65;
|
||||||
this.lblTitle.Location = new Point(12, 10);
|
this.pnlHeader.BackColor = Color.Transparent;
|
||||||
this.lblTitle.AutoSize = true;
|
|
||||||
|
|
||||||
this.lblDesc.Text = "Faktöriyel, Kombinasyon, Permütasyon, Dizi Üreteci, Polar/Atan2 ve Hiperbolik Fonksiyonlar.";
|
this.lblMainTitle.Text = "Kombinatorik & Özel Fonksiyonlar";
|
||||||
this.lblDesc.Font = new Font("Segoe UI", 8.5F);
|
this.lblMainTitle.Font = new Font("Segoe UI", 12F, FontStyle.Bold);
|
||||||
this.lblDesc.ForeColor = Color.FromArgb(165, 175, 195);
|
this.lblMainTitle.ForeColor = Color.White;
|
||||||
this.lblDesc.Location = new Point(12, 34);
|
this.lblMainTitle.Location = new Point(4, 4);
|
||||||
this.lblDesc.Size = new Size(350, 28);
|
this.lblMainTitle.AutoSize = true;
|
||||||
|
|
||||||
|
this.lblMainSubtitle.Text = "Ayrık matematik, dizi permütasyonları, vektör polar dönüşümleri ve ileri analitik laboratuvarı.";
|
||||||
|
this.lblMainSubtitle.Font = new Font("Segoe UI", 8.25F);
|
||||||
|
this.lblMainSubtitle.ForeColor = Color.FromArgb(148, 163, 184);
|
||||||
|
this.lblMainSubtitle.Location = new Point(5, 28);
|
||||||
|
this.lblMainSubtitle.Size = new Size(405, 30);
|
||||||
|
|
||||||
|
this.pnlHeader.Controls.Add(this.lblMainTitle);
|
||||||
|
this.pnlHeader.Controls.Add(this.lblMainSubtitle);
|
||||||
|
|
||||||
|
// Helper for Styling Cards
|
||||||
|
void SetupCard(Panel p, int height)
|
||||||
|
{
|
||||||
|
p.Dock = DockStyle.Top;
|
||||||
|
p.Height = height;
|
||||||
|
p.BackColor = Color.FromArgb(22, 32, 50);
|
||||||
|
p.Padding = new Padding(12);
|
||||||
|
p.Margin = new Padding(0, 0, 0, 10);
|
||||||
|
}
|
||||||
|
|
||||||
|
// --- Card 1: Combinatorics ---
|
||||||
|
SetupCard(this.cardComb, 160);
|
||||||
|
this.lblCard1Title.Text = "📐 1. Ayrık Matematik (Kombinatorik & Binom)";
|
||||||
|
this.lblCard1Title.Font = new Font("Segoe UI Semibold", 9.5F, FontStyle.Bold);
|
||||||
|
this.lblCard1Title.ForeColor = Color.FromArgb(56, 189, 248);
|
||||||
|
this.lblCard1Title.Location = new Point(10, 10);
|
||||||
|
this.lblCard1Title.AutoSize = true;
|
||||||
|
|
||||||
|
this.lblN.Text = "Eleman (n):";
|
||||||
|
this.lblN.ForeColor = Color.FromArgb(203, 213, 225);
|
||||||
|
this.lblN.Location = new Point(12, 38);
|
||||||
|
this.lblN.AutoSize = true;
|
||||||
|
|
||||||
// Group 1: Combinatorics
|
|
||||||
StyleGroupBox(grpComb, "1. Kombinasyon, Permütasyon & Faktöriyel", new Point(12, 68), new Size(350, 115));
|
|
||||||
StyleLabel(lblN, "n:", new Point(15, 26));
|
|
||||||
((System.ComponentModel.ISupportInitialize)(this.numN)).BeginInit();
|
((System.ComponentModel.ISupportInitialize)(this.numN)).BeginInit();
|
||||||
this.numN.Location = new Point(36, 23);
|
this.numN.Location = new Point(90, 36);
|
||||||
|
this.numN.Size = new Size(65, 23);
|
||||||
this.numN.Minimum = 0;
|
this.numN.Minimum = 0;
|
||||||
this.numN.Maximum = 60;
|
this.numN.Maximum = 60;
|
||||||
this.numN.Value = 10;
|
this.numN.Value = 10;
|
||||||
this.numN.Size = new Size(55, 23);
|
this.numN.BackColor = Color.FromArgb(30, 41, 59);
|
||||||
this.numN.BackColor = Color.FromArgb(40, 43, 56);
|
|
||||||
this.numN.ForeColor = Color.White;
|
this.numN.ForeColor = Color.White;
|
||||||
((System.ComponentModel.ISupportInitialize)(this.numN)).EndInit();
|
((System.ComponentModel.ISupportInitialize)(this.numN)).EndInit();
|
||||||
|
|
||||||
StyleLabel(lblR, "r (k):", new Point(105, 26));
|
this.lblR.Text = "Seçim (r / k):";
|
||||||
|
this.lblR.ForeColor = Color.FromArgb(203, 213, 225);
|
||||||
|
this.lblR.Location = new Point(175, 38);
|
||||||
|
this.lblR.AutoSize = true;
|
||||||
|
|
||||||
((System.ComponentModel.ISupportInitialize)(this.numR)).BeginInit();
|
((System.ComponentModel.ISupportInitialize)(this.numR)).BeginInit();
|
||||||
this.numR.Location = new Point(145, 23);
|
this.numR.Location = new Point(255, 36);
|
||||||
|
this.numR.Size = new Size(65, 23);
|
||||||
this.numR.Minimum = 0;
|
this.numR.Minimum = 0;
|
||||||
this.numR.Maximum = 60;
|
this.numR.Maximum = 60;
|
||||||
this.numR.Value = 3;
|
this.numR.Value = 3;
|
||||||
this.numR.Size = new Size(55, 23);
|
this.numR.BackColor = Color.FromArgb(30, 41, 59);
|
||||||
this.numR.BackColor = Color.FromArgb(40, 43, 56);
|
|
||||||
this.numR.ForeColor = Color.White;
|
this.numR.ForeColor = Color.White;
|
||||||
((System.ComponentModel.ISupportInitialize)(this.numR)).EndInit();
|
((System.ComponentModel.ISupportInitialize)(this.numR)).EndInit();
|
||||||
|
|
||||||
StyleActionBtn(btnCalcComb, "n!, P(n,r), C(n,r) Hesapla", new Point(15, 54), new Size(320, 26));
|
this.btnCalcComb.Text = "n!, P(n,r), C(n,r) Hesapla";
|
||||||
StyleActionBtn(btnPascal, "Pascal Üçgeni (Binom)", new Point(15, 83), new Size(320, 24));
|
this.btnCalcComb.Location = new Point(12, 70);
|
||||||
this.btnPascal.BackColor = Color.FromArgb(45, 52, 70);
|
this.btnCalcComb.Size = new Size(190, 32);
|
||||||
|
this.btnCalcComb.FlatStyle = FlatStyle.Flat;
|
||||||
|
this.btnCalcComb.BackColor = Color.FromArgb(14, 165, 233);
|
||||||
|
this.btnCalcComb.ForeColor = Color.White;
|
||||||
|
this.btnCalcComb.Font = new Font("Segoe UI Semibold", 8.5F, FontStyle.Bold);
|
||||||
|
this.btnCalcComb.Cursor = Cursors.Hand;
|
||||||
|
this.btnCalcComb.FlatAppearance.BorderSize = 0;
|
||||||
|
|
||||||
grpComb.Controls.Add(lblN);
|
this.btnPascal.Text = "Pascal Üçgeni Görüntüle";
|
||||||
grpComb.Controls.Add(numN);
|
this.btnPascal.Location = new Point(208, 70);
|
||||||
grpComb.Controls.Add(lblR);
|
this.btnPascal.Size = new Size(185, 32);
|
||||||
grpComb.Controls.Add(numR);
|
this.btnPascal.FlatStyle = FlatStyle.Flat;
|
||||||
grpComb.Controls.Add(btnCalcComb);
|
this.btnPascal.BackColor = Color.FromArgb(51, 65, 85);
|
||||||
grpComb.Controls.Add(btnPascal);
|
this.btnPascal.ForeColor = Color.FromArgb(226, 232, 240);
|
||||||
|
this.btnPascal.Font = new Font("Segoe UI Semibold", 8.5F, FontStyle.Bold);
|
||||||
|
this.btnPascal.Cursor = Cursors.Hand;
|
||||||
|
this.btnPascal.FlatAppearance.BorderSize = 0;
|
||||||
|
|
||||||
|
this.lblFormulaPreview.Text = "Formüller: C(n,r) = n! / [r!(n-r)!] | P(n,r) = n! / (n-r)!";
|
||||||
|
this.lblFormulaPreview.Font = new Font("Segoe UI", 8F);
|
||||||
|
this.lblFormulaPreview.ForeColor = Color.FromArgb(148, 163, 184);
|
||||||
|
this.lblFormulaPreview.Location = new Point(12, 115);
|
||||||
|
this.lblFormulaPreview.AutoSize = true;
|
||||||
|
|
||||||
|
this.cardComb.Controls.Add(this.lblCard1Title);
|
||||||
|
this.cardComb.Controls.Add(this.lblN);
|
||||||
|
this.cardComb.Controls.Add(this.numN);
|
||||||
|
this.cardComb.Controls.Add(this.lblR);
|
||||||
|
this.cardComb.Controls.Add(this.numR);
|
||||||
|
this.cardComb.Controls.Add(this.btnCalcComb);
|
||||||
|
this.cardComb.Controls.Add(this.btnPascal);
|
||||||
|
this.cardComb.Controls.Add(this.lblFormulaPreview);
|
||||||
|
|
||||||
|
// Spacer
|
||||||
|
Panel sp1 = new Panel { Dock = DockStyle.Top, Height = 10, BackColor = Color.Transparent };
|
||||||
|
|
||||||
|
// --- Card 2: Strings ---
|
||||||
|
SetupCard(this.cardStrings, 180);
|
||||||
|
this.lblCard2Title.Text = "🔤 2. Dizi & Permütasyon Dizilim Üreteci";
|
||||||
|
this.lblCard2Title.Font = new Font("Segoe UI Semibold", 9.5F, FontStyle.Bold);
|
||||||
|
this.lblCard2Title.ForeColor = Color.FromArgb(245, 158, 11);
|
||||||
|
this.lblCard2Title.Location = new Point(10, 10);
|
||||||
|
this.lblCard2Title.AutoSize = true;
|
||||||
|
|
||||||
|
this.lblAlphabet.Text = "Alfabe:";
|
||||||
|
this.lblAlphabet.ForeColor = Color.FromArgb(203, 213, 225);
|
||||||
|
this.lblAlphabet.Location = new Point(12, 38);
|
||||||
|
this.lblAlphabet.AutoSize = true;
|
||||||
|
|
||||||
// Group 2: Strings
|
|
||||||
StyleGroupBox(grpStrings, "2. Karakter Kombinasyon Üreteci", new Point(12, 190), new Size(350, 115));
|
|
||||||
StyleLabel(lblAlphabet, "Alfabe:", new Point(15, 24));
|
|
||||||
this.txtAlphabet.Location = new Point(68, 21);
|
|
||||||
this.txtAlphabet.Size = new Size(110, 23);
|
|
||||||
this.txtAlphabet.BackColor = Color.FromArgb(40, 43, 56);
|
|
||||||
this.txtAlphabet.ForeColor = Color.White;
|
|
||||||
this.txtAlphabet.BorderStyle = BorderStyle.FixedSingle;
|
|
||||||
this.txtAlphabet.Text = "ABC";
|
this.txtAlphabet.Text = "ABC";
|
||||||
|
this.txtAlphabet.Location = new Point(62, 35);
|
||||||
|
this.txtAlphabet.Size = new Size(110, 23);
|
||||||
|
this.txtAlphabet.BackColor = Color.FromArgb(30, 41, 59);
|
||||||
|
this.txtAlphabet.ForeColor = Color.White;
|
||||||
|
|
||||||
|
this.lblPrefix.Text = "Önek:";
|
||||||
|
this.lblPrefix.ForeColor = Color.FromArgb(203, 213, 225);
|
||||||
|
this.lblPrefix.Location = new Point(185, 38);
|
||||||
|
this.lblPrefix.AutoSize = true;
|
||||||
|
|
||||||
|
this.txtPrefix.Text = "";
|
||||||
|
this.txtPrefix.Location = new Point(225, 35);
|
||||||
|
this.txtPrefix.Size = new Size(70, 23);
|
||||||
|
this.txtPrefix.BackColor = Color.FromArgb(30, 41, 59);
|
||||||
|
this.txtPrefix.ForeColor = Color.White;
|
||||||
|
|
||||||
|
this.lblLength.Text = "Boyut:";
|
||||||
|
this.lblLength.ForeColor = Color.FromArgb(203, 213, 225);
|
||||||
|
this.lblLength.Location = new Point(305, 38);
|
||||||
|
this.lblLength.AutoSize = true;
|
||||||
|
|
||||||
StyleLabel(lblLength, "Boyut:", new Point(190, 24));
|
|
||||||
((System.ComponentModel.ISupportInitialize)(this.numLength)).BeginInit();
|
((System.ComponentModel.ISupportInitialize)(this.numLength)).BeginInit();
|
||||||
this.numLength.Location = new Point(238, 21);
|
this.numLength.Location = new Point(350, 35);
|
||||||
this.numLength.Minimum = 1;
|
|
||||||
this.numLength.Maximum = 6;
|
|
||||||
this.numLength.Value = 3;
|
|
||||||
this.numLength.Size = new Size(45, 23);
|
this.numLength.Size = new Size(45, 23);
|
||||||
this.numLength.BackColor = Color.FromArgb(40, 43, 56);
|
this.numLength.Minimum = 1;
|
||||||
|
this.numLength.Maximum = 12;
|
||||||
|
this.numLength.Value = 3;
|
||||||
|
this.numLength.BackColor = Color.FromArgb(30, 41, 59);
|
||||||
this.numLength.ForeColor = Color.White;
|
this.numLength.ForeColor = Color.White;
|
||||||
((System.ComponentModel.ISupportInitialize)(this.numLength)).EndInit();
|
((System.ComponentModel.ISupportInitialize)(this.numLength)).EndInit();
|
||||||
|
|
||||||
StyleLabel(lblPrefix, "Önek:", new Point(15, 52));
|
this.btnGenStrings.Text = "⚡ Dizilimleri Üret (Asenkron)";
|
||||||
this.txtPrefix.Location = new Point(68, 49);
|
this.btnGenStrings.Location = new Point(12, 70);
|
||||||
this.txtPrefix.Size = new Size(110, 23);
|
this.btnGenStrings.Size = new Size(382, 32);
|
||||||
this.txtPrefix.BackColor = Color.FromArgb(40, 43, 56);
|
this.btnGenStrings.FlatStyle = FlatStyle.Flat;
|
||||||
this.txtPrefix.ForeColor = Color.White;
|
this.btnGenStrings.BackColor = Color.FromArgb(217, 119, 6);
|
||||||
this.txtPrefix.BorderStyle = BorderStyle.FixedSingle;
|
this.btnGenStrings.ForeColor = Color.White;
|
||||||
this.txtPrefix.Text = "";
|
this.btnGenStrings.Font = new Font("Segoe UI Semibold", 8.5F, FontStyle.Bold);
|
||||||
|
this.btnGenStrings.Cursor = Cursors.Hand;
|
||||||
|
this.btnGenStrings.FlatAppearance.BorderSize = 0;
|
||||||
|
|
||||||
StyleActionBtn(btnGenStrings, "Dizilimleri Üret", new Point(190, 48), new Size(145, 25));
|
this.pbStrings.Location = new Point(12, 112);
|
||||||
this.btnGenStrings.BackColor = Color.FromArgb(45, 95, 80);
|
this.pbStrings.Size = new Size(382, 10);
|
||||||
|
this.pbStrings.Style = ProgressBarStyle.Continuous;
|
||||||
|
this.pbStrings.Visible = false;
|
||||||
|
|
||||||
grpStrings.Controls.Add(lblAlphabet);
|
this.lblStringsStatus.Text = "Kapasite: N^k kombinasyon. N > 8 veya k > 6 durumunda güvenlik uyarısı verilir.";
|
||||||
grpStrings.Controls.Add(txtAlphabet);
|
this.lblStringsStatus.Font = new Font("Segoe UI", 7.5F);
|
||||||
grpStrings.Controls.Add(lblLength);
|
this.lblStringsStatus.ForeColor = Color.FromArgb(148, 163, 184);
|
||||||
grpStrings.Controls.Add(numLength);
|
this.lblStringsStatus.Location = new Point(12, 130);
|
||||||
grpStrings.Controls.Add(lblPrefix);
|
this.lblStringsStatus.Size = new Size(385, 32);
|
||||||
grpStrings.Controls.Add(txtPrefix);
|
|
||||||
grpStrings.Controls.Add(btnGenStrings);
|
|
||||||
|
|
||||||
// Group 3: Polar & Vector
|
this.cardStrings.Controls.Add(this.lblCard2Title);
|
||||||
StyleGroupBox(grpPolar, "3. Kutupsal (Polar) & Atan2 / Hipotenüs", new Point(12, 312), new Size(350, 95));
|
this.cardStrings.Controls.Add(this.lblAlphabet);
|
||||||
StyleLabel(lblCoordX, "X:", new Point(15, 24));
|
this.cardStrings.Controls.Add(this.txtAlphabet);
|
||||||
this.txtCoordX.Location = new Point(36, 21);
|
this.cardStrings.Controls.Add(this.lblPrefix);
|
||||||
|
this.cardStrings.Controls.Add(this.txtPrefix);
|
||||||
|
this.cardStrings.Controls.Add(this.lblLength);
|
||||||
|
this.cardStrings.Controls.Add(this.numLength);
|
||||||
|
this.cardStrings.Controls.Add(this.btnGenStrings);
|
||||||
|
this.cardStrings.Controls.Add(this.pbStrings);
|
||||||
|
this.cardStrings.Controls.Add(this.lblStringsStatus);
|
||||||
|
|
||||||
|
// Spacer
|
||||||
|
Panel sp2 = new Panel { Dock = DockStyle.Top, Height = 10, BackColor = Color.Transparent };
|
||||||
|
|
||||||
|
// --- Card 3: Polar & Vector ---
|
||||||
|
SetupCard(this.cardPolar, 230);
|
||||||
|
this.lblCard3Title.Text = "🧭 3. Vektörel & Polar Koordinat Dönüşümü";
|
||||||
|
this.lblCard3Title.Font = new Font("Segoe UI Semibold", 9.5F, FontStyle.Bold);
|
||||||
|
this.lblCard3Title.ForeColor = Color.FromArgb(52, 211, 153);
|
||||||
|
this.lblCard3Title.Location = new Point(10, 10);
|
||||||
|
this.lblCard3Title.AutoSize = true;
|
||||||
|
|
||||||
|
this.lblCoordX.Text = "X (Reel):";
|
||||||
|
this.lblCoordX.ForeColor = Color.FromArgb(203, 213, 225);
|
||||||
|
this.lblCoordX.Location = new Point(12, 38);
|
||||||
|
this.lblCoordX.AutoSize = true;
|
||||||
|
|
||||||
|
this.txtCoordX.Text = "4";
|
||||||
|
this.txtCoordX.Location = new Point(70, 35);
|
||||||
this.txtCoordX.Size = new Size(80, 23);
|
this.txtCoordX.Size = new Size(80, 23);
|
||||||
this.txtCoordX.BackColor = Color.FromArgb(40, 43, 56);
|
this.txtCoordX.BackColor = Color.FromArgb(30, 41, 59);
|
||||||
this.txtCoordX.ForeColor = Color.White;
|
this.txtCoordX.ForeColor = Color.White;
|
||||||
this.txtCoordX.BorderStyle = BorderStyle.FixedSingle;
|
|
||||||
this.txtCoordX.Text = "3";
|
|
||||||
|
|
||||||
StyleLabel(lblCoordY, "Y:", new Point(130, 24));
|
this.lblCoordY.Text = "Y (İmaj):";
|
||||||
this.txtCoordY.Location = new Point(152, 21);
|
this.lblCoordY.ForeColor = Color.FromArgb(203, 213, 225);
|
||||||
|
this.lblCoordY.Location = new Point(165, 38);
|
||||||
|
this.lblCoordY.AutoSize = true;
|
||||||
|
|
||||||
|
this.txtCoordY.Text = "3";
|
||||||
|
this.txtCoordY.Location = new Point(220, 35);
|
||||||
this.txtCoordY.Size = new Size(80, 23);
|
this.txtCoordY.Size = new Size(80, 23);
|
||||||
this.txtCoordY.BackColor = Color.FromArgb(40, 43, 56);
|
this.txtCoordY.BackColor = Color.FromArgb(30, 41, 59);
|
||||||
this.txtCoordY.ForeColor = Color.White;
|
this.txtCoordY.ForeColor = Color.White;
|
||||||
this.txtCoordY.BorderStyle = BorderStyle.FixedSingle;
|
|
||||||
this.txtCoordY.Text = "4";
|
|
||||||
|
|
||||||
StyleActionBtn(btnPolarConvert, "(r, θ) ve Hipotenüs Hesapla", new Point(15, 54), new Size(320, 26));
|
this.btnPolarConvert.Text = "Dönüştür (r, θ)";
|
||||||
|
this.btnPolarConvert.Location = new Point(310, 33);
|
||||||
|
this.btnPolarConvert.Size = new Size(85, 26);
|
||||||
|
this.btnPolarConvert.FlatStyle = FlatStyle.Flat;
|
||||||
|
this.btnPolarConvert.BackColor = Color.FromArgb(16, 185, 129);
|
||||||
|
this.btnPolarConvert.ForeColor = Color.White;
|
||||||
|
this.btnPolarConvert.Font = new Font("Segoe UI Semibold", 8F, FontStyle.Bold);
|
||||||
|
this.btnPolarConvert.Cursor = Cursors.Hand;
|
||||||
|
this.btnPolarConvert.FlatAppearance.BorderSize = 0;
|
||||||
|
|
||||||
grpPolar.Controls.Add(lblCoordX);
|
// Mini Vector Canvas
|
||||||
grpPolar.Controls.Add(txtCoordX);
|
this.pnlVectorCanvas.Location = new Point(12, 68);
|
||||||
grpPolar.Controls.Add(lblCoordY);
|
this.pnlVectorCanvas.Size = new Size(382, 145);
|
||||||
grpPolar.Controls.Add(txtCoordY);
|
this.pnlVectorCanvas.BackColor = Color.FromArgb(15, 23, 42);
|
||||||
grpPolar.Controls.Add(btnPolarConvert);
|
|
||||||
|
|
||||||
// Group 4: Special Functions
|
this.cardPolar.Controls.Add(this.lblCard3Title);
|
||||||
StyleGroupBox(grpSpecial, "4. Hiperbolik, Ters Trig & Özel Logaritma", new Point(12, 414), new Size(350, 105));
|
this.cardPolar.Controls.Add(this.lblCoordX);
|
||||||
StyleLabel(lblSpecialX, "x:", new Point(12, 24));
|
this.cardPolar.Controls.Add(this.txtCoordX);
|
||||||
this.txtSpecialX.Location = new Point(32, 21);
|
this.cardPolar.Controls.Add(this.lblCoordY);
|
||||||
this.txtSpecialX.Size = new Size(75, 24);
|
this.cardPolar.Controls.Add(this.txtCoordY);
|
||||||
this.txtSpecialX.BackColor = Color.FromArgb(40, 43, 56);
|
this.cardPolar.Controls.Add(this.btnPolarConvert);
|
||||||
|
this.cardPolar.Controls.Add(this.pnlVectorCanvas);
|
||||||
|
|
||||||
|
// Spacer
|
||||||
|
Panel sp3 = new Panel { Dock = DockStyle.Top, Height = 10, BackColor = Color.Transparent };
|
||||||
|
|
||||||
|
// --- Card 4: Special Functions ---
|
||||||
|
SetupCard(this.cardSpecial, 125);
|
||||||
|
this.lblCard4Title.Text = "⚛️ 4. İleri Analitik & Özel Fonksiyonlar";
|
||||||
|
this.lblCard4Title.Font = new Font("Segoe UI Semibold", 9.5F, FontStyle.Bold);
|
||||||
|
this.lblCard4Title.ForeColor = Color.FromArgb(168, 85, 247);
|
||||||
|
this.lblCard4Title.Location = new Point(10, 10);
|
||||||
|
this.lblCard4Title.AutoSize = true;
|
||||||
|
|
||||||
|
this.lblSpecialX.Text = "Değer (x):";
|
||||||
|
this.lblSpecialX.ForeColor = Color.FromArgb(203, 213, 225);
|
||||||
|
this.lblSpecialX.Location = new Point(12, 38);
|
||||||
|
this.lblSpecialX.AutoSize = true;
|
||||||
|
|
||||||
|
this.txtSpecialX.Text = "1.5";
|
||||||
|
this.txtSpecialX.Location = new Point(75, 35);
|
||||||
|
this.txtSpecialX.Size = new Size(80, 23);
|
||||||
|
this.txtSpecialX.BackColor = Color.FromArgb(30, 41, 59);
|
||||||
this.txtSpecialX.ForeColor = Color.White;
|
this.txtSpecialX.ForeColor = Color.White;
|
||||||
this.txtSpecialX.BorderStyle = BorderStyle.FixedSingle;
|
|
||||||
this.txtSpecialX.Font = new Font("Consolas", 9.5F);
|
|
||||||
this.txtSpecialX.TextAlign = HorizontalAlignment.Center;
|
|
||||||
this.txtSpecialX.Text = "0.75";
|
|
||||||
|
|
||||||
StyleLabel(lblBase, "Taban (b):", new Point(125, 24));
|
this.lblBase.Text = "Log Tabanı (b):";
|
||||||
this.txtBase.Location = new Point(200, 21);
|
this.lblBase.ForeColor = Color.FromArgb(203, 213, 225);
|
||||||
this.txtBase.Size = new Size(85, 24);
|
this.lblBase.Location = new Point(170, 38);
|
||||||
this.txtBase.BackColor = Color.FromArgb(40, 43, 56);
|
this.lblBase.AutoSize = true;
|
||||||
this.txtBase.ForeColor = Color.White;
|
|
||||||
this.txtBase.BorderStyle = BorderStyle.FixedSingle;
|
|
||||||
this.txtBase.Font = new Font("Consolas", 9.5F);
|
|
||||||
this.txtBase.TextAlign = HorizontalAlignment.Center;
|
|
||||||
this.txtBase.Text = "2";
|
this.txtBase.Text = "2";
|
||||||
|
this.txtBase.Location = new Point(265, 35);
|
||||||
|
this.txtBase.Size = new Size(50, 23);
|
||||||
|
this.txtBase.BackColor = Color.FromArgb(30, 41, 59);
|
||||||
|
this.txtBase.ForeColor = Color.White;
|
||||||
|
|
||||||
StyleActionBtn(btnSpecialCalc, "sinh, cosh, asin, acos, atan, log Hesapla", new Point(15, 54), new Size(320, 26));
|
this.btnSpecialCalc.Text = "sinh, cosh, tanh, log_b Hesapla";
|
||||||
this.btnSpecialCalc.BackColor = Color.FromArgb(50, 110, 190);
|
this.btnSpecialCalc.Location = new Point(12, 70);
|
||||||
|
this.btnSpecialCalc.Size = new Size(382, 32);
|
||||||
|
this.btnSpecialCalc.FlatStyle = FlatStyle.Flat;
|
||||||
|
this.btnSpecialCalc.BackColor = Color.FromArgb(147, 51, 234);
|
||||||
|
this.btnSpecialCalc.ForeColor = Color.White;
|
||||||
|
this.btnSpecialCalc.Font = new Font("Segoe UI Semibold", 8.5F, FontStyle.Bold);
|
||||||
|
this.btnSpecialCalc.Cursor = Cursors.Hand;
|
||||||
|
this.btnSpecialCalc.FlatAppearance.BorderSize = 0;
|
||||||
|
|
||||||
grpSpecial.Controls.Add(lblSpecialX);
|
this.cardSpecial.Controls.Add(this.lblCard4Title);
|
||||||
grpSpecial.Controls.Add(txtSpecialX);
|
this.cardSpecial.Controls.Add(this.lblSpecialX);
|
||||||
grpSpecial.Controls.Add(lblBase);
|
this.cardSpecial.Controls.Add(this.txtSpecialX);
|
||||||
grpSpecial.Controls.Add(txtBase);
|
this.cardSpecial.Controls.Add(this.lblBase);
|
||||||
grpSpecial.Controls.Add(btnSpecialCalc);
|
this.cardSpecial.Controls.Add(this.txtBase);
|
||||||
|
this.cardSpecial.Controls.Add(this.btnSpecialCalc);
|
||||||
|
|
||||||
this.pnlLeft.Controls.Add(this.lblTitle);
|
// Add cards in reverse order to pnlLeft for DockStyle.Top stacking
|
||||||
this.pnlLeft.Controls.Add(this.lblDesc);
|
this.pnlLeft.Controls.Add(this.cardSpecial);
|
||||||
this.pnlLeft.Controls.Add(this.grpComb);
|
this.pnlLeft.Controls.Add(sp3);
|
||||||
this.pnlLeft.Controls.Add(this.grpStrings);
|
this.pnlLeft.Controls.Add(this.cardPolar);
|
||||||
this.pnlLeft.Controls.Add(this.grpPolar);
|
this.pnlLeft.Controls.Add(sp2);
|
||||||
this.pnlLeft.Controls.Add(this.grpSpecial);
|
this.pnlLeft.Controls.Add(this.cardStrings);
|
||||||
|
this.pnlLeft.Controls.Add(sp1);
|
||||||
|
this.pnlLeft.Controls.Add(this.cardComb);
|
||||||
|
this.pnlLeft.Controls.Add(this.pnlHeader);
|
||||||
|
|
||||||
this.txtOutput.Dock = DockStyle.Fill;
|
// ==========================================
|
||||||
this.txtOutput.BackColor = Color.FromArgb(18, 19, 25);
|
// Right Panel (Rich Tabbed Output Area)
|
||||||
this.txtOutput.ForeColor = Color.FromArgb(225, 232, 245);
|
// ==========================================
|
||||||
this.txtOutput.Font = new Font("Consolas", 10F);
|
this.pnlRight.Dock = DockStyle.Fill;
|
||||||
this.txtOutput.BorderStyle = BorderStyle.None;
|
this.pnlRight.BackColor = Color.FromArgb(22, 32, 50);
|
||||||
this.txtOutput.ReadOnly = true;
|
this.pnlRight.Padding = new Padding(12);
|
||||||
|
|
||||||
this.pnlRightHeader = new Panel { Dock = DockStyle.Top, Height = 34, BackColor = Color.FromArgb(24, 25, 32) };
|
// Toolbar
|
||||||
this.lblOutputTitle = new Label
|
this.pnlToolbar.Dock = DockStyle.Top;
|
||||||
{
|
this.pnlToolbar.Height = 44;
|
||||||
Text = "📊 Hesaplama Sonuç Raporu:",
|
this.pnlToolbar.BackColor = Color.Transparent;
|
||||||
Dock = DockStyle.Left,
|
|
||||||
Font = new Font("Segoe UI Semibold", 9.5F, FontStyle.Bold),
|
|
||||||
ForeColor = ThemeHelper.LightText,
|
|
||||||
TextAlign = ContentAlignment.MiddleLeft
|
|
||||||
};
|
|
||||||
this.btnCopyOutput = new Button
|
|
||||||
{
|
|
||||||
Text = "📋 Kopyala",
|
|
||||||
Dock = DockStyle.Right,
|
|
||||||
Width = 90,
|
|
||||||
FlatStyle = FlatStyle.Flat,
|
|
||||||
BackColor = ThemeHelper.ButtonSecondary,
|
|
||||||
ForeColor = Color.White,
|
|
||||||
Font = new Font("Segoe UI", 8.5F),
|
|
||||||
Cursor = Cursors.Hand
|
|
||||||
};
|
|
||||||
this.btnCopyOutput.FlatAppearance.BorderSize = 0;
|
|
||||||
|
|
||||||
this.pnlRightHeader.Controls.Add(this.lblOutputTitle);
|
this.lblOutputTitle.Text = "📊 Hesaplama ve Analiz Rapor Alanı";
|
||||||
this.pnlRightHeader.Controls.Add(this.btnCopyOutput);
|
this.lblOutputTitle.Font = new Font("Segoe UI Semibold", 10.5F, FontStyle.Bold);
|
||||||
|
this.lblOutputTitle.ForeColor = Color.White;
|
||||||
|
this.lblOutputTitle.Location = new Point(4, 10);
|
||||||
|
this.lblOutputTitle.AutoSize = true;
|
||||||
|
|
||||||
Panel pnlRight = new Panel { Dock = DockStyle.Fill, Padding = new Padding(12, 0, 0, 0) };
|
this.btnClearOutput.Text = "🧹 Temizle";
|
||||||
pnlRight.Controls.Add(this.txtOutput);
|
this.btnClearOutput.Anchor = AnchorStyles.Top | AnchorStyles.Right;
|
||||||
pnlRight.Controls.Add(this.pnlRightHeader);
|
this.btnClearOutput.Location = new Point(this.pnlRight.Width - 95, 6);
|
||||||
|
this.btnClearOutput.Size = new Size(80, 30);
|
||||||
|
this.btnClearOutput.FlatStyle = FlatStyle.Flat;
|
||||||
|
this.btnClearOutput.BackColor = Color.FromArgb(51, 65, 85);
|
||||||
|
this.btnClearOutput.ForeColor = Color.FromArgb(226, 232, 240);
|
||||||
|
this.btnClearOutput.Cursor = Cursors.Hand;
|
||||||
|
this.btnClearOutput.FlatAppearance.BorderSize = 0;
|
||||||
|
|
||||||
this.Controls.Add(pnlRight);
|
this.btnExportJson.Text = "💾 JSON İndir";
|
||||||
|
this.btnExportJson.Anchor = AnchorStyles.Top | AnchorStyles.Right;
|
||||||
|
this.btnExportJson.Location = new Point(this.pnlRight.Width - 195, 6);
|
||||||
|
this.btnExportJson.Size = new Size(95, 30);
|
||||||
|
this.btnExportJson.FlatStyle = FlatStyle.Flat;
|
||||||
|
this.btnExportJson.BackColor = Color.FromArgb(51, 65, 85);
|
||||||
|
this.btnExportJson.ForeColor = Color.FromArgb(226, 232, 240);
|
||||||
|
this.btnExportJson.Cursor = Cursors.Hand;
|
||||||
|
this.btnExportJson.FlatAppearance.BorderSize = 0;
|
||||||
|
|
||||||
|
this.btnCopyOutput.Text = "📋 Kopyala";
|
||||||
|
this.btnCopyOutput.Anchor = AnchorStyles.Top | AnchorStyles.Right;
|
||||||
|
this.btnCopyOutput.Location = new Point(this.pnlRight.Width - 285, 6);
|
||||||
|
this.btnCopyOutput.Size = new Size(85, 30);
|
||||||
|
this.btnCopyOutput.FlatStyle = FlatStyle.Flat;
|
||||||
|
this.btnCopyOutput.BackColor = Color.FromArgb(30, 41, 59);
|
||||||
|
this.btnCopyOutput.ForeColor = Color.FromArgb(56, 189, 248);
|
||||||
|
this.btnCopyOutput.Cursor = Cursors.Hand;
|
||||||
|
this.btnCopyOutput.FlatAppearance.BorderSize = 1;
|
||||||
|
this.btnCopyOutput.FlatAppearance.BorderColor = Color.FromArgb(56, 189, 248);
|
||||||
|
|
||||||
|
this.pnlToolbar.Controls.Add(this.lblOutputTitle);
|
||||||
|
this.pnlToolbar.Controls.Add(this.btnCopyOutput);
|
||||||
|
this.pnlToolbar.Controls.Add(this.btnExportJson);
|
||||||
|
this.pnlToolbar.Controls.Add(this.btnClearOutput);
|
||||||
|
|
||||||
|
// TabControl
|
||||||
|
this.tabOutput.Dock = DockStyle.Fill;
|
||||||
|
this.tabOutput.ItemSize = new Size(130, 28);
|
||||||
|
this.tabOutput.SizeMode = TabSizeMode.Fixed;
|
||||||
|
|
||||||
|
this.tabSummary.Text = " Özet Kartı ";
|
||||||
|
this.tabSummary.BackColor = Color.FromArgb(15, 23, 42);
|
||||||
|
this.tabSummary.Padding = new Padding(10);
|
||||||
|
|
||||||
|
this.tabPascal.Text = " Pascal Üçgeni ";
|
||||||
|
this.tabPascal.BackColor = Color.FromArgb(15, 23, 42);
|
||||||
|
this.tabPascal.Padding = new Padding(10);
|
||||||
|
|
||||||
|
this.tabStrings.Text = " Kombinasyon Listesi ";
|
||||||
|
this.tabStrings.BackColor = Color.FromArgb(15, 23, 42);
|
||||||
|
this.tabStrings.Padding = new Padding(10);
|
||||||
|
|
||||||
|
// Tab 1 (Summary)
|
||||||
|
this.pnlKpiCard.Dock = DockStyle.Top;
|
||||||
|
this.pnlKpiCard.Height = 100;
|
||||||
|
this.pnlKpiCard.BackColor = Color.FromArgb(22, 32, 50);
|
||||||
|
this.pnlKpiCard.Padding = new Padding(12);
|
||||||
|
|
||||||
|
this.lblKpiTitle.Text = "SONUÇ DEĞERİ";
|
||||||
|
this.lblKpiTitle.Font = new Font("Segoe UI Semibold", 8F, FontStyle.Bold);
|
||||||
|
this.lblKpiTitle.ForeColor = Color.FromArgb(148, 163, 184);
|
||||||
|
this.lblKpiTitle.Location = new Point(12, 10);
|
||||||
|
this.lblKpiTitle.AutoSize = true;
|
||||||
|
|
||||||
|
this.lblKpiValue.Text = "—";
|
||||||
|
this.lblKpiValue.Font = new Font("Segoe UI", 22F, FontStyle.Bold);
|
||||||
|
this.lblKpiValue.ForeColor = Color.FromArgb(52, 211, 153);
|
||||||
|
this.lblKpiValue.Location = new Point(10, 26);
|
||||||
|
this.lblKpiValue.AutoSize = true;
|
||||||
|
|
||||||
|
this.lblKpiSubtitle.Text = "Hesaplama yapmak için sol paneldeki modüllerden birini çalıştırın.";
|
||||||
|
this.lblKpiSubtitle.Font = new Font("Segoe UI", 8.5F);
|
||||||
|
this.lblKpiSubtitle.ForeColor = Color.FromArgb(203, 213, 225);
|
||||||
|
this.lblKpiSubtitle.Location = new Point(12, 70);
|
||||||
|
this.lblKpiSubtitle.AutoSize = true;
|
||||||
|
|
||||||
|
this.pnlKpiCard.Controls.Add(this.lblKpiTitle);
|
||||||
|
this.pnlKpiCard.Controls.Add(this.lblKpiValue);
|
||||||
|
this.pnlKpiCard.Controls.Add(this.lblKpiSubtitle);
|
||||||
|
|
||||||
|
this.txtSummaryDetails.Dock = DockStyle.Fill;
|
||||||
|
this.txtSummaryDetails.BackColor = Color.FromArgb(15, 23, 42);
|
||||||
|
this.txtSummaryDetails.ForeColor = Color.FromArgb(226, 232, 240);
|
||||||
|
this.txtSummaryDetails.Font = new Font("Consolas", 10F);
|
||||||
|
this.txtSummaryDetails.BorderStyle = BorderStyle.None;
|
||||||
|
this.txtSummaryDetails.ReadOnly = true;
|
||||||
|
|
||||||
|
Panel spKpi = new Panel { Dock = DockStyle.Top, Height = 10, BackColor = Color.Transparent };
|
||||||
|
this.tabSummary.Controls.Add(this.txtSummaryDetails);
|
||||||
|
this.tabSummary.Controls.Add(spKpi);
|
||||||
|
this.tabSummary.Controls.Add(this.pnlKpiCard);
|
||||||
|
|
||||||
|
// Tab 2 (Pascal)
|
||||||
|
this.txtPascalView.Dock = DockStyle.Fill;
|
||||||
|
this.txtPascalView.BackColor = Color.FromArgb(15, 23, 42);
|
||||||
|
this.txtPascalView.ForeColor = Color.FromArgb(56, 189, 248);
|
||||||
|
this.txtPascalView.Font = new Font("Consolas", 10.5F);
|
||||||
|
this.txtPascalView.BorderStyle = BorderStyle.None;
|
||||||
|
this.txtPascalView.ReadOnly = true;
|
||||||
|
this.tabPascal.Controls.Add(this.txtPascalView);
|
||||||
|
|
||||||
|
// Tab 3 (Strings & Pagination)
|
||||||
|
this.pnlPagination.Dock = DockStyle.Bottom;
|
||||||
|
this.pnlPagination.Height = 40;
|
||||||
|
this.pnlPagination.BackColor = Color.FromArgb(22, 32, 50);
|
||||||
|
|
||||||
|
this.btnPrevPage.Text = "◀ Önceki";
|
||||||
|
this.btnPrevPage.Location = new Point(10, 6);
|
||||||
|
this.btnPrevPage.Size = new Size(80, 28);
|
||||||
|
this.btnPrevPage.FlatStyle = FlatStyle.Flat;
|
||||||
|
this.btnPrevPage.BackColor = Color.FromArgb(30, 41, 59);
|
||||||
|
this.btnPrevPage.ForeColor = Color.White;
|
||||||
|
|
||||||
|
this.lblPageInfo.Text = "Sayfa: 0 / 0 (Toplam 0)";
|
||||||
|
this.lblPageInfo.Location = new Point(100, 11);
|
||||||
|
this.lblPageInfo.Size = new Size(200, 20);
|
||||||
|
this.lblPageInfo.ForeColor = Color.FromArgb(203, 213, 225);
|
||||||
|
|
||||||
|
this.btnNextPage.Text = "Sonraki ▶";
|
||||||
|
this.btnNextPage.Location = new Point(310, 6);
|
||||||
|
this.btnNextPage.Size = new Size(80, 28);
|
||||||
|
this.btnNextPage.FlatStyle = FlatStyle.Flat;
|
||||||
|
this.btnNextPage.BackColor = Color.FromArgb(30, 41, 59);
|
||||||
|
this.btnNextPage.ForeColor = Color.White;
|
||||||
|
|
||||||
|
this.pnlPagination.Controls.Add(this.btnPrevPage);
|
||||||
|
this.pnlPagination.Controls.Add(this.lblPageInfo);
|
||||||
|
this.pnlPagination.Controls.Add(this.btnNextPage);
|
||||||
|
|
||||||
|
this.txtStringsView.Dock = DockStyle.Fill;
|
||||||
|
this.txtStringsView.BackColor = Color.FromArgb(15, 23, 42);
|
||||||
|
this.txtStringsView.ForeColor = Color.FromArgb(245, 158, 11);
|
||||||
|
this.txtStringsView.Font = new Font("Consolas", 9.5F);
|
||||||
|
this.txtStringsView.BorderStyle = BorderStyle.None;
|
||||||
|
this.txtStringsView.ReadOnly = true;
|
||||||
|
|
||||||
|
this.tabStrings.Controls.Add(this.txtStringsView);
|
||||||
|
this.tabStrings.Controls.Add(this.pnlPagination);
|
||||||
|
|
||||||
|
this.tabOutput.TabPages.Add(this.tabSummary);
|
||||||
|
this.tabOutput.TabPages.Add(this.tabPascal);
|
||||||
|
this.tabOutput.TabPages.Add(this.tabStrings);
|
||||||
|
|
||||||
|
this.pnlRight.Controls.Add(this.tabOutput);
|
||||||
|
this.pnlRight.Controls.Add(this.pnlToolbar);
|
||||||
|
|
||||||
|
this.Controls.Add(this.pnlRight);
|
||||||
this.Controls.Add(this.pnlLeft);
|
this.Controls.Add(this.pnlLeft);
|
||||||
|
|
||||||
this.ResumeLayout(false);
|
this.ResumeLayout(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void StyleGroupBox(GroupBox g, string text, Point loc, Size sz)
|
|
||||||
{
|
|
||||||
g.Text = text;
|
|
||||||
g.Location = loc;
|
|
||||||
g.Size = sz;
|
|
||||||
g.ForeColor = Color.FromArgb(160, 210, 255);
|
|
||||||
g.Font = new Font("Segoe UI", 8.5F, FontStyle.Bold);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void StyleLabel(Label l, string text, Point loc)
|
|
||||||
{
|
|
||||||
l.Text = text;
|
|
||||||
l.Location = loc;
|
|
||||||
l.AutoSize = true;
|
|
||||||
l.ForeColor = Color.FromArgb(200, 210, 230);
|
|
||||||
l.Font = new Font("Segoe UI", 8.5F);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void StyleActionBtn(Button b, string text, Point loc, Size sz)
|
|
||||||
{
|
|
||||||
b.Text = text;
|
|
||||||
b.Location = loc;
|
|
||||||
b.Size = sz;
|
|
||||||
b.BackColor = Color.FromArgb(46, 125, 225);
|
|
||||||
b.ForeColor = Color.White;
|
|
||||||
b.FlatStyle = FlatStyle.Flat;
|
|
||||||
b.FlatAppearance.BorderSize = 0;
|
|
||||||
b.Font = new Font("Segoe UI", 8.5F, FontStyle.Bold);
|
|
||||||
b.Cursor = Cursors.Hand;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,9 @@
|
||||||
using System;
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
|
using System.Drawing.Drawing2D;
|
||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
|
using System.IO;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
|
|
@ -10,9 +13,32 @@ namespace MathApp.Controls
|
||||||
{
|
{
|
||||||
public partial class CombinatoricsControl : UserControl
|
public partial class CombinatoricsControl : UserControl
|
||||||
{
|
{
|
||||||
|
// Vector Preview State
|
||||||
|
private float _lastVecX = 4f;
|
||||||
|
private float _lastVecY = 3f;
|
||||||
|
private float _lastVecR = 5f;
|
||||||
|
private float _lastVecThetaDeg = 36.87f;
|
||||||
|
private bool _hasVector = false;
|
||||||
|
|
||||||
|
// Pagination for Strings Generator
|
||||||
|
private List<string> _generatedStrings = new List<string>();
|
||||||
|
private int _currentPage = 1;
|
||||||
|
private const int PageSize = 1000;
|
||||||
|
|
||||||
|
// Current JSON export object
|
||||||
|
private readonly Dictionary<string, object> _currentReportData = new Dictionary<string, object>();
|
||||||
|
|
||||||
public CombinatoricsControl()
|
public CombinatoricsControl()
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
|
ThemeHelper.StyleModernTabControl(tabOutput);
|
||||||
|
|
||||||
|
// Double buffering on vector canvas
|
||||||
|
typeof(Panel).InvokeMember("DoubleBuffered",
|
||||||
|
System.Reflection.BindingFlags.SetProperty | System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic,
|
||||||
|
null, pnlVectorCanvas, new object[] { true });
|
||||||
|
|
||||||
|
pnlVectorCanvas.Paint += PnlVectorCanvas_Paint;
|
||||||
|
|
||||||
btnCalcComb.Click += BtnCalcComb_Click;
|
btnCalcComb.Click += BtnCalcComb_Click;
|
||||||
btnPascal.Click += BtnPascal_Click;
|
btnPascal.Click += BtnPascal_Click;
|
||||||
|
|
@ -20,21 +46,25 @@ namespace MathApp.Controls
|
||||||
btnPolarConvert.Click += BtnPolarConvert_Click;
|
btnPolarConvert.Click += BtnPolarConvert_Click;
|
||||||
btnSpecialCalc.Click += BtnSpecialCalc_Click;
|
btnSpecialCalc.Click += BtnSpecialCalc_Click;
|
||||||
|
|
||||||
btnCopyOutput.Click += (s, e) => {
|
btnCopyOutput.Click += BtnCopyOutput_Click;
|
||||||
if (!string.IsNullOrEmpty(txtOutput.Text))
|
btnExportJson.Click += BtnExportJson_Click;
|
||||||
{
|
btnClearOutput.Click += BtnClearOutput_Click;
|
||||||
Clipboard.SetText(txtOutput.Text);
|
|
||||||
MessageBox.Show("Sonuç raporu panoya kopyalandı!", "Bilgi", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
btnPrevPage.Click += (s, e) => { if (_currentPage > 1) { _currentPage--; RenderStringsPage(); } };
|
||||||
}
|
btnNextPage.Click += (s, e) => { if (_currentPage * PageSize < _generatedStrings.Count) { _currentPage++; RenderStringsPage(); } };
|
||||||
};
|
|
||||||
|
|
||||||
txtCoordX.KeyDown += (s, e) => { if (e.KeyCode == Keys.Enter) { e.SuppressKeyPress = true; BtnPolarConvert_Click(this, EventArgs.Empty); } };
|
txtCoordX.KeyDown += (s, e) => { if (e.KeyCode == Keys.Enter) { e.SuppressKeyPress = true; BtnPolarConvert_Click(this, EventArgs.Empty); } };
|
||||||
txtCoordY.KeyDown += (s, e) => { if (e.KeyCode == Keys.Enter) { e.SuppressKeyPress = true; BtnPolarConvert_Click(this, EventArgs.Empty); } };
|
txtCoordY.KeyDown += (s, e) => { if (e.KeyCode == Keys.Enter) { e.SuppressKeyPress = true; BtnPolarConvert_Click(this, EventArgs.Empty); } };
|
||||||
txtSpecialX.KeyDown += (s, e) => { if (e.KeyCode == Keys.Enter) { e.SuppressKeyPress = true; BtnSpecialCalc_Click(this, EventArgs.Empty); } };
|
txtSpecialX.KeyDown += (s, e) => { if (e.KeyCode == Keys.Enter) { e.SuppressKeyPress = true; BtnSpecialCalc_Click(this, EventArgs.Empty); } };
|
||||||
txtBase.KeyDown += (s, e) => { if (e.KeyCode == Keys.Enter) { e.SuppressKeyPress = true; BtnSpecialCalc_Click(this, EventArgs.Empty); } };
|
txtBase.KeyDown += (s, e) => { if (e.KeyCode == Keys.Enter) { e.SuppressKeyPress = true; BtnSpecialCalc_Click(this, EventArgs.Empty); } };
|
||||||
txtAlphabet.KeyDown += (s, e) => { if (e.KeyCode == Keys.Enter) { e.SuppressKeyPress = true; BtnGenStrings_Click(this, EventArgs.Empty); } };
|
txtAlphabet.KeyDown += (s, e) => { if (e.KeyCode == Keys.Enter) { e.SuppressKeyPress = true; BtnGenStrings_Click(this, EventArgs.Empty); } };
|
||||||
|
|
||||||
|
// Default run polar vector
|
||||||
|
BtnPolarConvert_Click(this, EventArgs.Empty);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#region 1. Combinatorics & Permutations
|
||||||
|
|
||||||
private void BtnCalcComb_Click(object sender, EventArgs e)
|
private void BtnCalcComb_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
|
|
@ -44,40 +74,61 @@ namespace MathApp.Controls
|
||||||
|
|
||||||
if (r > n)
|
if (r > n)
|
||||||
{
|
{
|
||||||
txtOutput.Text = "Hata: r (k) değeri n değerinden büyük olamaz!";
|
MessageBox.Show("r (seçim sayısı) değeri n (eleman sayısı) değerinden büyük olamaz!", "Hatalı Giriş", MessageBoxButtons.OK, MessageBoxIcon.Warning);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
string factNStr = n <= 27 ? NumericalMethods.Factorial(n).ToString("N0") : $"{n}! (decimal sınırını aşıyor: > 7.9×10²⁸)";
|
string factNStr = n <= 27 ? NumericalMethods.Factorial(n).ToString("N0") : $"{n}! (> 7.9×10²⁸)";
|
||||||
string factRStr = r <= 27 ? NumericalMethods.Factorial(r).ToString("N0") : $"{r}! (decimal sınırını aşıyor: > 7.9×10²⁸)";
|
string factRStr = r <= 27 ? NumericalMethods.Factorial(r).ToString("N0") : $"{r}! (> 7.9×10²⁸)";
|
||||||
|
string factNRStr = (n - r) <= 27 ? NumericalMethods.Factorial(n - r).ToString("N0") : $"{n - r}! (> 7.9×10²⁸)";
|
||||||
|
|
||||||
decimal perm = NumericalMethods.Permutation(n, r);
|
decimal perm = NumericalMethods.Permutation(n, r);
|
||||||
decimal comb = NumericalMethods.Combination(n, r);
|
decimal comb = NumericalMethods.Combination(n, r);
|
||||||
|
|
||||||
StringBuilder sb = new StringBuilder();
|
lblKpiTitle.Text = $"KOMBİNASYON C({n}, {r}) & PERMÜTASYON P({n}, {r})";
|
||||||
sb.AppendLine("=== KOMBINATORIK & PERMUTASYON HESABI ===");
|
lblKpiValue.Text = $"C({n}, {r}) = {comb:N0}";
|
||||||
sb.AppendLine($"n = {n}, r (k) = {r}");
|
lblKpiSubtitle.Text = $"Sıralı Dizilim Sayısı P({n}, {r}) = {perm:N0} • Faktöriyel: {n}! = {factNStr}";
|
||||||
sb.AppendLine();
|
|
||||||
sb.AppendLine($"1. Faktöriyel n! :");
|
|
||||||
sb.AppendLine($" {factNStr}");
|
|
||||||
sb.AppendLine();
|
|
||||||
sb.AppendLine($"2. Faktöriyel r! :");
|
|
||||||
sb.AppendLine($" {factRStr}");
|
|
||||||
sb.AppendLine();
|
|
||||||
sb.AppendLine($"3. Permütasyon P(n, r) = n! / (n - r)! :");
|
|
||||||
sb.AppendLine($" P({n}, {r}) = {perm:N0}");
|
|
||||||
sb.AppendLine();
|
|
||||||
sb.AppendLine($"4. Kombinasyon C(n, r) = n! / [r! * (n - r)!] :");
|
|
||||||
sb.AppendLine($" C({n}, {r}) = {comb:N0}");
|
|
||||||
sb.AppendLine();
|
|
||||||
sb.AppendLine($"Olasılık Bilgisi:");
|
|
||||||
sb.AppendLine($" {n} elemanlı bir kümeden {r} eleman {comb:N0} farklı şekilde seçilebilir.");
|
|
||||||
sb.AppendLine($" Sıralı seçim (dizilim) sayısı ise {perm:N0}'dir.");
|
|
||||||
|
|
||||||
txtOutput.Text = sb.ToString();
|
StringBuilder sb = new StringBuilder();
|
||||||
|
sb.AppendLine("=======================================================================");
|
||||||
|
sb.AppendLine(" AYRIK MATEMATİK & OLASILIK HESAPLAMA ADIMLARI");
|
||||||
|
sb.AppendLine("=======================================================================");
|
||||||
|
sb.AppendLine($" Girdi Parametreleri : n = {n} (Küme boyutu), r = {r} (Seçilen eleman)");
|
||||||
|
sb.AppendLine();
|
||||||
|
sb.AppendLine(" 1. FAKTÖRİYEL ADIMLARI:");
|
||||||
|
sb.AppendLine($" • n! = {n}! = {factNStr}");
|
||||||
|
sb.AppendLine($" • r! = {r}! = {factRStr}");
|
||||||
|
sb.AppendLine($" • (n-r)! = ({n}-{r})! = {factNRStr}");
|
||||||
|
sb.AppendLine();
|
||||||
|
sb.AppendLine(" 2. PERMÜTASYON (Sıralı Seçim - Order Matters):");
|
||||||
|
sb.AppendLine(" Formül: P(n, r) = n! / (n - r)!");
|
||||||
|
sb.AppendLine($" Hesap : P({n}, {r}) = {factNStr} / {factNRStr}");
|
||||||
|
sb.AppendLine($" Sonuç : P({n}, {r}) = {perm:N0}");
|
||||||
|
sb.AppendLine();
|
||||||
|
sb.AppendLine(" 3. KOMBİNASYON (Sırasız Seçim / Alt Küme - Order Doesn't Matter):");
|
||||||
|
sb.AppendLine(" Formül: C(n, r) = n! / [ r! · (n - r)! ]");
|
||||||
|
sb.AppendLine($" Hesap : C({n}, {r}) = {factNStr} / [ {factRStr} · {factNRStr} ]");
|
||||||
|
sb.AppendLine($" Sonuç : C({n}, {r}) = {comb:N0}");
|
||||||
|
sb.AppendLine();
|
||||||
|
sb.AppendLine(" 4. BİNOM TEOREMİ & OLASILIK YORUMU:");
|
||||||
|
sb.AppendLine($" • {n} elemanlı bir kümeden {r} elemanlık {comb:N0} farklı alt küme oluşturulabilir.");
|
||||||
|
sb.AppendLine($" • (a + b)^{n} binom açılımında a^{n - r} · b^{r} teriminin katsayısı {comb:N0}'dir.");
|
||||||
|
sb.AppendLine($" • Rastgele seçilen r elemanın belirli bir sırada dizilme olasılığı: 1 / {perm:N0}");
|
||||||
|
|
||||||
|
txtSummaryDetails.Text = sb.ToString();
|
||||||
|
tabOutput.SelectedTab = tabSummary;
|
||||||
|
|
||||||
|
// Update report data
|
||||||
|
_currentReportData["type"] = "Combinatorics";
|
||||||
|
_currentReportData["n"] = n;
|
||||||
|
_currentReportData["r"] = r;
|
||||||
|
_currentReportData["combination"] = comb.ToString(CultureInfo.InvariantCulture);
|
||||||
|
_currentReportData["permutation"] = perm.ToString(CultureInfo.InvariantCulture);
|
||||||
|
_currentReportData["factorial_n"] = factNStr;
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
txtOutput.Text = "Hesaplama Hatası: " + ex.Message;
|
MessageBox.Show("Hesaplama hatası: " + ex.Message, "Hata", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -87,31 +138,48 @@ namespace MathApp.Controls
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
int n = (int)numN.Value;
|
int n = (int)numN.Value;
|
||||||
|
int maxRow = Math.Min(n, 30);
|
||||||
|
|
||||||
string result = await Task.Run(() =>
|
string result = await Task.Run(() =>
|
||||||
{
|
{
|
||||||
StringBuilder sb = new StringBuilder();
|
StringBuilder sb = new StringBuilder();
|
||||||
sb.AppendLine($"=== PASCAL UCGENI & BINOM KATSAYILARI (Derece n = {n}) ===");
|
sb.AppendLine($"=======================================================================");
|
||||||
sb.AppendLine($"(a + b)^{n} açılımının katsayıları:");
|
sb.AppendLine($" PASCAL ÜÇGENİ & BİNOM KATSAYILARI (Derece n = {n})");
|
||||||
|
sb.AppendLine($" (a + b)^n = ∑ [ C(n, k) · a^(n-k) · b^k ]");
|
||||||
|
sb.AppendLine($"=======================================================================");
|
||||||
sb.AppendLine();
|
sb.AppendLine();
|
||||||
|
|
||||||
for (int row = 0; row <= Math.Min(n, 25); row++)
|
for (int row = 0; row <= maxRow; row++)
|
||||||
{
|
{
|
||||||
sb.Append($"n = {row,2} | ");
|
sb.Append($" n = {row,2} │ ");
|
||||||
|
List<string> rowVals = new List<string>();
|
||||||
for (int k = 0; k <= row; k++)
|
for (int k = 0; k <= row; k++)
|
||||||
{
|
{
|
||||||
decimal c = NumericalMethods.Combination(row, k);
|
decimal c = NumericalMethods.Combination(row, k);
|
||||||
sb.Append(c.ToString("N0") + (k < row ? ", " : ""));
|
rowVals.Add(c.ToString("N0"));
|
||||||
}
|
}
|
||||||
|
sb.AppendLine(string.Join(" ", rowVals));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (n > 30)
|
||||||
|
{
|
||||||
sb.AppendLine();
|
sb.AppendLine();
|
||||||
|
sb.AppendLine($" (Not: Tablo taşmasını önlemek amacıyla ilk 30 satır gösterilmektedir.)");
|
||||||
}
|
}
|
||||||
|
|
||||||
return sb.ToString();
|
return sb.ToString();
|
||||||
});
|
});
|
||||||
|
|
||||||
txtOutput.Text = result;
|
txtPascalView.Text = result;
|
||||||
|
tabOutput.SelectedTab = tabPascal;
|
||||||
|
|
||||||
|
lblKpiTitle.Text = $"PASCAL ÜÇGENİ";
|
||||||
|
lblKpiValue.Text = $"(a + b)^{n} Açılımı";
|
||||||
|
lblKpiSubtitle.Text = $"Toplam {n + 1} terim katsayısı Pascal sekmesinde gösterilmektedir.";
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
txtOutput.Text = "Hata: " + ex.Message;
|
MessageBox.Show("Pascal üçgeni hatası: " + ex.Message, "Hata", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
|
|
@ -119,9 +187,11 @@ namespace MathApp.Controls
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region 2. String Generator with Asynchronous Chunking & Pagination
|
||||||
|
|
||||||
private async void BtnGenStrings_Click(object sender, EventArgs e)
|
private async void BtnGenStrings_Click(object sender, EventArgs e)
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
{
|
||||||
string alphabet = txtAlphabet.Text;
|
string alphabet = txtAlphabet.Text;
|
||||||
string prefix = txtPrefix.Text;
|
string prefix = txtPrefix.Text;
|
||||||
|
|
@ -129,54 +199,114 @@ namespace MathApp.Controls
|
||||||
|
|
||||||
if (string.IsNullOrEmpty(alphabet))
|
if (string.IsNullOrEmpty(alphabet))
|
||||||
{
|
{
|
||||||
txtOutput.Text = "Lütfen karakter kümesini (alfabe) giriniz.";
|
MessageBox.Show("Lütfen karakter kümesini (alfabe) giriniz.", "Uyarı", MessageBoxButtons.OK, MessageBoxIcon.Warning);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
long totalCount = (long)Math.Pow(alphabet.Length, length);
|
long totalCount = (long)Math.Pow(alphabet.Length, length);
|
||||||
if (totalCount > 20000)
|
if (totalCount > 500000)
|
||||||
{
|
{
|
||||||
DialogResult dr = MessageBox.Show(
|
DialogResult dr = MessageBox.Show(
|
||||||
$"Üretilecek toplam kombinasyon sayısı {totalCount:N0}. " +
|
$"Üretilecek toplam kombinasyon sayısı {totalCount:N0}.\n" +
|
||||||
"Bu işlem arayüzü yavaşlatabilir. Devam etmek istiyor musunuz?",
|
"Bu işlem yüksek bellek tüketebilir. Devam etmek istiyor musunuz?",
|
||||||
"Büyük Kombinasyon Uyarısı",
|
"Büyük Veri Güvenlik Uyarısı",
|
||||||
MessageBoxButtons.YesNo,
|
MessageBoxButtons.YesNo,
|
||||||
MessageBoxIcon.Warning);
|
MessageBoxIcon.Warning);
|
||||||
|
|
||||||
if (dr != DialogResult.Yes) return;
|
if (dr != DialogResult.Yes) return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Cursor = Cursors.WaitCursor;
|
|
||||||
btnGenStrings.Enabled = false;
|
btnGenStrings.Enabled = false;
|
||||||
|
pbStrings.Visible = true;
|
||||||
|
pbStrings.Style = ProgressBarStyle.Marquee;
|
||||||
|
Cursor = Cursors.WaitCursor;
|
||||||
|
|
||||||
string result = await Task.Run(() =>
|
try
|
||||||
{
|
{
|
||||||
string generated = NumericalMethods.GenerateCombinations(alphabet, prefix, length);
|
_generatedStrings = await Task.Run(() =>
|
||||||
|
{
|
||||||
StringBuilder sb = new StringBuilder();
|
List<string> list = new List<string>((int)Math.Min(totalCount, 500000));
|
||||||
sb.AppendLine("=== KARAKTER KOMBINASYON URETECI ===");
|
void Recurse(string cur, int rem)
|
||||||
sb.AppendLine($"Alfabe : '{alphabet}' (Uzunluk: {alphabet.Length})");
|
{
|
||||||
sb.AppendLine($"Önek (Prefix) : '{prefix}'");
|
if (rem == 0)
|
||||||
sb.AppendLine($"Dizilim Boyutu: {length}");
|
{
|
||||||
sb.AppendLine($"Toplam Sonuç : {totalCount:N0} adet");
|
list.Add(cur);
|
||||||
sb.AppendLine(new string('-', 45));
|
return;
|
||||||
sb.Append(generated);
|
}
|
||||||
return sb.ToString();
|
for (int i = 0; i < alphabet.Length; i++)
|
||||||
|
{
|
||||||
|
Recurse(cur + alphabet[i], rem - 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Recurse(prefix, length);
|
||||||
|
return list;
|
||||||
});
|
});
|
||||||
|
|
||||||
txtOutput.Text = result;
|
_currentPage = 1;
|
||||||
|
RenderStringsPage();
|
||||||
|
tabOutput.SelectedTab = tabStrings;
|
||||||
|
|
||||||
|
lblKpiTitle.Text = "DİZİLİM ÜRETECİ SONUCU";
|
||||||
|
lblKpiValue.Text = $"{_generatedStrings.Count:N0} Kombinasyon";
|
||||||
|
lblKpiSubtitle.Text = $"Alfabe: '{alphabet}' • Uzunluk: {length} • Önek: '{prefix}'";
|
||||||
|
|
||||||
|
_currentReportData["type"] = "StringCombinations";
|
||||||
|
_currentReportData["alphabet"] = alphabet;
|
||||||
|
_currentReportData["length"] = length;
|
||||||
|
_currentReportData["total_count"] = _generatedStrings.Count;
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
txtOutput.Text = "Kombinasyon Üretim Hatası: " + ex.Message;
|
MessageBox.Show("Dizilim üretim hatası: " + ex.Message, "Hata", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
|
pbStrings.Visible = false;
|
||||||
btnGenStrings.Enabled = true;
|
btnGenStrings.Enabled = true;
|
||||||
Cursor = Cursors.Default;
|
Cursor = Cursors.Default;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void RenderStringsPage()
|
||||||
|
{
|
||||||
|
if (_generatedStrings.Count == 0)
|
||||||
|
{
|
||||||
|
txtStringsView.Text = "Henüz dizilim üretilmedi.";
|
||||||
|
lblPageInfo.Text = "Sayfa: 0 / 0 (Toplam 0)";
|
||||||
|
btnPrevPage.Enabled = false;
|
||||||
|
btnNextPage.Enabled = false;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
int totalPages = (int)Math.Ceiling(_generatedStrings.Count / (double)PageSize);
|
||||||
|
_currentPage = Math.Max(1, Math.Min(_currentPage, totalPages));
|
||||||
|
|
||||||
|
int startIdx = (_currentPage - 1) * PageSize;
|
||||||
|
int count = Math.Min(PageSize, _generatedStrings.Count - startIdx);
|
||||||
|
|
||||||
|
StringBuilder sb = new StringBuilder();
|
||||||
|
sb.AppendLine($"=== DİZİLİM SAYFASI: {_currentPage} / {totalPages} (Gösterilen: {startIdx + 1} - {startIdx + count} / Toplam {_generatedStrings.Count:N0}) ===");
|
||||||
|
sb.AppendLine();
|
||||||
|
|
||||||
|
int col = 0;
|
||||||
|
for (int i = 0; i < count; i++)
|
||||||
|
{
|
||||||
|
sb.Append($"{_generatedStrings[startIdx + i],-16}");
|
||||||
|
col++;
|
||||||
|
if (col % 5 == 0) sb.AppendLine();
|
||||||
|
}
|
||||||
|
if (col % 5 != 0) sb.AppendLine();
|
||||||
|
|
||||||
|
txtStringsView.Text = sb.ToString();
|
||||||
|
lblPageInfo.Text = $"Sayfa: {_currentPage} / {totalPages} (Toplam {_generatedStrings.Count:N0})";
|
||||||
|
btnPrevPage.Enabled = _currentPage > 1;
|
||||||
|
btnNextPage.Enabled = _currentPage < totalPages;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region 3. Polar & Vector Coordinates & Mini Canvas
|
||||||
|
|
||||||
private void BtnPolarConvert_Click(object sender, EventArgs e)
|
private void BtnPolarConvert_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
|
|
@ -184,45 +314,150 @@ namespace MathApp.Controls
|
||||||
if (!decimal.TryParse(txtCoordX.Text.Replace(',', '.'), NumberStyles.Any, CultureInfo.InvariantCulture, out decimal x) ||
|
if (!decimal.TryParse(txtCoordX.Text.Replace(',', '.'), NumberStyles.Any, CultureInfo.InvariantCulture, out decimal x) ||
|
||||||
!decimal.TryParse(txtCoordY.Text.Replace(',', '.'), NumberStyles.Any, CultureInfo.InvariantCulture, out decimal y))
|
!decimal.TryParse(txtCoordY.Text.Replace(',', '.'), NumberStyles.Any, CultureInfo.InvariantCulture, out decimal y))
|
||||||
{
|
{
|
||||||
txtOutput.Text = "Lütfen geçerli X ve Y sayısal koordinatları giriniz.";
|
MessageBox.Show("Lütfen geçerli sayısal X ve Y koordinatları giriniz.", "Uyarı", MessageBoxButtons.OK, MessageBoxIcon.Warning);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Maths.Hypot and DecimalMath.Atan2
|
|
||||||
decimal rHypot = Maths.Hypot(x, y);
|
decimal rHypot = Maths.Hypot(x, y);
|
||||||
decimal r = DecimalMath.Sqrt(x * x + y * y);
|
decimal r = DecimalMath.Sqrt(x * x + y * y);
|
||||||
decimal thetaRad = DecimalMath.Atan2(y, x);
|
decimal thetaRad = DecimalMath.Atan2(y, x);
|
||||||
decimal thetaDeg = thetaRad * (180m / DecimalMath.PI);
|
decimal thetaDeg = thetaRad * (180m / DecimalMath.PI);
|
||||||
|
|
||||||
StringBuilder sb = new StringBuilder();
|
_lastVecX = (float)x;
|
||||||
sb.AppendLine("=== 2B VEKTOR & KUTUPSAL (POLAR) KOORDINAT HESABI ===");
|
_lastVecY = (float)y;
|
||||||
sb.AppendLine($"Kartezyen Koordinatlar : X = {x}, Y = {y}");
|
_lastVecR = (float)r;
|
||||||
sb.AppendLine();
|
_lastVecThetaDeg = (float)thetaDeg;
|
||||||
sb.AppendLine($"1. Hipotenüs / Yarıçap (r) = sqrt(X² + Y²):");
|
_hasVector = true;
|
||||||
sb.AppendLine($" r (DecimalMath) = {r:G18}");
|
pnlVectorCanvas.Invalidate();
|
||||||
sb.AppendLine($" r (Maths.Hypot) = {rHypot:G18}");
|
|
||||||
sb.AppendLine();
|
|
||||||
sb.AppendLine($"2. Açı θ = Atan2(Y, X):");
|
|
||||||
sb.AppendLine($" θ (Radyan) = {thetaRad:G18} rad");
|
|
||||||
sb.AppendLine($" θ (Derece) = {thetaDeg:G18}°");
|
|
||||||
sb.AppendLine();
|
|
||||||
sb.AppendLine($"Kutupsal Gösterim : (r = {r:G8}, θ = {thetaDeg:F4}°)");
|
|
||||||
|
|
||||||
txtOutput.Text = sb.ToString();
|
lblKpiTitle.Text = "KUTUPSAL (POLAR) KOORDİNAT DÖNÜŞÜMÜ";
|
||||||
|
lblKpiValue.Text = $"r = {r:F4}, θ = {thetaDeg:F2}°";
|
||||||
|
lblKpiSubtitle.Text = $"Kartezyen: (X = {x}, Y = {y}) • Açı: {thetaRad:F6} radyan";
|
||||||
|
|
||||||
|
StringBuilder sb = new StringBuilder();
|
||||||
|
sb.AppendLine("=======================================================================");
|
||||||
|
sb.AppendLine(" 2B VEKTÖR & KUTUPSAL (POLAR) KOORDİNAT ANALİZİ");
|
||||||
|
sb.AppendLine("=======================================================================");
|
||||||
|
sb.AppendLine($" Kartezyen Giriş : X = {x:G}, Y = {y:G}");
|
||||||
|
sb.AppendLine();
|
||||||
|
sb.AppendLine(" 1. YARIÇAP / BÜYÜKLÜK (Norm - r):");
|
||||||
|
sb.AppendLine(" Formül: r = √(X² + Y²)");
|
||||||
|
sb.AppendLine($" Hesap : r = √({x}² + {y}²) = {r:G18}");
|
||||||
|
sb.AppendLine($" Hypot : Maths.Hypot(X, Y) = {rHypot:G18}");
|
||||||
|
sb.AppendLine();
|
||||||
|
sb.AppendLine(" 2. KUTUPSAL AÇI (Argüman - θ):");
|
||||||
|
sb.AppendLine(" Formül: θ = atan2(Y, X)");
|
||||||
|
sb.AppendLine($" Radyan: θ = {thetaRad:G18} rad");
|
||||||
|
sb.AppendLine($" Derece: θ = {thetaDeg:G18}°");
|
||||||
|
sb.AppendLine();
|
||||||
|
sb.AppendLine(" 3. VEKTÖREL VE TRİGONOMETRİK BİLEŞENLER:");
|
||||||
|
sb.AppendLine($" • Birim Vektör u : ({((r > 0) ? (x / r) : 0):F4}, {((r > 0) ? (y / r) : 0):F4})");
|
||||||
|
sb.AppendLine($" • Kompleks Form : z = {x} + {y}i = {r:F4} · e^(i·{thetaRad:F4})");
|
||||||
|
sb.AppendLine($" • Euler Formu : {r:F4} · (cos({thetaDeg:F2}°) + i·sin({thetaDeg:F2}°))");
|
||||||
|
|
||||||
|
txtSummaryDetails.Text = sb.ToString();
|
||||||
|
tabOutput.SelectedTab = tabSummary;
|
||||||
|
|
||||||
|
_currentReportData["type"] = "PolarCoordinates";
|
||||||
|
_currentReportData["x"] = x.ToString(CultureInfo.InvariantCulture);
|
||||||
|
_currentReportData["y"] = y.ToString(CultureInfo.InvariantCulture);
|
||||||
|
_currentReportData["r"] = r.ToString(CultureInfo.InvariantCulture);
|
||||||
|
_currentReportData["theta_rad"] = thetaRad.ToString(CultureInfo.InvariantCulture);
|
||||||
|
_currentReportData["theta_deg"] = thetaDeg.ToString(CultureInfo.InvariantCulture);
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
txtOutput.Text = "Koordinat Dönüşüm Hatası: " + ex.Message;
|
MessageBox.Show("Koordinat dönüşüm hatası: " + ex.Message, "Hata", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void PnlVectorCanvas_Paint(object sender, PaintEventArgs e)
|
||||||
|
{
|
||||||
|
Graphics g = e.Graphics;
|
||||||
|
g.SmoothingMode = SmoothingMode.AntiAlias;
|
||||||
|
|
||||||
|
int w = pnlVectorCanvas.Width;
|
||||||
|
int h = pnlVectorCanvas.Height;
|
||||||
|
|
||||||
|
// Background
|
||||||
|
using (Brush bg = new SolidBrush(Color.FromArgb(15, 23, 42)))
|
||||||
|
{
|
||||||
|
g.FillRectangle(bg, 0, 0, w, h);
|
||||||
|
}
|
||||||
|
|
||||||
|
int cx = w / 2;
|
||||||
|
int cy = h / 2;
|
||||||
|
|
||||||
|
// Draw Grid & Axes
|
||||||
|
using (Pen axisPen = new Pen(Color.FromArgb(51, 65, 85), 1.2f))
|
||||||
|
{
|
||||||
|
g.DrawLine(axisPen, 10, cy, w - 10, cy); // X axis
|
||||||
|
g.DrawLine(axisPen, cx, 10, cx, h - 10); // Y axis
|
||||||
|
}
|
||||||
|
|
||||||
|
// Draw concentric target circles
|
||||||
|
using (Pen circlePen = new Pen(Color.FromArgb(30, 41, 59), 1f) { DashStyle = DashStyle.Dash })
|
||||||
|
{
|
||||||
|
g.DrawEllipse(circlePen, cx - 35, cy - 35, 70, 70);
|
||||||
|
g.DrawEllipse(circlePen, cx - 60, cy - 60, 120, 120);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!_hasVector) return;
|
||||||
|
|
||||||
|
// Calculate scaled vector point
|
||||||
|
float maxR = Math.Max(0.001f, _lastVecR);
|
||||||
|
float scale = Math.Min(w, h) * 0.38f / maxR;
|
||||||
|
float vx = cx + _lastVecX * scale;
|
||||||
|
float vy = cy - _lastVecY * scale; // Y inverted for screen
|
||||||
|
|
||||||
|
// Draw Angle Arc
|
||||||
|
if (_lastVecR > 0.01f)
|
||||||
|
{
|
||||||
|
float arcRad = 26f;
|
||||||
|
float startAngle = 0f;
|
||||||
|
float sweepAngle = -_lastVecThetaDeg; // Screen coordinate angles clockwise
|
||||||
|
using (Pen arcPen = new Pen(Color.FromArgb(56, 189, 248), 1.5f))
|
||||||
|
{
|
||||||
|
g.DrawArc(arcPen, cx - arcRad, cy - arcRad, arcRad * 2, arcRad * 2, startAngle, sweepAngle);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Draw Vector Arrow
|
||||||
|
using (Pen vecPen = new Pen(Color.FromArgb(52, 211, 153), 2.5f))
|
||||||
|
{
|
||||||
|
vecPen.CustomEndCap = new AdjustableArrowCap(5, 6);
|
||||||
|
g.DrawLine(vecPen, cx, cy, vx, vy);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Vector terminal dot
|
||||||
|
using (Brush dotBrush = new SolidBrush(Color.FromArgb(250, 204, 21)))
|
||||||
|
{
|
||||||
|
g.FillEllipse(dotBrush, vx - 4, vy - 4, 8, 8);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Coordinate labels
|
||||||
|
using (Font f = new Font("Segoe UI Semibold", 8F, FontStyle.Bold))
|
||||||
|
using (Brush textBr = new SolidBrush(Color.White))
|
||||||
|
using (Brush cyanBr = new SolidBrush(Color.FromArgb(56, 189, 248)))
|
||||||
|
using (Brush greenBr = new SolidBrush(Color.FromArgb(52, 211, 153)))
|
||||||
|
{
|
||||||
|
g.DrawString($"P({_lastVecX:F1}, {_lastVecY:F1})", f, textBr, vx + 6, vy - 14);
|
||||||
|
g.DrawString($"r = {_lastVecR:F2}", f, greenBr, 8, 8);
|
||||||
|
g.DrawString($"θ = {_lastVecThetaDeg:F1}°", f, cyanBr, 8, 24);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region 4. Special & Hyperbolic Functions
|
||||||
|
|
||||||
private void BtnSpecialCalc_Click(object sender, EventArgs e)
|
private void BtnSpecialCalc_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if (!decimal.TryParse(txtSpecialX.Text.Replace(',', '.'), NumberStyles.Any, CultureInfo.InvariantCulture, out decimal x))
|
if (!decimal.TryParse(txtSpecialX.Text.Replace(',', '.'), NumberStyles.Any, CultureInfo.InvariantCulture, out decimal x))
|
||||||
{
|
{
|
||||||
txtOutput.Text = "Lütfen x için geçerli bir sayı giriniz.";
|
MessageBox.Show("Lütfen x için geçerli bir sayı giriniz.", "Uyarı", MessageBoxButtons.OK, MessageBoxIcon.Warning);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -232,59 +467,145 @@ namespace MathApp.Controls
|
||||||
decimal.TryParse(txtBase.Text.Replace(',', '.'), NumberStyles.Any, CultureInfo.InvariantCulture, out baseN);
|
decimal.TryParse(txtBase.Text.Replace(',', '.'), NumberStyles.Any, CultureInfo.InvariantCulture, out baseN);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
lblKpiTitle.Text = $"ÖZEL FONKSİYON ANALİZİ (x = {x})";
|
||||||
|
lblKpiValue.Text = $"sinh(x) = {DecimalMath.Sinh(x):F4}, cosh(x) = {DecimalMath.Cosh(x):F4}";
|
||||||
|
lblKpiSubtitle.Text = $"tanh(x) = {DecimalMath.Tanh(x):F4} • exp(x) = {DecimalMath.Exp(x):F4} • log_{baseN}(x)";
|
||||||
|
|
||||||
StringBuilder sb = new StringBuilder();
|
StringBuilder sb = new StringBuilder();
|
||||||
sb.AppendLine($"=== OZEL FONKSIYON HESAPLAMALARI (x = {x}) ===");
|
sb.AppendLine("=======================================================================");
|
||||||
|
sb.AppendLine($" İLERİ ANALİTİK & ÖZEL FONKSİYON TABLOSU (x = {x})");
|
||||||
|
sb.AppendLine("=======================================================================");
|
||||||
sb.AppendLine();
|
sb.AppendLine();
|
||||||
|
|
||||||
// Hiperbolik Fonksiyonlar
|
// Hiperbolik
|
||||||
sb.AppendLine("-- Hiperbolik Fonksiyonlar --");
|
sb.AppendLine(" 1. HİPERBOLİK FONKSİYONLAR:");
|
||||||
try { sb.AppendLine($" sinh(x) = {DecimalMath.Sinh(x):G16}"); } catch (Exception ex) { sb.AppendLine($" sinh(x): {ex.Message}"); }
|
try { sb.AppendLine($" • sinh(x) = (e^x - e^(-x)) / 2 = {DecimalMath.Sinh(x):G18}"); } catch (Exception ex) { sb.AppendLine($" • sinh(x): {ex.Message}"); }
|
||||||
try { sb.AppendLine($" cosh(x) = {DecimalMath.Cosh(x):G16}"); } catch (Exception ex) { sb.AppendLine($" cosh(x): {ex.Message}"); }
|
try { sb.AppendLine($" • cosh(x) = (e^x + e^(-x)) / 2 = {DecimalMath.Cosh(x):G18}"); } catch (Exception ex) { sb.AppendLine($" • cosh(x): {ex.Message}"); }
|
||||||
try { sb.AppendLine($" tanh(x) = {DecimalMath.Tanh(x):G16}"); } catch (Exception ex) { sb.AppendLine($" tanh(x): {ex.Message}"); }
|
try { sb.AppendLine($" • tanh(x) = sinh(x) / cosh(x) = {DecimalMath.Tanh(x):G18}"); } catch (Exception ex) { sb.AppendLine($" • tanh(x): {ex.Message}"); }
|
||||||
sb.AppendLine();
|
sb.AppendLine();
|
||||||
|
|
||||||
// Ters Trigonometrik
|
// Ters Trigonometrik
|
||||||
sb.AppendLine("-- Ters Trigonometrik Fonksiyonlar --");
|
sb.AppendLine(" 2. TERS TRİGONOMETRİK FONKSİYONLAR (Arc-functions):");
|
||||||
if (Math.Abs(x) <= 1m)
|
if (Math.Abs(x) <= 1m)
|
||||||
{
|
{
|
||||||
try { sb.AppendLine($" asin(x) = {DecimalMath.Asin(x):G16} rad ({(DecimalMath.Asin(x) * 180m / DecimalMath.PI):F4}°)"); } catch { }
|
try { decimal a = DecimalMath.Asin(x); sb.AppendLine($" • asin(x) = {a:G16} rad ({(a * 180m / DecimalMath.PI):F4}°)"); } catch { }
|
||||||
try { sb.AppendLine($" acos(x) = {DecimalMath.Acos(x):G16} rad ({(DecimalMath.Acos(x) * 180m / DecimalMath.PI):F4}°)"); } catch { }
|
try { decimal a = DecimalMath.Acos(x); sb.AppendLine($" • acos(x) = {a:G16} rad ({(a * 180m / DecimalMath.PI):F4}°)"); } catch { }
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
sb.AppendLine(" asin(x) & acos(x): Tanımsız (|x| <= 1 olmalıdır)");
|
sb.AppendLine(" • asin(x) & acos(x): Tanımsız (|x| ≤ 1 olmalıdır)");
|
||||||
}
|
}
|
||||||
try { sb.AppendLine($" atan(x) = {DecimalMath.Atan(x):G16} rad ({(DecimalMath.Atan(x) * 180m / DecimalMath.PI):F4}°)"); } catch { }
|
try { decimal a = DecimalMath.Atan(x); sb.AppendLine($" • atan(x) = {a:G16} rad ({(a * 180m / DecimalMath.PI):F4}°)"); } catch { }
|
||||||
sb.AppendLine();
|
sb.AppendLine();
|
||||||
|
|
||||||
// Logaritmalar & Üs
|
// Logaritmalar
|
||||||
sb.AppendLine("-- Üstel & Logaritmik --");
|
sb.AppendLine(" 3. ÜSTEL VE LOGARİTMİK FONKSİYONLAR:");
|
||||||
try { sb.AppendLine($" exp(x) = e^{x} = {DecimalMath.Exp(x):G16}"); } catch (Exception ex) { sb.AppendLine($" exp(x): {ex.Message}"); }
|
try { sb.AppendLine($" • exp(x) = e^{x} = {DecimalMath.Exp(x):G18}"); } catch (Exception ex) { sb.AppendLine($" • exp(x): {ex.Message}"); }
|
||||||
if (x > 0m)
|
if (x > 0m)
|
||||||
{
|
{
|
||||||
try { sb.AppendLine($" ln(x) = {DecimalMath.Log(x):G16}"); } catch { }
|
try { sb.AppendLine($" • ln(x) = log_e(x) = {DecimalMath.Log(x):G18}"); } catch { }
|
||||||
try { sb.AppendLine($" log10(x)= {DecimalMath.Log10(x):G16}"); } catch { }
|
try { sb.AppendLine($" • log10(x) = log_10(x)= {DecimalMath.Log10(x):G18}"); } catch { }
|
||||||
if (baseN > 0m && baseN != 1m)
|
if (baseN > 0m && baseN != 1m)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
decimal logBaseN = DecimalMath.Log(x) / DecimalMath.Log(baseN);
|
decimal logBaseN = DecimalMath.Log(x) / DecimalMath.Log(baseN);
|
||||||
sb.AppendLine($" log_{baseN}(x) = {logBaseN:G16}");
|
sb.AppendLine($" • log_{baseN}(x) = ln(x) / ln({baseN}) = {logBaseN:G18}");
|
||||||
}
|
}
|
||||||
catch { }
|
catch { }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
sb.AppendLine(" ln(x), log10(x): Tanımsız (x > 0 olmalıdır)");
|
sb.AppendLine(" • ln(x) & log(x): Tanımsız (x > 0 olmalıdır)");
|
||||||
}
|
}
|
||||||
|
|
||||||
txtOutput.Text = sb.ToString();
|
txtSummaryDetails.Text = sb.ToString();
|
||||||
|
tabOutput.SelectedTab = tabSummary;
|
||||||
|
|
||||||
|
_currentReportData["type"] = "SpecialFunctions";
|
||||||
|
_currentReportData["x"] = x.ToString(CultureInfo.InvariantCulture);
|
||||||
|
_currentReportData["sinh"] = DecimalMath.Sinh(x).ToString(CultureInfo.InvariantCulture);
|
||||||
|
_currentReportData["cosh"] = DecimalMath.Cosh(x).ToString(CultureInfo.InvariantCulture);
|
||||||
|
_currentReportData["tanh"] = DecimalMath.Tanh(x).ToString(CultureInfo.InvariantCulture);
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
txtOutput.Text = "Hata: " + ex.Message;
|
MessageBox.Show("Özel fonksiyon hesabı hatası: " + ex.Message, "Hata", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Toolbar Actions (Copy, Export JSON, Clear)
|
||||||
|
|
||||||
|
private void BtnCopyOutput_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
string textToCopy = "";
|
||||||
|
if (tabOutput.SelectedTab == tabSummary) textToCopy = txtSummaryDetails.Text;
|
||||||
|
else if (tabOutput.SelectedTab == tabPascal) textToCopy = txtPascalView.Text;
|
||||||
|
else if (tabOutput.SelectedTab == tabStrings) textToCopy = txtStringsView.Text;
|
||||||
|
|
||||||
|
if (!string.IsNullOrEmpty(textToCopy))
|
||||||
|
{
|
||||||
|
Clipboard.SetText(textToCopy);
|
||||||
|
MessageBox.Show("Rapor metni panoya kopyalandı!", "Başarılı", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void BtnExportJson_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
using (SaveFileDialog sfd = new SaveFileDialog
|
||||||
|
{
|
||||||
|
Filter = "JSON Dosyası (*.json)|*.json",
|
||||||
|
FileName = "ttCalculator_Kombinatorik_Rapor.json",
|
||||||
|
Title = "Hesaplama Sonuçlarını JSON Olarak Kaydet"
|
||||||
|
})
|
||||||
|
{
|
||||||
|
if (sfd.ShowDialog() == DialogResult.OK)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
StringBuilder json = new StringBuilder();
|
||||||
|
json.AppendLine("{");
|
||||||
|
json.AppendLine($" \"timestamp\": \"{DateTime.Now:yyyy-MM-dd HH:mm:ss}\",");
|
||||||
|
json.AppendLine($" \"app\": \"ttCalculator v3.4\",");
|
||||||
|
json.AppendLine(" \"data\": {");
|
||||||
|
int idx = 0;
|
||||||
|
foreach (var kv in _currentReportData)
|
||||||
|
{
|
||||||
|
json.Append($" \"{kv.Key}\": \"{kv.Value}\"");
|
||||||
|
idx++;
|
||||||
|
if (idx < _currentReportData.Count) json.Append(",");
|
||||||
|
json.AppendLine();
|
||||||
|
}
|
||||||
|
json.AppendLine(" }");
|
||||||
|
json.AppendLine("}");
|
||||||
|
|
||||||
|
File.WriteAllText(sfd.FileName, json.ToString(), Encoding.UTF8);
|
||||||
|
MessageBox.Show("Rapor JSON formatında başarıyla kaydedildi:\n" + sfd.FileName, "Kayıt Başarılı", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
MessageBox.Show("JSON kaydetme hatası: " + ex.Message, "Hata", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void BtnClearOutput_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
txtSummaryDetails.Clear();
|
||||||
|
txtPascalView.Clear();
|
||||||
|
txtStringsView.Clear();
|
||||||
|
lblKpiValue.Text = "—";
|
||||||
|
lblKpiTitle.Text = "SONUÇ DEĞERİ";
|
||||||
|
lblKpiSubtitle.Text = "Hesaplama yapmak için sol paneldeki modüllerden birini çalıştırın.";
|
||||||
|
_generatedStrings.Clear();
|
||||||
|
_hasVector = false;
|
||||||
|
pnlVectorCanvas.Invalidate();
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,3 @@
|
||||||
using System;
|
|
||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
|
|
||||||
|
|
@ -8,299 +7,28 @@ namespace MathApp.Controls
|
||||||
{
|
{
|
||||||
private System.ComponentModel.IContainer components = null;
|
private System.ComponentModel.IContainer components = null;
|
||||||
|
|
||||||
protected override void Dispose(bool disposing)
|
|
||||||
{
|
|
||||||
if (disposing && (components != null))
|
|
||||||
{
|
|
||||||
components.Dispose();
|
|
||||||
}
|
|
||||||
base.Dispose(disposing);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void InitializeComponent()
|
|
||||||
{
|
|
||||||
this.pnlHeader = ThemeHelper.CreateHeaderPanel(
|
|
||||||
"Nümerik Türev & Kısmi Türev Stüdyosu (Differentiation)",
|
|
||||||
"Merkezi sonlu farklar matrisi, ileri binom ve geri farklar yöntemleriyle yüksek dereceli türev, kısmi türev ve gradyan (∇f) analizi.");
|
|
||||||
|
|
||||||
this.pnlContent = new Panel();
|
|
||||||
this.pnlTopSettings = new Panel();
|
|
||||||
this.lblStepH = new Label();
|
|
||||||
this.txtStepH = new TextBox();
|
|
||||||
this.lblAcc = new Label();
|
|
||||||
this.cmbAccuracy = new ComboBox();
|
|
||||||
|
|
||||||
this.grpSingle = new GroupBox();
|
|
||||||
this.lblSingleFn = new Label();
|
|
||||||
this.txtSingleFn = new TextBox();
|
|
||||||
this.lblSingleVar = new Label();
|
|
||||||
this.txtSingleVar = new TextBox();
|
|
||||||
this.lblSinglePoint = new Label();
|
|
||||||
this.txtSinglePoint = new TextBox();
|
|
||||||
this.lblSingleDeg = new Label();
|
|
||||||
this.numSingleDegree = new NumericUpDown();
|
|
||||||
this.btnCalcSingle = ThemeHelper.CreateActionButton("∂ Tek Değişkenli Türev", 190, 34, true);
|
|
||||||
this.btnExSingle1 = ThemeHelper.CreateExampleChip("Örnek: sin(x)+x³");
|
|
||||||
this.btnExSingle2 = ThemeHelper.CreateExampleChip("Örnek: exp(2x)");
|
|
||||||
|
|
||||||
this.grpPartial = new GroupBox();
|
|
||||||
this.lblPartialFn = new Label();
|
|
||||||
this.txtPartialFn = new TextBox();
|
|
||||||
this.lblTargetVar = new Label();
|
|
||||||
this.txtTargetVar = new TextBox();
|
|
||||||
this.lblPartialDeg = new Label();
|
|
||||||
this.numPartialDegree = new NumericUpDown();
|
|
||||||
this.pnlPartialVars = new FlowLayoutPanel();
|
|
||||||
this.btnAddVar = ThemeHelper.CreateActionButton("+ Değişken", 110, 28, false);
|
|
||||||
this.btnCalcPartial = ThemeHelper.CreateActionButton("∇ Kısmi Türev & Gradyan", 210, 34, true);
|
|
||||||
this.btnExPartial1 = ThemeHelper.CreateExampleChip("Örnek: x²y + sin(y)");
|
|
||||||
this.btnExPartial2 = ThemeHelper.CreateExampleChip("Örnek: exp(x*y)");
|
|
||||||
|
|
||||||
this.lblResult = new Label();
|
|
||||||
this.txtResult = new TextBox();
|
|
||||||
|
|
||||||
((System.ComponentModel.ISupportInitialize)(this.numSingleDegree)).BeginInit();
|
|
||||||
((System.ComponentModel.ISupportInitialize)(this.numPartialDegree)).BeginInit();
|
|
||||||
this.pnlContent.SuspendLayout();
|
|
||||||
this.pnlTopSettings.SuspendLayout();
|
|
||||||
this.grpSingle.SuspendLayout();
|
|
||||||
this.grpPartial.SuspendLayout();
|
|
||||||
this.SuspendLayout();
|
|
||||||
|
|
||||||
this.pnlContent.Dock = DockStyle.Fill;
|
|
||||||
this.pnlContent.BackColor = ThemeHelper.DarkBackground;
|
|
||||||
this.pnlContent.Padding = new Padding(20, 12, 20, 20);
|
|
||||||
|
|
||||||
// Top settings bar
|
|
||||||
this.pnlTopSettings.Dock = DockStyle.Top;
|
|
||||||
this.pnlTopSettings.Height = 38;
|
|
||||||
|
|
||||||
this.lblStepH.Text = "Adım Boyutu (h):";
|
|
||||||
this.lblStepH.AutoSize = true;
|
|
||||||
this.lblStepH.ForeColor = ThemeHelper.LightText;
|
|
||||||
this.lblStepH.Font = new Font("Segoe UI", 9.5F);
|
|
||||||
this.lblStepH.Location = new Point(4, 8);
|
|
||||||
|
|
||||||
this.txtStepH.Location = new Point(115, 5);
|
|
||||||
this.txtStepH.Size = new Size(75, 25);
|
|
||||||
this.txtStepH.Text = "0.001";
|
|
||||||
this.txtStepH.Font = new Font("Consolas", 10F);
|
|
||||||
this.txtStepH.BackColor = ThemeHelper.CardBackground;
|
|
||||||
this.txtStepH.ForeColor = Color.White;
|
|
||||||
this.txtStepH.BorderStyle = BorderStyle.FixedSingle;
|
|
||||||
|
|
||||||
this.lblAcc.Text = "Matris Hassasiyet Derecesi:";
|
|
||||||
this.lblAcc.AutoSize = true;
|
|
||||||
this.lblAcc.ForeColor = ThemeHelper.LightText;
|
|
||||||
this.lblAcc.Font = new Font("Segoe UI", 9.5F);
|
|
||||||
this.lblAcc.Location = new Point(215, 8);
|
|
||||||
|
|
||||||
this.cmbAccuracy.Items.AddRange(new object[] {
|
|
||||||
"2. Derece O(h²)",
|
|
||||||
"4. Derece O(h⁴) - Önerilen",
|
|
||||||
"6. Derece O(h⁶) - Yüksek"
|
|
||||||
});
|
|
||||||
this.cmbAccuracy.Location = new Point(385, 5);
|
|
||||||
this.cmbAccuracy.Size = new Size(200, 25);
|
|
||||||
this.cmbAccuracy.DropDownStyle = ComboBoxStyle.DropDownList;
|
|
||||||
this.cmbAccuracy.BackColor = ThemeHelper.CardBackground;
|
|
||||||
this.cmbAccuracy.ForeColor = Color.White;
|
|
||||||
this.cmbAccuracy.Font = new Font("Segoe UI", 9.5F);
|
|
||||||
|
|
||||||
this.pnlTopSettings.Controls.Add(this.cmbAccuracy);
|
|
||||||
this.pnlTopSettings.Controls.Add(this.lblAcc);
|
|
||||||
this.pnlTopSettings.Controls.Add(this.txtStepH);
|
|
||||||
this.pnlTopSettings.Controls.Add(this.lblStepH);
|
|
||||||
|
|
||||||
// grpSingle
|
|
||||||
this.grpSingle.Location = new Point(20, 54);
|
|
||||||
this.grpSingle.Size = new Size(405, 225);
|
|
||||||
this.grpSingle.ForeColor = ThemeHelper.LightText;
|
|
||||||
this.grpSingle.Font = new Font("Segoe UI Semibold", 9.5F, FontStyle.Bold);
|
|
||||||
this.grpSingle.Text = "1. Tek Değişkenli Türev: dⁿf(x) / dxⁿ";
|
|
||||||
|
|
||||||
this.lblSingleFn.Text = "f(x) =";
|
|
||||||
this.lblSingleFn.AutoSize = true;
|
|
||||||
this.lblSingleFn.Location = new Point(14, 30);
|
|
||||||
this.txtSingleFn.Location = new Point(75, 27);
|
|
||||||
this.txtSingleFn.Size = new Size(310, 26);
|
|
||||||
this.txtSingleFn.Text = "sin(x) + x^3";
|
|
||||||
this.txtSingleFn.Font = new Font("Consolas", 10.5F);
|
|
||||||
this.txtSingleFn.BackColor = ThemeHelper.CardBackground;
|
|
||||||
this.txtSingleFn.ForeColor = Color.White;
|
|
||||||
this.txtSingleFn.BorderStyle = BorderStyle.FixedSingle;
|
|
||||||
|
|
||||||
this.lblSingleVar.Text = "Değişken:";
|
|
||||||
this.lblSingleVar.AutoSize = true;
|
|
||||||
this.lblSingleVar.Location = new Point(14, 68);
|
|
||||||
this.txtSingleVar.Location = new Point(85, 65);
|
|
||||||
this.txtSingleVar.Size = new Size(50, 26);
|
|
||||||
this.txtSingleVar.Text = "x";
|
|
||||||
this.txtSingleVar.Font = new Font("Consolas", 10.5F);
|
|
||||||
this.txtSingleVar.BackColor = ThemeHelper.CardBackground;
|
|
||||||
this.txtSingleVar.ForeColor = Color.White;
|
|
||||||
this.txtSingleVar.BorderStyle = BorderStyle.FixedSingle;
|
|
||||||
|
|
||||||
this.lblSinglePoint.Text = "Nokta (x₀):";
|
|
||||||
this.lblSinglePoint.AutoSize = true;
|
|
||||||
this.lblSinglePoint.Location = new Point(150, 68);
|
|
||||||
this.txtSinglePoint.Location = new Point(230, 65);
|
|
||||||
this.txtSinglePoint.Size = new Size(65, 26);
|
|
||||||
this.txtSinglePoint.Text = "1";
|
|
||||||
this.txtSinglePoint.Font = new Font("Consolas", 10.5F);
|
|
||||||
this.txtSinglePoint.BackColor = ThemeHelper.CardBackground;
|
|
||||||
this.txtSinglePoint.ForeColor = Color.White;
|
|
||||||
this.txtSinglePoint.BorderStyle = BorderStyle.FixedSingle;
|
|
||||||
|
|
||||||
this.lblSingleDeg.Text = "Türev Derecesi:";
|
|
||||||
this.lblSingleDeg.AutoSize = true;
|
|
||||||
this.lblSingleDeg.Location = new Point(14, 106);
|
|
||||||
this.numSingleDegree.Location = new Point(120, 104);
|
|
||||||
this.numSingleDegree.Size = new Size(60, 26);
|
|
||||||
this.numSingleDegree.Minimum = 1;
|
|
||||||
this.numSingleDegree.Maximum = 6;
|
|
||||||
this.numSingleDegree.Value = 1;
|
|
||||||
this.numSingleDegree.Font = new Font("Consolas", 10.5F);
|
|
||||||
this.numSingleDegree.BackColor = ThemeHelper.CardBackground;
|
|
||||||
this.numSingleDegree.ForeColor = Color.White;
|
|
||||||
this.numSingleDegree.BorderStyle = BorderStyle.FixedSingle;
|
|
||||||
|
|
||||||
this.btnCalcSingle.Location = new Point(195, 100);
|
|
||||||
this.btnExSingle1.Location = new Point(14, 155);
|
|
||||||
this.btnExSingle2.Location = new Point(165, 155);
|
|
||||||
|
|
||||||
this.grpSingle.Controls.Add(this.btnExSingle2);
|
|
||||||
this.grpSingle.Controls.Add(this.btnExSingle1);
|
|
||||||
this.grpSingle.Controls.Add(this.btnCalcSingle);
|
|
||||||
this.grpSingle.Controls.Add(this.numSingleDegree);
|
|
||||||
this.grpSingle.Controls.Add(this.lblSingleDeg);
|
|
||||||
this.grpSingle.Controls.Add(this.txtSinglePoint);
|
|
||||||
this.grpSingle.Controls.Add(this.lblSinglePoint);
|
|
||||||
this.grpSingle.Controls.Add(this.txtSingleVar);
|
|
||||||
this.grpSingle.Controls.Add(this.lblSingleVar);
|
|
||||||
this.grpSingle.Controls.Add(this.txtSingleFn);
|
|
||||||
this.grpSingle.Controls.Add(this.lblSingleFn);
|
|
||||||
|
|
||||||
// grpPartial
|
|
||||||
this.grpPartial.Location = new Point(440, 54);
|
|
||||||
this.grpPartial.Size = new Size(440, 225);
|
|
||||||
this.grpPartial.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
|
|
||||||
this.grpPartial.ForeColor = ThemeHelper.LightText;
|
|
||||||
this.grpPartial.Font = new Font("Segoe UI Semibold", 9.5F, FontStyle.Bold);
|
|
||||||
this.grpPartial.Text = "2. Çok Değişkenli Kısmi Türev & Gradyan (∂ⁿf / ∂xᵢⁿ)";
|
|
||||||
|
|
||||||
this.lblPartialFn.Text = "f(...) =";
|
|
||||||
this.lblPartialFn.AutoSize = true;
|
|
||||||
this.lblPartialFn.Location = new Point(14, 28);
|
|
||||||
this.txtPartialFn.Location = new Point(65, 25);
|
|
||||||
this.txtPartialFn.Size = new Size(195, 26);
|
|
||||||
this.txtPartialFn.Text = "x^2*y + sin(y)";
|
|
||||||
this.txtPartialFn.Font = new Font("Consolas", 10F);
|
|
||||||
this.txtPartialFn.BackColor = ThemeHelper.CardBackground;
|
|
||||||
this.txtPartialFn.ForeColor = Color.White;
|
|
||||||
this.txtPartialFn.BorderStyle = BorderStyle.FixedSingle;
|
|
||||||
|
|
||||||
this.lblTargetVar.Text = "Türev Değişkeni:";
|
|
||||||
this.lblTargetVar.AutoSize = true;
|
|
||||||
this.lblTargetVar.Location = new Point(268, 28);
|
|
||||||
this.txtTargetVar.Location = new Point(378, 25);
|
|
||||||
this.txtTargetVar.Size = new Size(45, 26);
|
|
||||||
this.txtTargetVar.Text = "x";
|
|
||||||
this.txtTargetVar.Font = new Font("Consolas", 10F, FontStyle.Bold);
|
|
||||||
this.txtTargetVar.BackColor = ThemeHelper.CardBackground;
|
|
||||||
this.txtTargetVar.ForeColor = Color.FromArgb(56, 189, 248);
|
|
||||||
this.txtTargetVar.BorderStyle = BorderStyle.FixedSingle;
|
|
||||||
this.txtTargetVar.TextAlign = HorizontalAlignment.Center;
|
|
||||||
|
|
||||||
this.pnlPartialVars.Location = new Point(14, 58);
|
|
||||||
this.pnlPartialVars.Size = new Size(410, 110);
|
|
||||||
this.pnlPartialVars.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
|
|
||||||
this.pnlPartialVars.AutoScroll = true;
|
|
||||||
this.pnlPartialVars.BackColor = Color.FromArgb(11, 17, 32);
|
|
||||||
|
|
||||||
this.lblPartialDeg.Text = "Derece:";
|
|
||||||
this.lblPartialDeg.AutoSize = true;
|
|
||||||
this.lblPartialDeg.Location = new Point(14, 182);
|
|
||||||
this.numPartialDegree.Location = new Point(68, 179);
|
|
||||||
this.numPartialDegree.Size = new Size(48, 26);
|
|
||||||
this.numPartialDegree.Minimum = 1;
|
|
||||||
this.numPartialDegree.Maximum = 4;
|
|
||||||
this.numPartialDegree.Value = 1;
|
|
||||||
this.numPartialDegree.BackColor = ThemeHelper.CardBackground;
|
|
||||||
this.numPartialDegree.ForeColor = Color.White;
|
|
||||||
this.numPartialDegree.BorderStyle = BorderStyle.FixedSingle;
|
|
||||||
|
|
||||||
this.btnAddVar.Location = new Point(122, 178);
|
|
||||||
this.btnCalcPartial.Location = new Point(238, 175);
|
|
||||||
|
|
||||||
this.grpPartial.Controls.Add(this.btnCalcPartial);
|
|
||||||
this.grpPartial.Controls.Add(this.btnAddVar);
|
|
||||||
this.grpPartial.Controls.Add(this.numPartialDegree);
|
|
||||||
this.grpPartial.Controls.Add(this.lblPartialDeg);
|
|
||||||
this.grpPartial.Controls.Add(this.pnlPartialVars);
|
|
||||||
this.grpPartial.Controls.Add(this.txtTargetVar);
|
|
||||||
this.grpPartial.Controls.Add(this.lblTargetVar);
|
|
||||||
this.grpPartial.Controls.Add(this.txtPartialFn);
|
|
||||||
this.grpPartial.Controls.Add(this.lblPartialFn);
|
|
||||||
|
|
||||||
// Result area
|
|
||||||
this.lblResult.Text = "📊 Nümerik Türev, Kısmi Türev ve Gradyan Raporu:";
|
|
||||||
this.lblResult.AutoSize = true;
|
|
||||||
this.lblResult.Font = new Font("Segoe UI Semibold", 10F, FontStyle.Bold);
|
|
||||||
this.lblResult.ForeColor = ThemeHelper.LightText;
|
|
||||||
this.lblResult.Location = new Point(20, 290);
|
|
||||||
|
|
||||||
this.btnCopyDerivative = ThemeHelper.CreateCopyButton("📋 Kopyala");
|
|
||||||
this.btnCopyDerivative.Location = new Point(780, 284);
|
|
||||||
this.btnCopyDerivative.Anchor = AnchorStyles.Top | AnchorStyles.Right;
|
|
||||||
|
|
||||||
this.txtResult.Location = new Point(20, 316);
|
|
||||||
this.txtResult.Size = new Size(860, 245);
|
|
||||||
this.txtResult.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
|
|
||||||
this.txtResult.Multiline = true;
|
|
||||||
this.txtResult.ReadOnly = true;
|
|
||||||
this.txtResult.ScrollBars = ScrollBars.Vertical;
|
|
||||||
this.txtResult.BackColor = ThemeHelper.CardBackground;
|
|
||||||
this.txtResult.ForeColor = Color.FromArgb(186, 230, 253);
|
|
||||||
this.txtResult.BorderStyle = BorderStyle.FixedSingle;
|
|
||||||
this.txtResult.Font = new Font("Consolas", 10F);
|
|
||||||
|
|
||||||
this.pnlContent.Controls.Add(this.btnCopyDerivative);
|
|
||||||
this.pnlContent.Controls.Add(this.txtResult);
|
|
||||||
this.pnlContent.Controls.Add(this.lblResult);
|
|
||||||
this.pnlContent.Controls.Add(this.grpPartial);
|
|
||||||
this.pnlContent.Controls.Add(this.grpSingle);
|
|
||||||
this.pnlContent.Controls.Add(this.pnlTopSettings);
|
|
||||||
|
|
||||||
this.AutoScaleDimensions = new SizeF(7F, 15F);
|
|
||||||
this.AutoScaleMode = AutoScaleMode.Font;
|
|
||||||
this.BackColor = ThemeHelper.DarkBackground;
|
|
||||||
this.Controls.Add(this.pnlContent);
|
|
||||||
this.Controls.Add(this.pnlHeader);
|
|
||||||
this.Name = "DerivativeCalculatorControl";
|
|
||||||
this.Size = new Size(900, 660);
|
|
||||||
|
|
||||||
((System.ComponentModel.ISupportInitialize)(this.numSingleDegree)).EndInit();
|
|
||||||
((System.ComponentModel.ISupportInitialize)(this.numPartialDegree)).EndInit();
|
|
||||||
this.pnlTopSettings.ResumeLayout(false);
|
|
||||||
this.pnlTopSettings.PerformLayout();
|
|
||||||
this.grpSingle.ResumeLayout(false);
|
|
||||||
this.grpSingle.PerformLayout();
|
|
||||||
this.grpPartial.ResumeLayout(false);
|
|
||||||
this.grpPartial.PerformLayout();
|
|
||||||
this.pnlContent.ResumeLayout(false);
|
|
||||||
this.pnlContent.PerformLayout();
|
|
||||||
this.ResumeLayout(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
private Panel pnlHeader;
|
private Panel pnlHeader;
|
||||||
private Panel pnlContent;
|
private Panel pnlContent;
|
||||||
|
|
||||||
|
// Top Settings Bar
|
||||||
private Panel pnlTopSettings;
|
private Panel pnlTopSettings;
|
||||||
private Label lblStepH;
|
private Label lblStepH;
|
||||||
private TextBox txtStepH;
|
private TextBox txtStepH;
|
||||||
|
private Button btnH1;
|
||||||
|
private Button btnH2;
|
||||||
|
private Button btnH3;
|
||||||
|
private Label lblFormula;
|
||||||
|
private ComboBox cmbFormula;
|
||||||
private Label lblAcc;
|
private Label lblAcc;
|
||||||
private ComboBox cmbAccuracy;
|
private ComboBox cmbAccuracy;
|
||||||
private GroupBox grpSingle;
|
|
||||||
|
// Panels Left & Right
|
||||||
|
private Panel pnlSplit;
|
||||||
|
private Panel grpSingle;
|
||||||
|
private Panel grpPartial;
|
||||||
|
|
||||||
|
// Single Variable Controls
|
||||||
|
private Label lblSingleTitle;
|
||||||
private Label lblSingleFn;
|
private Label lblSingleFn;
|
||||||
private TextBox txtSingleFn;
|
private TextBox txtSingleFn;
|
||||||
private Label lblSingleVar;
|
private Label lblSingleVar;
|
||||||
|
|
@ -310,22 +38,606 @@ namespace MathApp.Controls
|
||||||
private Label lblSingleDeg;
|
private Label lblSingleDeg;
|
||||||
private NumericUpDown numSingleDegree;
|
private NumericUpDown numSingleDegree;
|
||||||
private Button btnCalcSingle;
|
private Button btnCalcSingle;
|
||||||
|
private FlowLayoutPanel pnlSingleExamples;
|
||||||
private Button btnExSingle1;
|
private Button btnExSingle1;
|
||||||
private Button btnExSingle2;
|
private Button btnExSingle2;
|
||||||
private GroupBox grpPartial;
|
private Button btnPlotTangent;
|
||||||
|
|
||||||
|
// Multivariable Controls
|
||||||
|
private Label lblPartialTitle;
|
||||||
private Label lblPartialFn;
|
private Label lblPartialFn;
|
||||||
private TextBox txtPartialFn;
|
private TextBox txtPartialFn;
|
||||||
private Label lblTargetVar;
|
private Label lblTargetVar;
|
||||||
private TextBox txtTargetVar;
|
private TextBox txtTargetVar;
|
||||||
private Label lblPartialDeg;
|
private Label lblDirectionVector;
|
||||||
private NumericUpDown numPartialDegree;
|
private TextBox txtDirectionVector;
|
||||||
private FlowLayoutPanel pnlPartialVars;
|
private FlowLayoutPanel pnlPartialVars;
|
||||||
private Button btnAddVar;
|
private Button btnAddVar;
|
||||||
private Button btnCalcPartial;
|
private Button btnCalcPartial;
|
||||||
|
private Button btnCalcHessian;
|
||||||
|
private FlowLayoutPanel pnlPartialExamples;
|
||||||
private Button btnExPartial1;
|
private Button btnExPartial1;
|
||||||
private Button btnExPartial2;
|
private Button btnExPartial2;
|
||||||
private Label lblResult;
|
|
||||||
private Button btnCopyDerivative;
|
// Bottom Tabbed Results Area
|
||||||
|
private TabControl tabResults;
|
||||||
|
private TabPage tabSummary;
|
||||||
|
private TabPage tabHessian;
|
||||||
|
private TabPage tabLog;
|
||||||
|
|
||||||
|
// Tab 1: Summary Card
|
||||||
|
private Panel pnlKpiCard;
|
||||||
|
private Label lblKpiTitle;
|
||||||
|
private Label lblKpiValue;
|
||||||
|
private Label lblKpiSubtitle;
|
||||||
|
private RichTextBox txtSummaryView;
|
||||||
|
|
||||||
|
// Tab 2: Hessian Grid
|
||||||
|
private DataGridView dgvHessian;
|
||||||
|
private Label lblHessianAnalysis;
|
||||||
|
|
||||||
|
// Tab 3: Detailed Log
|
||||||
|
private Panel pnlLogToolbar;
|
||||||
|
private Button btnCopyLog;
|
||||||
private TextBox txtResult;
|
private TextBox txtResult;
|
||||||
|
|
||||||
|
protected override void Dispose(bool disposing)
|
||||||
|
{
|
||||||
|
if (disposing && (components != null)) components.Dispose();
|
||||||
|
base.Dispose(disposing);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void InitializeComponent()
|
||||||
|
{
|
||||||
|
this.pnlHeader = ThemeHelper.CreateHeaderPanel(
|
||||||
|
"Nümerik Türev & Kısmi Türev Stüdyosu (Differentiation)",
|
||||||
|
"Merkezi sonlu farklar, ileri/geri farklar, yüksek mertebeli türevler, teğet doğrusu, gradyan (∇f) ve Hessian matrisi analizi.");
|
||||||
|
|
||||||
|
this.pnlContent = new Panel();
|
||||||
|
this.pnlTopSettings = new Panel();
|
||||||
|
this.lblStepH = new Label();
|
||||||
|
this.txtStepH = new TextBox();
|
||||||
|
this.btnH1 = new Button();
|
||||||
|
this.btnH2 = new Button();
|
||||||
|
this.btnH3 = new Button();
|
||||||
|
this.lblFormula = new Label();
|
||||||
|
this.cmbFormula = new ComboBox();
|
||||||
|
this.lblAcc = new Label();
|
||||||
|
this.cmbAccuracy = new ComboBox();
|
||||||
|
|
||||||
|
this.pnlSplit = new Panel();
|
||||||
|
this.grpSingle = new Panel();
|
||||||
|
this.grpPartial = new Panel();
|
||||||
|
|
||||||
|
// Single
|
||||||
|
this.lblSingleTitle = new Label();
|
||||||
|
this.lblSingleFn = new Label();
|
||||||
|
this.txtSingleFn = new TextBox();
|
||||||
|
this.lblSingleVar = new Label();
|
||||||
|
this.txtSingleVar = new TextBox();
|
||||||
|
this.lblSinglePoint = new Label();
|
||||||
|
this.txtSinglePoint = new TextBox();
|
||||||
|
this.lblSingleDeg = new Label();
|
||||||
|
this.numSingleDegree = new NumericUpDown();
|
||||||
|
this.btnCalcSingle = new Button();
|
||||||
|
this.btnPlotTangent = new Button();
|
||||||
|
this.pnlSingleExamples = new FlowLayoutPanel();
|
||||||
|
this.btnExSingle1 = ThemeHelper.CreateExampleChip("Örnek: sin(x)+x³");
|
||||||
|
this.btnExSingle2 = ThemeHelper.CreateExampleChip("Örnek: exp(2x)");
|
||||||
|
|
||||||
|
// Partial
|
||||||
|
this.lblPartialTitle = new Label();
|
||||||
|
this.lblPartialFn = new Label();
|
||||||
|
this.txtPartialFn = new TextBox();
|
||||||
|
this.lblTargetVar = new Label();
|
||||||
|
this.txtTargetVar = new TextBox();
|
||||||
|
this.lblDirectionVector = new Label();
|
||||||
|
this.txtDirectionVector = new TextBox();
|
||||||
|
this.pnlPartialVars = new FlowLayoutPanel();
|
||||||
|
this.btnAddVar = new Button();
|
||||||
|
this.btnCalcPartial = new Button();
|
||||||
|
this.btnCalcHessian = new Button();
|
||||||
|
this.pnlPartialExamples = new FlowLayoutPanel();
|
||||||
|
this.btnExPartial1 = ThemeHelper.CreateExampleChip("Örnek: x²y + sin(y)");
|
||||||
|
this.btnExPartial2 = ThemeHelper.CreateExampleChip("Örnek: exp(x*y)");
|
||||||
|
|
||||||
|
// Tab Results
|
||||||
|
this.tabResults = new TabControl();
|
||||||
|
this.tabSummary = new TabPage();
|
||||||
|
this.tabHessian = new TabPage();
|
||||||
|
this.tabLog = new TabPage();
|
||||||
|
|
||||||
|
this.pnlKpiCard = new Panel();
|
||||||
|
this.lblKpiTitle = new Label();
|
||||||
|
this.lblKpiValue = new Label();
|
||||||
|
this.lblKpiSubtitle = new Label();
|
||||||
|
this.txtSummaryView = new RichTextBox();
|
||||||
|
|
||||||
|
this.dgvHessian = new DataGridView();
|
||||||
|
this.lblHessianAnalysis = new Label();
|
||||||
|
|
||||||
|
this.pnlLogToolbar = new Panel();
|
||||||
|
this.btnCopyLog = ThemeHelper.CreateCopyButton("📋 Kopyala");
|
||||||
|
this.txtResult = new TextBox();
|
||||||
|
|
||||||
|
this.pnlContent.SuspendLayout();
|
||||||
|
this.pnlTopSettings.SuspendLayout();
|
||||||
|
this.pnlSplit.SuspendLayout();
|
||||||
|
this.grpSingle.SuspendLayout();
|
||||||
|
this.grpPartial.SuspendLayout();
|
||||||
|
this.tabResults.SuspendLayout();
|
||||||
|
this.tabSummary.SuspendLayout();
|
||||||
|
this.tabHessian.SuspendLayout();
|
||||||
|
this.tabLog.SuspendLayout();
|
||||||
|
this.pnlKpiCard.SuspendLayout();
|
||||||
|
this.pnlLogToolbar.SuspendLayout();
|
||||||
|
((System.ComponentModel.ISupportInitialize)(this.numSingleDegree)).BeginInit();
|
||||||
|
((System.ComponentModel.ISupportInitialize)(this.dgvHessian)).BeginInit();
|
||||||
|
this.SuspendLayout();
|
||||||
|
|
||||||
|
this.pnlContent.Dock = DockStyle.Fill;
|
||||||
|
this.pnlContent.BackColor = ThemeHelper.DarkBackground;
|
||||||
|
this.pnlContent.Padding = new Padding(16, 8, 16, 12);
|
||||||
|
this.pnlContent.AutoScroll = true;
|
||||||
|
|
||||||
|
// ==========================================
|
||||||
|
// Top Settings Bar
|
||||||
|
// ==========================================
|
||||||
|
this.pnlTopSettings.Dock = DockStyle.Top;
|
||||||
|
this.pnlTopSettings.Height = 44;
|
||||||
|
this.pnlTopSettings.BackColor = Color.FromArgb(22, 32, 50);
|
||||||
|
this.pnlTopSettings.Padding = new Padding(8);
|
||||||
|
|
||||||
|
this.lblStepH.Text = "Adım (h):";
|
||||||
|
this.lblStepH.AutoSize = true;
|
||||||
|
this.lblStepH.ForeColor = Color.FromArgb(203, 213, 225);
|
||||||
|
this.lblStepH.Font = new Font("Segoe UI", 9F);
|
||||||
|
this.lblStepH.Location = new Point(8, 12);
|
||||||
|
|
||||||
|
this.txtStepH.Location = new Point(68, 9);
|
||||||
|
this.txtStepH.Size = new Size(65, 23);
|
||||||
|
this.txtStepH.Text = "0.001";
|
||||||
|
this.txtStepH.Font = new Font("Consolas", 9.5F);
|
||||||
|
this.txtStepH.BackColor = Color.FromArgb(15, 23, 42);
|
||||||
|
this.txtStepH.ForeColor = Color.White;
|
||||||
|
this.txtStepH.BorderStyle = BorderStyle.FixedSingle;
|
||||||
|
|
||||||
|
void StyleQuickH(Button b, string text, Point loc)
|
||||||
|
{
|
||||||
|
b.Text = text;
|
||||||
|
b.Location = loc;
|
||||||
|
b.Size = new Size(42, 23);
|
||||||
|
b.FlatStyle = FlatStyle.Flat;
|
||||||
|
b.BackColor = Color.FromArgb(30, 41, 59);
|
||||||
|
b.ForeColor = Color.FromArgb(56, 189, 248);
|
||||||
|
b.Font = new Font("Segoe UI", 7.5F, FontStyle.Bold);
|
||||||
|
b.Cursor = Cursors.Hand;
|
||||||
|
b.FlatAppearance.BorderSize = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
StyleQuickH(this.btnH1, "1e-3", new Point(138, 9));
|
||||||
|
StyleQuickH(this.btnH2, "1e-5", new Point(183, 9));
|
||||||
|
StyleQuickH(this.btnH3, "1e-7", new Point(228, 9));
|
||||||
|
|
||||||
|
this.lblFormula.Text = "Fark Yöntemi:";
|
||||||
|
this.lblFormula.AutoSize = true;
|
||||||
|
this.lblFormula.ForeColor = Color.FromArgb(203, 213, 225);
|
||||||
|
this.lblFormula.Font = new Font("Segoe UI", 9F);
|
||||||
|
this.lblFormula.Location = new Point(285, 12);
|
||||||
|
|
||||||
|
this.cmbFormula.Items.AddRange(new object[] {
|
||||||
|
"Merkezi Farklar (Central — En Yüksek Doğruluk)",
|
||||||
|
"İleri Farklar (Forward Differences)",
|
||||||
|
"Geri Farklar (Backward Differences)"
|
||||||
|
});
|
||||||
|
this.cmbFormula.SelectedIndex = 0;
|
||||||
|
this.cmbFormula.Location = new Point(370, 9);
|
||||||
|
this.cmbFormula.Size = new Size(250, 23);
|
||||||
|
this.cmbFormula.DropDownStyle = ComboBoxStyle.DropDownList;
|
||||||
|
this.cmbFormula.BackColor = Color.FromArgb(15, 23, 42);
|
||||||
|
this.cmbFormula.ForeColor = Color.White;
|
||||||
|
this.cmbFormula.Font = new Font("Segoe UI", 8.5F);
|
||||||
|
|
||||||
|
this.lblAcc.Text = "Doğruluk:";
|
||||||
|
this.lblAcc.AutoSize = true;
|
||||||
|
this.lblAcc.ForeColor = Color.FromArgb(203, 213, 225);
|
||||||
|
this.lblAcc.Font = new Font("Segoe UI", 9F);
|
||||||
|
this.lblAcc.Location = new Point(635, 12);
|
||||||
|
|
||||||
|
this.cmbAccuracy.Items.AddRange(new object[] {
|
||||||
|
"2. Derece O(h²)",
|
||||||
|
"4. Derece O(h⁴) - Önerilen",
|
||||||
|
"6. Derece O(h⁶) - Maksimum"
|
||||||
|
});
|
||||||
|
this.cmbAccuracy.SelectedIndex = 1;
|
||||||
|
this.cmbAccuracy.Location = new Point(700, 9);
|
||||||
|
this.cmbAccuracy.Size = new Size(160, 23);
|
||||||
|
this.cmbAccuracy.DropDownStyle = ComboBoxStyle.DropDownList;
|
||||||
|
this.cmbAccuracy.BackColor = Color.FromArgb(15, 23, 42);
|
||||||
|
this.cmbAccuracy.ForeColor = Color.White;
|
||||||
|
this.cmbAccuracy.Font = new Font("Segoe UI", 8.5F);
|
||||||
|
|
||||||
|
this.pnlTopSettings.Controls.Add(this.lblStepH);
|
||||||
|
this.pnlTopSettings.Controls.Add(this.txtStepH);
|
||||||
|
this.pnlTopSettings.Controls.Add(this.btnH1);
|
||||||
|
this.pnlTopSettings.Controls.Add(this.btnH2);
|
||||||
|
this.pnlTopSettings.Controls.Add(this.btnH3);
|
||||||
|
this.pnlTopSettings.Controls.Add(this.lblFormula);
|
||||||
|
this.pnlTopSettings.Controls.Add(this.cmbFormula);
|
||||||
|
this.pnlTopSettings.Controls.Add(this.lblAcc);
|
||||||
|
this.pnlTopSettings.Controls.Add(this.cmbAccuracy);
|
||||||
|
|
||||||
|
// ==========================================
|
||||||
|
// Split Panel (Left: Single, Right: Partial)
|
||||||
|
// ==========================================
|
||||||
|
this.pnlSplit.Dock = DockStyle.Top;
|
||||||
|
this.pnlSplit.Height = 230;
|
||||||
|
this.pnlSplit.BackColor = Color.Transparent;
|
||||||
|
this.pnlSplit.Padding = new Padding(0, 8, 0, 0);
|
||||||
|
|
||||||
|
// Left Card (Single Variable)
|
||||||
|
this.grpSingle.Dock = DockStyle.Left;
|
||||||
|
this.grpSingle.Width = 430;
|
||||||
|
this.grpSingle.BackColor = Color.FromArgb(22, 32, 50);
|
||||||
|
this.grpSingle.Padding = new Padding(12);
|
||||||
|
|
||||||
|
this.lblSingleTitle.Text = "📐 1. Tek Değişkenli Türev Laboratuvarı: f(x)";
|
||||||
|
this.lblSingleTitle.Font = new Font("Segoe UI Semibold", 9.5F, FontStyle.Bold);
|
||||||
|
this.lblSingleTitle.ForeColor = Color.FromArgb(56, 189, 248);
|
||||||
|
this.lblSingleTitle.Location = new Point(10, 8);
|
||||||
|
this.lblSingleTitle.AutoSize = true;
|
||||||
|
|
||||||
|
this.lblSingleFn.Text = "f(x) =";
|
||||||
|
this.lblSingleFn.ForeColor = Color.FromArgb(203, 213, 225);
|
||||||
|
this.lblSingleFn.Location = new Point(12, 36);
|
||||||
|
this.lblSingleFn.AutoSize = true;
|
||||||
|
|
||||||
|
this.txtSingleFn.Text = "sin(x) + x^3";
|
||||||
|
this.txtSingleFn.Location = new Point(55, 33);
|
||||||
|
this.txtSingleFn.Size = new Size(355, 24);
|
||||||
|
this.txtSingleFn.Font = new Font("Consolas", 10F);
|
||||||
|
this.txtSingleFn.BackColor = Color.FromArgb(15, 23, 42);
|
||||||
|
this.txtSingleFn.ForeColor = Color.White;
|
||||||
|
this.txtSingleFn.BorderStyle = BorderStyle.FixedSingle;
|
||||||
|
|
||||||
|
this.lblSingleVar.Text = "Değişken:";
|
||||||
|
this.lblSingleVar.ForeColor = Color.FromArgb(203, 213, 225);
|
||||||
|
this.lblSingleVar.Location = new Point(12, 68);
|
||||||
|
this.lblSingleVar.AutoSize = true;
|
||||||
|
|
||||||
|
this.txtSingleVar.Text = "x";
|
||||||
|
this.txtSingleVar.Location = new Point(75, 65);
|
||||||
|
this.txtSingleVar.Size = new Size(40, 23);
|
||||||
|
this.txtSingleVar.Font = new Font("Consolas", 10F);
|
||||||
|
this.txtSingleVar.BackColor = Color.FromArgb(15, 23, 42);
|
||||||
|
this.txtSingleVar.ForeColor = Color.White;
|
||||||
|
this.txtSingleVar.BorderStyle = BorderStyle.FixedSingle;
|
||||||
|
|
||||||
|
this.lblSinglePoint.Text = "Nokta (x₀):";
|
||||||
|
this.lblSinglePoint.ForeColor = Color.FromArgb(203, 213, 225);
|
||||||
|
this.lblSinglePoint.Location = new Point(125, 68);
|
||||||
|
this.lblSinglePoint.AutoSize = true;
|
||||||
|
|
||||||
|
this.txtSinglePoint.Text = "1";
|
||||||
|
this.txtSinglePoint.Location = new Point(190, 65);
|
||||||
|
this.txtSinglePoint.Size = new Size(60, 23);
|
||||||
|
this.txtSinglePoint.Font = new Font("Consolas", 10F);
|
||||||
|
this.txtSinglePoint.BackColor = Color.FromArgb(15, 23, 42);
|
||||||
|
this.txtSinglePoint.ForeColor = Color.White;
|
||||||
|
this.txtSinglePoint.BorderStyle = BorderStyle.FixedSingle;
|
||||||
|
|
||||||
|
this.lblSingleDeg.Text = "Mertebe:";
|
||||||
|
this.lblSingleDeg.ForeColor = Color.FromArgb(203, 213, 225);
|
||||||
|
this.lblSingleDeg.Location = new Point(265, 68);
|
||||||
|
this.lblSingleDeg.AutoSize = true;
|
||||||
|
|
||||||
|
this.numSingleDegree.Location = new Point(325, 65);
|
||||||
|
this.numSingleDegree.Size = new Size(45, 23);
|
||||||
|
this.numSingleDegree.Minimum = 1;
|
||||||
|
this.numSingleDegree.Maximum = 6;
|
||||||
|
this.numSingleDegree.Value = 1;
|
||||||
|
this.numSingleDegree.BackColor = Color.FromArgb(15, 23, 42);
|
||||||
|
this.numSingleDegree.ForeColor = Color.White;
|
||||||
|
|
||||||
|
this.btnCalcSingle.Text = "∂ Türevi Hesapla";
|
||||||
|
this.btnCalcSingle.Location = new Point(12, 100);
|
||||||
|
this.btnCalcSingle.Size = new Size(195, 32);
|
||||||
|
this.btnCalcSingle.FlatStyle = FlatStyle.Flat;
|
||||||
|
this.btnCalcSingle.BackColor = Color.FromArgb(14, 165, 233);
|
||||||
|
this.btnCalcSingle.ForeColor = Color.White;
|
||||||
|
this.btnCalcSingle.Font = new Font("Segoe UI Semibold", 8.5F, FontStyle.Bold);
|
||||||
|
this.btnCalcSingle.Cursor = Cursors.Hand;
|
||||||
|
this.btnCalcSingle.FlatAppearance.BorderSize = 0;
|
||||||
|
|
||||||
|
this.btnPlotTangent.Text = "📈 Teğeti Grafikte Çiz";
|
||||||
|
this.btnPlotTangent.Location = new Point(215, 100);
|
||||||
|
this.btnPlotTangent.Size = new Size(195, 32);
|
||||||
|
this.btnPlotTangent.FlatStyle = FlatStyle.Flat;
|
||||||
|
this.btnPlotTangent.BackColor = Color.FromArgb(16, 185, 129);
|
||||||
|
this.btnPlotTangent.ForeColor = Color.White;
|
||||||
|
this.btnPlotTangent.Font = new Font("Segoe UI Semibold", 8.5F, FontStyle.Bold);
|
||||||
|
this.btnPlotTangent.Cursor = Cursors.Hand;
|
||||||
|
this.btnPlotTangent.FlatAppearance.BorderSize = 0;
|
||||||
|
|
||||||
|
this.pnlSingleExamples.Location = new Point(12, 142);
|
||||||
|
this.pnlSingleExamples.Size = new Size(400, 32);
|
||||||
|
this.pnlSingleExamples.BackColor = Color.Transparent;
|
||||||
|
this.pnlSingleExamples.Controls.Add(this.btnExSingle1);
|
||||||
|
this.pnlSingleExamples.Controls.Add(this.btnExSingle2);
|
||||||
|
|
||||||
|
this.grpSingle.Controls.Add(this.lblSingleTitle);
|
||||||
|
this.grpSingle.Controls.Add(this.lblSingleFn);
|
||||||
|
this.grpSingle.Controls.Add(this.txtSingleFn);
|
||||||
|
this.grpSingle.Controls.Add(this.lblSingleVar);
|
||||||
|
this.grpSingle.Controls.Add(this.txtSingleVar);
|
||||||
|
this.grpSingle.Controls.Add(this.lblSinglePoint);
|
||||||
|
this.grpSingle.Controls.Add(this.txtSinglePoint);
|
||||||
|
this.grpSingle.Controls.Add(this.lblSingleDeg);
|
||||||
|
this.grpSingle.Controls.Add(this.numSingleDegree);
|
||||||
|
this.grpSingle.Controls.Add(this.btnCalcSingle);
|
||||||
|
this.grpSingle.Controls.Add(this.btnPlotTangent);
|
||||||
|
this.grpSingle.Controls.Add(this.pnlSingleExamples);
|
||||||
|
|
||||||
|
// Right Card (Multivariable, Gradient & Hessian)
|
||||||
|
this.grpPartial.Dock = DockStyle.Fill;
|
||||||
|
this.grpPartial.BackColor = Color.FromArgb(22, 32, 50);
|
||||||
|
this.grpPartial.Padding = new Padding(12);
|
||||||
|
|
||||||
|
this.lblPartialTitle.Text = "🌐 2. Çok Değişkenli Analiz, Gradyan (∇f) & Hessian";
|
||||||
|
this.lblPartialTitle.Font = new Font("Segoe UI Semibold", 9.5F, FontStyle.Bold);
|
||||||
|
this.lblPartialTitle.ForeColor = Color.FromArgb(52, 211, 153);
|
||||||
|
this.lblPartialTitle.Location = new Point(10, 8);
|
||||||
|
this.lblPartialTitle.AutoSize = true;
|
||||||
|
|
||||||
|
this.lblPartialFn.Text = "f(...) =";
|
||||||
|
this.lblPartialFn.ForeColor = Color.FromArgb(203, 213, 225);
|
||||||
|
this.lblPartialFn.Location = new Point(12, 36);
|
||||||
|
this.lblPartialFn.AutoSize = true;
|
||||||
|
|
||||||
|
this.txtPartialFn.Text = "x^2*y + sin(y)";
|
||||||
|
this.txtPartialFn.Location = new Point(55, 33);
|
||||||
|
this.txtPartialFn.Size = new Size(185, 24);
|
||||||
|
this.txtPartialFn.Font = new Font("Consolas", 10F);
|
||||||
|
this.txtPartialFn.BackColor = Color.FromArgb(15, 23, 42);
|
||||||
|
this.txtPartialFn.ForeColor = Color.White;
|
||||||
|
this.txtPartialFn.BorderStyle = BorderStyle.FixedSingle;
|
||||||
|
|
||||||
|
this.lblTargetVar.Text = "Hedef ∂/∂:";
|
||||||
|
this.lblTargetVar.ForeColor = Color.FromArgb(203, 213, 225);
|
||||||
|
this.lblTargetVar.Location = new Point(245, 36);
|
||||||
|
this.lblTargetVar.AutoSize = true;
|
||||||
|
|
||||||
|
this.txtTargetVar.Text = "x";
|
||||||
|
this.txtTargetVar.Location = new Point(315, 33);
|
||||||
|
this.txtTargetVar.Size = new Size(35, 23);
|
||||||
|
this.txtTargetVar.Font = new Font("Consolas", 10F, FontStyle.Bold);
|
||||||
|
this.txtTargetVar.BackColor = Color.FromArgb(15, 23, 42);
|
||||||
|
this.txtTargetVar.ForeColor = Color.FromArgb(56, 189, 248);
|
||||||
|
this.txtTargetVar.BorderStyle = BorderStyle.FixedSingle;
|
||||||
|
this.txtTargetVar.TextAlign = HorizontalAlignment.Center;
|
||||||
|
|
||||||
|
this.lblDirectionVector.Text = "Yön u:";
|
||||||
|
this.lblDirectionVector.ForeColor = Color.FromArgb(203, 213, 225);
|
||||||
|
this.lblDirectionVector.Location = new Point(355, 36);
|
||||||
|
this.lblDirectionVector.AutoSize = true;
|
||||||
|
|
||||||
|
this.txtDirectionVector.Text = "1, 0";
|
||||||
|
this.txtDirectionVector.Location = new Point(398, 33);
|
||||||
|
this.txtDirectionVector.Size = new Size(50, 23);
|
||||||
|
this.txtDirectionVector.Font = new Font("Consolas", 9F);
|
||||||
|
this.txtDirectionVector.BackColor = Color.FromArgb(15, 23, 42);
|
||||||
|
this.txtDirectionVector.ForeColor = Color.FromArgb(250, 204, 21);
|
||||||
|
this.txtDirectionVector.BorderStyle = BorderStyle.FixedSingle;
|
||||||
|
|
||||||
|
// Partial Variables List
|
||||||
|
this.pnlPartialVars.Location = new Point(12, 65);
|
||||||
|
this.pnlPartialVars.Size = new Size(436, 80);
|
||||||
|
this.pnlPartialVars.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
|
||||||
|
this.pnlPartialVars.AutoScroll = true;
|
||||||
|
this.pnlPartialVars.BackColor = Color.FromArgb(15, 23, 42);
|
||||||
|
|
||||||
|
this.btnAddVar.Text = "+ Değişken";
|
||||||
|
this.btnAddVar.Location = new Point(12, 150);
|
||||||
|
this.btnAddVar.Size = new Size(90, 30);
|
||||||
|
this.btnAddVar.FlatStyle = FlatStyle.Flat;
|
||||||
|
this.btnAddVar.BackColor = Color.FromArgb(30, 41, 59);
|
||||||
|
this.btnAddVar.ForeColor = Color.FromArgb(56, 189, 248);
|
||||||
|
this.btnAddVar.Font = new Font("Segoe UI Semibold", 8F, FontStyle.Bold);
|
||||||
|
this.btnAddVar.Cursor = Cursors.Hand;
|
||||||
|
this.btnAddVar.FlatAppearance.BorderSize = 0;
|
||||||
|
|
||||||
|
this.btnCalcPartial.Text = "∇ Gradyan & Kısmi";
|
||||||
|
this.btnCalcPartial.Location = new Point(110, 150);
|
||||||
|
this.btnCalcPartial.Size = new Size(160, 30);
|
||||||
|
this.btnCalcPartial.FlatStyle = FlatStyle.Flat;
|
||||||
|
this.btnCalcPartial.BackColor = Color.FromArgb(16, 185, 129);
|
||||||
|
this.btnCalcPartial.ForeColor = Color.White;
|
||||||
|
this.btnCalcPartial.Font = new Font("Segoe UI Semibold", 8F, FontStyle.Bold);
|
||||||
|
this.btnCalcPartial.Cursor = Cursors.Hand;
|
||||||
|
this.btnCalcPartial.FlatAppearance.BorderSize = 0;
|
||||||
|
|
||||||
|
this.btnCalcHessian.Text = "🧮 Hessian & Ekstremum";
|
||||||
|
this.btnCalcHessian.Location = new Point(278, 150);
|
||||||
|
this.btnCalcHessian.Size = new Size(165, 30);
|
||||||
|
this.btnCalcHessian.FlatStyle = FlatStyle.Flat;
|
||||||
|
this.btnCalcHessian.BackColor = Color.FromArgb(147, 51, 234);
|
||||||
|
this.btnCalcHessian.ForeColor = Color.White;
|
||||||
|
this.btnCalcHessian.Font = new Font("Segoe UI Semibold", 8F, FontStyle.Bold);
|
||||||
|
this.btnCalcHessian.Cursor = Cursors.Hand;
|
||||||
|
this.btnCalcHessian.FlatAppearance.BorderSize = 0;
|
||||||
|
|
||||||
|
this.pnlPartialExamples.Location = new Point(12, 188);
|
||||||
|
this.pnlPartialExamples.Size = new Size(430, 32);
|
||||||
|
this.pnlPartialExamples.BackColor = Color.Transparent;
|
||||||
|
this.pnlPartialExamples.Controls.Add(this.btnExPartial1);
|
||||||
|
this.pnlPartialExamples.Controls.Add(this.btnExPartial2);
|
||||||
|
|
||||||
|
this.grpPartial.Controls.Add(this.lblPartialTitle);
|
||||||
|
this.grpPartial.Controls.Add(this.lblPartialFn);
|
||||||
|
this.grpPartial.Controls.Add(this.txtPartialFn);
|
||||||
|
this.grpPartial.Controls.Add(this.lblTargetVar);
|
||||||
|
this.grpPartial.Controls.Add(this.txtTargetVar);
|
||||||
|
this.grpPartial.Controls.Add(this.lblDirectionVector);
|
||||||
|
this.grpPartial.Controls.Add(this.txtDirectionVector);
|
||||||
|
this.grpPartial.Controls.Add(this.pnlPartialVars);
|
||||||
|
this.grpPartial.Controls.Add(this.btnAddVar);
|
||||||
|
this.grpPartial.Controls.Add(this.btnCalcPartial);
|
||||||
|
this.grpPartial.Controls.Add(this.btnCalcHessian);
|
||||||
|
this.grpPartial.Controls.Add(this.pnlPartialExamples);
|
||||||
|
|
||||||
|
// Add cards to Split
|
||||||
|
Panel spBetween = new Panel { Dock = DockStyle.Left, Width = 12, BackColor = Color.Transparent };
|
||||||
|
this.pnlSplit.Controls.Add(this.grpPartial);
|
||||||
|
this.pnlSplit.Controls.Add(spBetween);
|
||||||
|
this.pnlSplit.Controls.Add(this.grpSingle);
|
||||||
|
|
||||||
|
// ==========================================
|
||||||
|
// Bottom Tabbed Area
|
||||||
|
// ==========================================
|
||||||
|
this.tabResults.Dock = DockStyle.Fill;
|
||||||
|
this.tabResults.ItemSize = new Size(160, 26);
|
||||||
|
this.tabResults.SizeMode = TabSizeMode.Fixed;
|
||||||
|
|
||||||
|
this.tabSummary.Text = " Türev & Gradyan Kartı ";
|
||||||
|
this.tabSummary.BackColor = Color.FromArgb(15, 23, 42);
|
||||||
|
this.tabSummary.Padding = new Padding(8);
|
||||||
|
|
||||||
|
this.tabHessian.Text = " Hessian Matrisi Tablosu ";
|
||||||
|
this.tabHessian.BackColor = Color.FromArgb(15, 23, 42);
|
||||||
|
this.tabHessian.Padding = new Padding(8);
|
||||||
|
|
||||||
|
this.tabLog.Text = " Detaylı Analitik Rapor ";
|
||||||
|
this.tabLog.BackColor = Color.FromArgb(15, 23, 42);
|
||||||
|
this.tabLog.Padding = new Padding(8);
|
||||||
|
|
||||||
|
// Tab 1 (Summary)
|
||||||
|
this.pnlKpiCard.Dock = DockStyle.Top;
|
||||||
|
this.pnlKpiCard.Height = 85;
|
||||||
|
this.pnlKpiCard.BackColor = Color.FromArgb(22, 32, 50);
|
||||||
|
this.pnlKpiCard.Padding = new Padding(12);
|
||||||
|
|
||||||
|
this.lblKpiTitle.Text = "TÜREV ANALİZ SONUCU";
|
||||||
|
this.lblKpiTitle.Font = new Font("Segoe UI Semibold", 8F, FontStyle.Bold);
|
||||||
|
this.lblKpiTitle.ForeColor = Color.FromArgb(148, 163, 184);
|
||||||
|
this.lblKpiTitle.Location = new Point(12, 8);
|
||||||
|
this.lblKpiTitle.AutoSize = true;
|
||||||
|
|
||||||
|
this.lblKpiValue.Text = "—";
|
||||||
|
this.lblKpiValue.Font = new Font("Consolas", 18F, FontStyle.Bold);
|
||||||
|
this.lblKpiValue.ForeColor = Color.FromArgb(52, 211, 153);
|
||||||
|
this.lblKpiValue.Location = new Point(10, 24);
|
||||||
|
this.lblKpiValue.AutoSize = true;
|
||||||
|
|
||||||
|
this.lblKpiSubtitle.Text = "Hesaplama yapmak için yukarıdaki modüllerden birini çalıştırın.";
|
||||||
|
this.lblKpiSubtitle.Font = new Font("Segoe UI", 8.25F);
|
||||||
|
this.lblKpiSubtitle.ForeColor = Color.FromArgb(203, 213, 225);
|
||||||
|
this.lblKpiSubtitle.Location = new Point(12, 60);
|
||||||
|
this.lblKpiSubtitle.AutoSize = true;
|
||||||
|
|
||||||
|
this.pnlKpiCard.Controls.Add(this.lblKpiTitle);
|
||||||
|
this.pnlKpiCard.Controls.Add(this.lblKpiValue);
|
||||||
|
this.pnlKpiCard.Controls.Add(this.lblKpiSubtitle);
|
||||||
|
|
||||||
|
this.txtSummaryView.Dock = DockStyle.Fill;
|
||||||
|
this.txtSummaryView.BackColor = Color.FromArgb(15, 23, 42);
|
||||||
|
this.txtSummaryView.ForeColor = Color.FromArgb(226, 232, 240);
|
||||||
|
this.txtSummaryView.Font = new Font("Consolas", 9.5F);
|
||||||
|
this.txtSummaryView.BorderStyle = BorderStyle.None;
|
||||||
|
this.txtSummaryView.ReadOnly = true;
|
||||||
|
|
||||||
|
Panel spKpi = new Panel { Dock = DockStyle.Top, Height = 8, BackColor = Color.Transparent };
|
||||||
|
this.tabSummary.Controls.Add(this.txtSummaryView);
|
||||||
|
this.tabSummary.Controls.Add(spKpi);
|
||||||
|
this.tabSummary.Controls.Add(this.pnlKpiCard);
|
||||||
|
|
||||||
|
// Tab 2 (Hessian Grid)
|
||||||
|
this.lblHessianAnalysis.Dock = DockStyle.Top;
|
||||||
|
this.lblHessianAnalysis.Height = 35;
|
||||||
|
this.lblHessianAnalysis.Font = new Font("Segoe UI Semibold", 9.5F, FontStyle.Bold);
|
||||||
|
this.lblHessianAnalysis.ForeColor = Color.FromArgb(250, 204, 21);
|
||||||
|
this.lblHessianAnalysis.Text = "Hessian matris analizi için 'Hessian & Ekstremum' butonuna tıklayınız.";
|
||||||
|
|
||||||
|
this.dgvHessian.Dock = DockStyle.Fill;
|
||||||
|
this.dgvHessian.BackgroundColor = Color.FromArgb(15, 23, 42);
|
||||||
|
this.dgvHessian.BorderStyle = BorderStyle.None;
|
||||||
|
this.dgvHessian.CellBorderStyle = DataGridViewCellBorderStyle.Single;
|
||||||
|
this.dgvHessian.GridColor = Color.FromArgb(47, 63, 86);
|
||||||
|
this.dgvHessian.RowHeadersVisible = true;
|
||||||
|
this.dgvHessian.AllowUserToAddRows = false;
|
||||||
|
this.dgvHessian.AllowUserToDeleteRows = false;
|
||||||
|
this.dgvHessian.ReadOnly = true;
|
||||||
|
this.dgvHessian.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
|
||||||
|
this.dgvHessian.DefaultCellStyle.BackColor = Color.FromArgb(15, 23, 42);
|
||||||
|
this.dgvHessian.DefaultCellStyle.ForeColor = Color.White;
|
||||||
|
this.dgvHessian.DefaultCellStyle.Font = new Font("Consolas", 10F, FontStyle.Bold);
|
||||||
|
this.dgvHessian.DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
|
||||||
|
this.dgvHessian.ColumnHeadersDefaultCellStyle.BackColor = Color.FromArgb(30, 41, 59);
|
||||||
|
this.dgvHessian.ColumnHeadersDefaultCellStyle.ForeColor = Color.FromArgb(56, 189, 248);
|
||||||
|
this.dgvHessian.ColumnHeadersDefaultCellStyle.Font = new Font("Segoe UI Semibold", 9F, FontStyle.Bold);
|
||||||
|
this.dgvHessian.EnableHeadersVisualStyles = false;
|
||||||
|
|
||||||
|
this.tabHessian.Controls.Add(this.dgvHessian);
|
||||||
|
this.tabHessian.Controls.Add(this.lblHessianAnalysis);
|
||||||
|
|
||||||
|
// Tab 3 (Log)
|
||||||
|
this.pnlLogToolbar.Dock = DockStyle.Top;
|
||||||
|
this.pnlLogToolbar.Height = 34;
|
||||||
|
this.pnlLogToolbar.BackColor = Color.Transparent;
|
||||||
|
|
||||||
|
this.btnCopyLog.Dock = DockStyle.Right;
|
||||||
|
this.btnCopyLog.Width = 85;
|
||||||
|
this.pnlLogToolbar.Controls.Add(this.btnCopyLog);
|
||||||
|
|
||||||
|
this.txtResult.Dock = DockStyle.Fill;
|
||||||
|
this.txtResult.BackColor = Color.FromArgb(15, 23, 42);
|
||||||
|
this.txtResult.ForeColor = Color.FromArgb(186, 230, 253);
|
||||||
|
this.txtResult.BorderStyle = BorderStyle.None;
|
||||||
|
this.txtResult.Multiline = true;
|
||||||
|
this.txtResult.ReadOnly = true;
|
||||||
|
this.txtResult.ScrollBars = ScrollBars.Vertical;
|
||||||
|
this.txtResult.Font = new Font("Consolas", 9.5F);
|
||||||
|
|
||||||
|
this.tabLog.Controls.Add(this.txtResult);
|
||||||
|
this.tabLog.Controls.Add(this.pnlLogToolbar);
|
||||||
|
|
||||||
|
this.tabResults.TabPages.Add(this.tabSummary);
|
||||||
|
this.tabResults.TabPages.Add(this.tabHessian);
|
||||||
|
this.tabResults.TabPages.Add(this.tabLog);
|
||||||
|
|
||||||
|
// Add main panels
|
||||||
|
Panel spMain = new Panel { Dock = DockStyle.Top, Height = 10, BackColor = Color.Transparent };
|
||||||
|
this.pnlContent.Controls.Add(this.tabResults);
|
||||||
|
this.pnlContent.Controls.Add(spMain);
|
||||||
|
this.pnlContent.Controls.Add(this.pnlSplit);
|
||||||
|
this.pnlContent.Controls.Add(this.pnlTopSettings);
|
||||||
|
|
||||||
|
this.AutoScaleDimensions = new SizeF(7F, 15F);
|
||||||
|
this.AutoScaleMode = AutoScaleMode.Font;
|
||||||
|
this.BackColor = ThemeHelper.DarkBackground;
|
||||||
|
this.Controls.Add(this.pnlContent);
|
||||||
|
this.Controls.Add(this.pnlHeader);
|
||||||
|
this.Name = "DerivativeCalculatorControl";
|
||||||
|
this.Size = new Size(930, 700);
|
||||||
|
|
||||||
|
this.pnlContent.ResumeLayout(false);
|
||||||
|
this.pnlTopSettings.ResumeLayout(false);
|
||||||
|
this.pnlTopSettings.PerformLayout();
|
||||||
|
this.pnlSplit.ResumeLayout(false);
|
||||||
|
this.grpSingle.ResumeLayout(false);
|
||||||
|
this.grpSingle.PerformLayout();
|
||||||
|
this.grpPartial.ResumeLayout(false);
|
||||||
|
this.grpPartial.PerformLayout();
|
||||||
|
this.pnlKpiCard.ResumeLayout(false);
|
||||||
|
this.pnlKpiCard.PerformLayout();
|
||||||
|
this.pnlLogToolbar.ResumeLayout(false);
|
||||||
|
this.tabSummary.ResumeLayout(false);
|
||||||
|
this.tabHessian.ResumeLayout(false);
|
||||||
|
this.tabLog.ResumeLayout(false);
|
||||||
|
this.tabLog.PerformLayout();
|
||||||
|
this.tabResults.ResumeLayout(false);
|
||||||
|
((System.ComponentModel.ISupportInitialize)(this.numSingleDegree)).EndInit();
|
||||||
|
((System.ComponentModel.ISupportInitialize)(this.dgvHessian)).EndInit();
|
||||||
|
this.ResumeLayout(false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -13,50 +13,64 @@ namespace MathApp.Controls
|
||||||
{
|
{
|
||||||
private List<VariableInputRow> partialRows = new List<VariableInputRow>();
|
private List<VariableInputRow> partialRows = new List<VariableInputRow>();
|
||||||
|
|
||||||
|
// Saved state for Graph Plotter navigation
|
||||||
|
private string _lastSingleFn = "";
|
||||||
|
private string _lastTangentEq = "";
|
||||||
|
private float _lastX0 = 0f;
|
||||||
|
private float _lastY0 = 0f;
|
||||||
|
|
||||||
public DerivativeCalculatorControl()
|
public DerivativeCalculatorControl()
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
|
ThemeHelper.StyleModernTabControl(tabResults);
|
||||||
|
|
||||||
|
btnH1.Click += (s, e) => txtStepH.Text = "0.001";
|
||||||
|
btnH2.Click += (s, e) => txtStepH.Text = "0.00001";
|
||||||
|
btnH3.Click += (s, e) => txtStepH.Text = "0.0000001";
|
||||||
|
|
||||||
cmbAccuracy.SelectedIndex = 1; // 4th order default
|
|
||||||
btnCalcSingle.Click += BtnCalcSingle_Click;
|
btnCalcSingle.Click += BtnCalcSingle_Click;
|
||||||
|
btnPlotTangent.Click += BtnPlotTangent_Click;
|
||||||
btnAddVar.Click += BtnAddVar_Click;
|
btnAddVar.Click += BtnAddVar_Click;
|
||||||
btnCalcPartial.Click += BtnCalcPartial_Click;
|
btnCalcPartial.Click += BtnCalcPartial_Click;
|
||||||
|
btnCalcHessian.Click += BtnCalcHessian_Click;
|
||||||
|
|
||||||
btnCopyDerivative.Click += (s, e) => {
|
btnCopyLog.Click += (s, e) =>
|
||||||
|
{
|
||||||
if (!string.IsNullOrEmpty(txtResult.Text))
|
if (!string.IsNullOrEmpty(txtResult.Text))
|
||||||
{
|
{
|
||||||
Clipboard.SetText(txtResult.Text);
|
Clipboard.SetText(txtResult.Text);
|
||||||
MessageBox.Show("Türev raporu panoya kopyalandı!", "Bilgi", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
MessageBox.Show("Türev raporu panoya kopyalandı!", "Başarılı", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
btnExSingle1.Click += (s, e) => {
|
btnExSingle1.Click += (s, e) =>
|
||||||
|
{
|
||||||
txtSingleFn.Text = "sin(x) + x^3";
|
txtSingleFn.Text = "sin(x) + x^3";
|
||||||
txtSingleVar.Text = "x";
|
txtSingleVar.Text = "x";
|
||||||
txtSinglePoint.Text = "1";
|
txtSinglePoint.Text = "1";
|
||||||
numSingleDegree.Value = 1;
|
numSingleDegree.Value = 1;
|
||||||
BtnCalcSingle_Click(this, EventArgs.Empty);
|
BtnCalcSingle_Click(this, EventArgs.Empty);
|
||||||
};
|
};
|
||||||
btnExSingle2.Click += (s, e) => {
|
btnExSingle2.Click += (s, e) =>
|
||||||
|
{
|
||||||
txtSingleFn.Text = "exp(2*x)";
|
txtSingleFn.Text = "exp(2*x)";
|
||||||
txtSingleVar.Text = "x";
|
txtSingleVar.Text = "x";
|
||||||
txtSinglePoint.Text = "0";
|
txtSinglePoint.Text = "0";
|
||||||
numSingleDegree.Value = 3;
|
numSingleDegree.Value = 2;
|
||||||
BtnCalcSingle_Click(this, EventArgs.Empty);
|
BtnCalcSingle_Click(this, EventArgs.Empty);
|
||||||
};
|
};
|
||||||
|
|
||||||
btnExPartial1.Click += (s, e) => LoadPartialPreset("x^2*y + sin(y)", "x", 1, new[] { ("x", "2"), ("y", "1") });
|
btnExPartial1.Click += (s, e) => LoadPartialPreset("x^2*y + sin(y)", "x", new[] { ("x", "2"), ("y", "1") });
|
||||||
btnExPartial2.Click += (s, e) => LoadPartialPreset("exp(x*y) + x^3*y^2", "x", 2, new[] { ("x", "1"), ("y", "1") });
|
btnExPartial2.Click += (s, e) => LoadPartialPreset("exp(x*y) + x^3*y^2", "x", new[] { ("x", "1"), ("y", "1") });
|
||||||
|
|
||||||
AddPartialRow("x", "1");
|
AddPartialRow("x", "2");
|
||||||
AddPartialRow("y", "2");
|
AddPartialRow("y", "1");
|
||||||
}
|
}
|
||||||
|
|
||||||
private void LoadPartialPreset(string eq, string targetVar, int degree, (string v, string val)[] vars)
|
private void LoadPartialPreset(string eq, string targetVar, (string v, string val)[] vars)
|
||||||
{
|
{
|
||||||
txtPartialFn.Text = eq;
|
txtPartialFn.Text = eq;
|
||||||
txtTargetVar.Text = targetVar;
|
txtTargetVar.Text = targetVar;
|
||||||
numPartialDegree.Value = degree;
|
|
||||||
pnlPartialVars.Controls.Clear();
|
pnlPartialVars.Controls.Clear();
|
||||||
partialRows.Clear();
|
partialRows.Clear();
|
||||||
foreach (var item in vars)
|
foreach (var item in vars)
|
||||||
|
|
@ -76,6 +90,7 @@ namespace MathApp.Controls
|
||||||
private void AddPartialRow(string varName, string val)
|
private void AddPartialRow(string varName, string val)
|
||||||
{
|
{
|
||||||
VariableInputRow row = new VariableInputRow(varName, val);
|
VariableInputRow row = new VariableInputRow(varName, val);
|
||||||
|
row.Panel.Width = 390;
|
||||||
row.OnRemove += (s, e) =>
|
row.OnRemove += (s, e) =>
|
||||||
{
|
{
|
||||||
pnlPartialVars.Controls.Remove(row.Panel);
|
pnlPartialVars.Controls.Remove(row.Panel);
|
||||||
|
|
@ -85,14 +100,17 @@ namespace MathApp.Controls
|
||||||
partialRows.Add(row);
|
partialRows.Add(row);
|
||||||
}
|
}
|
||||||
|
|
||||||
private decimal ParseDec(string s, string field)
|
private decimal ParseDec(string s, string field, decimal defVal = 0m)
|
||||||
{
|
{
|
||||||
string norm = (s ?? "").Trim().Replace(',', '.');
|
string norm = (s ?? "").Trim().Replace(',', '.');
|
||||||
|
if (string.IsNullOrWhiteSpace(norm)) return defVal;
|
||||||
if (decimal.TryParse(norm, NumberStyles.Any, CultureInfo.InvariantCulture, out decimal v))
|
if (decimal.TryParse(norm, NumberStyles.Any, CultureInfo.InvariantCulture, out decimal v))
|
||||||
return v;
|
return v;
|
||||||
throw new ArgumentException($"'{field}' için geçerli bir sayı giriniz.");
|
throw new ArgumentException($"'{field}' için geçerli bir sayı giriniz.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#region 1. Single Variable Differentiation
|
||||||
|
|
||||||
private async void BtnCalcSingle_Click(object sender, EventArgs e)
|
private async void BtnCalcSingle_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
string origBtnText = btnCalcSingle.Text;
|
string origBtnText = btnCalcSingle.Text;
|
||||||
|
|
@ -103,57 +121,114 @@ namespace MathApp.Controls
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
string eq = txtSingleFn.Text.Trim();
|
string eq = txtSingleFn.Text.Trim();
|
||||||
if (string.IsNullOrWhiteSpace(eq)) return;
|
if (string.IsNullOrWhiteSpace(eq))
|
||||||
|
{
|
||||||
|
MessageBox.Show("Lütfen bir fonksiyon ifadesi giriniz (Örn: sin(x) + x^3).", "Uyarı", MessageBoxButtons.OK, MessageBoxIcon.Warning);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
_lastSingleFn = eq;
|
||||||
string v = string.IsNullOrWhiteSpace(txtSingleVar.Text) ? "x" : txtSingleVar.Text.Trim();
|
string v = string.IsNullOrWhiteSpace(txtSingleVar.Text) ? "x" : txtSingleVar.Text.Trim();
|
||||||
decimal pt = ParseDec(txtSinglePoint.Text, "Nokta (x₀)");
|
decimal pt = ParseDec(txtSinglePoint.Text, "Nokta (x₀)", 1m);
|
||||||
decimal h = ParseDec(txtStepH.Text, "Adım Boyutu (h)");
|
decimal h = ParseDec(txtStepH.Text, "Adım Boyutu (h)", 0.001m);
|
||||||
|
if (h <= 0m) h = 0.001m;
|
||||||
|
|
||||||
int deg = (int)numSingleDegree.Value;
|
int deg = (int)numSingleDegree.Value;
|
||||||
int acc = (cmbAccuracy.SelectedIndex + 1) * 2; // 2, 4, 6
|
int acc = (cmbAccuracy.SelectedIndex + 1) * 2; // 2, 4, 6
|
||||||
|
int formulaIdx = cmbFormula.SelectedIndex; // 0: Central, 1: Forward, 2: Backward
|
||||||
|
|
||||||
string resultText = await Task.Run(() =>
|
_lastX0 = (float)pt;
|
||||||
|
|
||||||
|
await Task.Run(() =>
|
||||||
{
|
{
|
||||||
bool prevRad = Function.UseRadians;
|
bool prevRad = Function.UseRadians;
|
||||||
Function.UseRadians = true;
|
Function.UseRadians = true;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
decimal fVal = NumericalMethods.Method_EvaluateFunction(eq, v, pt);
|
decimal fVal = NumericalMethods.Method_EvaluateFunction(eq, v, pt);
|
||||||
decimal centralMat = NumericalMethods.Method_NumericalDifferentiation(eq, deg, v, pt, acc, h);
|
_lastY0 = (float)fVal;
|
||||||
decimal forwardBin = NumericalMethods.Method_ForwardBinomialDerivative(eq, deg, v, pt, h);
|
|
||||||
decimal backwardDiff = NumericalMethods.Method_BackwardDifferenceDerivative(eq, deg, v, pt, h);
|
|
||||||
|
|
||||||
StringBuilder sb = new StringBuilder();
|
decimal dVal;
|
||||||
sb.AppendLine($"=== TEK DEĞİŞKENLİ NÜMERİK TÜREV ANALİZİ ({deg}. Derece) ===");
|
string methodUsed;
|
||||||
sb.AppendLine($" Fonksiyon : f({v}) = {eq}");
|
if (formulaIdx == 1)
|
||||||
sb.AppendLine($" Değerlendirme : {v}₀ = {pt} => f({pt}) = {Math.Round(fVal, 8).ToString("0.########", CultureInfo.InvariantCulture)}");
|
|
||||||
sb.AppendLine($" Adım Boyutu (h) : {h} | Hassasiyet: O(h^{acc})");
|
|
||||||
sb.AppendLine();
|
|
||||||
sb.AppendLine("--- Farklı Nümerik Yöntemlerin Karşılaştırması ---");
|
|
||||||
sb.AppendLine($" 1) Merkezi Sonlu Farklar Matrisi (Method_NumericalDifferentiation) : {Math.Round(centralMat, 8).ToString("0.########", CultureInfo.InvariantCulture)}");
|
|
||||||
sb.AppendLine($" 2) İleri Binom Sonlu Farklar (Method_Derivative) : {Math.Round(forwardBin, 8).ToString("0.########", CultureInfo.InvariantCulture)}");
|
|
||||||
sb.AppendLine($" 3) Geri Sonlu Farklar Formülü (Method_BackwardDerivative) : {Math.Round(backwardDiff, 8).ToString("0.########", CultureInfo.InvariantCulture)}");
|
|
||||||
sb.AppendLine();
|
|
||||||
sb.AppendLine("--- 1'den 4. Dereceye Kadar Tüm Türev Özeti ---");
|
|
||||||
for (int k = 1; k <= 4; k++)
|
|
||||||
{
|
{
|
||||||
decimal step = k >= 3 ? Math.Max(h, 0.005m) : h;
|
dVal = NumericalMethods.Method_ForwardBinomialDerivative(eq, deg, v, pt, h);
|
||||||
decimal dk = NumericalMethods.Method_NumericalDifferentiation(eq, k, v, pt, acc, step);
|
methodUsed = "İleri Binom Sonlu Farklar Formülü";
|
||||||
sb.AppendLine($" • f^({k})({pt}) = {Math.Round(dk, 6).ToString("0.######", CultureInfo.InvariantCulture)}");
|
}
|
||||||
|
else if (formulaIdx == 2)
|
||||||
|
{
|
||||||
|
dVal = NumericalMethods.Method_BackwardDifferenceDerivative(eq, deg, v, pt, h);
|
||||||
|
methodUsed = "Geri Sonlu Farklar Formülü";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
dVal = NumericalMethods.Method_NumericalDifferentiation(eq, deg, v, pt, acc, h);
|
||||||
|
methodUsed = $"Merkezi Sonlu Farklar Matrisi O(h^{acc})";
|
||||||
}
|
}
|
||||||
|
|
||||||
return sb.ToString();
|
// Calculate First Derivative for Tangent Line
|
||||||
|
decimal mSlope = (deg == 1) ? dVal : NumericalMethods.Method_NumericalDifferentiation(eq, 1, v, pt, acc, h);
|
||||||
|
decimal cIntercept = fVal - mSlope * pt;
|
||||||
|
_lastTangentEq = $"{mSlope:F4}*x + {cIntercept:F4}";
|
||||||
|
|
||||||
|
// Update UI
|
||||||
|
this.Invoke((Action)(() =>
|
||||||
|
{
|
||||||
|
lblKpiTitle.Text = $"TEK DEĞİŞKENLİ TÜREV ANALİZİ [{deg}. Mertebe]";
|
||||||
|
lblKpiValue.Text = $"f^({deg})({pt}) = {dVal:F8}";
|
||||||
|
lblKpiSubtitle.Text = $"Teğet Doğrusu: y = {_lastTangentEq} • f({pt}) = {fVal:F6} • Eğim: {mSlope:F6}";
|
||||||
|
|
||||||
|
StringBuilder sb = new StringBuilder();
|
||||||
|
sb.AppendLine("=======================================================================");
|
||||||
|
sb.AppendLine($" TEK DEĞİŞKENLİ NÜMERİK TÜREV VE TEĞET ANALİZİ ({deg}. Derece)");
|
||||||
|
sb.AppendLine("=======================================================================");
|
||||||
|
sb.AppendLine($" Fonksiyon : f({v}) = {eq}");
|
||||||
|
sb.AppendLine($" Değerlendirme Noktası : {v}₀ = {pt} => f({pt}) = {fVal:G18}");
|
||||||
|
sb.AppendLine($" Seçilen Yöntem : {methodUsed}");
|
||||||
|
sb.AppendLine($" Adım Boyutu (h) : {h} | Hassasiyet Derecesi: O(h^{acc})");
|
||||||
|
sb.AppendLine();
|
||||||
|
sb.AppendLine($" 1. HESAPLANAN {deg}. MERTEBE TÜREV:");
|
||||||
|
sb.AppendLine($" • f^({deg})({pt}) = {dVal:G18}");
|
||||||
|
sb.AppendLine();
|
||||||
|
sb.AppendLine(" 2. TEĞET VE NORMAL DOĞRU DENKLEMLERİ:");
|
||||||
|
sb.AppendLine($" • Teğet Eğimi (m) : m = f'({pt}) = {mSlope:F6}");
|
||||||
|
sb.AppendLine($" • Teğet Doğrusu : y - y₀ = m(x - x₀) => y = {_lastTangentEq}");
|
||||||
|
if (Math.Abs(mSlope) > 0.0001m)
|
||||||
|
{
|
||||||
|
decimal nSlope = -1m / mSlope;
|
||||||
|
decimal nIntercept = fVal - nSlope * pt;
|
||||||
|
sb.AppendLine($" • Normal Doğrusu : y - y₀ = (-1/m)(x - x₀) => y = {nSlope:F4}*x + {nIntercept:F4}");
|
||||||
|
}
|
||||||
|
sb.AppendLine();
|
||||||
|
sb.AppendLine(" 3. YÖNTEMLERİN KARŞILAŞTIRMASI:");
|
||||||
|
decimal cMat = NumericalMethods.Method_NumericalDifferentiation(eq, deg, v, pt, acc, h);
|
||||||
|
decimal fBin = NumericalMethods.Method_ForwardBinomialDerivative(eq, deg, v, pt, h);
|
||||||
|
decimal bDiff = NumericalMethods.Method_BackwardDifferenceDerivative(eq, deg, v, pt, h);
|
||||||
|
sb.AppendLine($" • Merkezi Farklar (Central) : {cMat:G16}");
|
||||||
|
sb.AppendLine($" • İleri Farklar (Forward) : {fBin:G16}");
|
||||||
|
sb.AppendLine($" • Geri Farklar (Backward) : {bDiff:G16}");
|
||||||
|
sb.AppendLine();
|
||||||
|
sb.AppendLine(" 4. TÜM MERTEBELER ÖZETİ (1'den 4'e kadar):");
|
||||||
|
for (int k = 1; k <= 4; k++)
|
||||||
|
{
|
||||||
|
decimal dk = NumericalMethods.Method_NumericalDifferentiation(eq, k, v, pt, acc, (k >= 3 ? Math.Max(h, 0.005m) : h));
|
||||||
|
sb.AppendLine($" • f^({k})({pt}) = {dk:G14}");
|
||||||
|
}
|
||||||
|
|
||||||
|
txtSummaryView.Text = sb.ToString();
|
||||||
|
txtResult.Text = sb.ToString();
|
||||||
|
tabResults.SelectedTab = tabSummary;
|
||||||
|
}));
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
Function.UseRadians = prevRad;
|
Function.UseRadians = prevRad;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
txtResult.Text = resultText;
|
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
txtResult.Text = "❌ Hata: " + ex.Message;
|
MessageBox.Show("Türev hesaplama hatası:\n" + ex.Message, "Hata", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
|
|
@ -163,6 +238,25 @@ namespace MathApp.Controls
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void BtnPlotTangent_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (string.IsNullOrWhiteSpace(_lastSingleFn))
|
||||||
|
{
|
||||||
|
MessageBox.Show("Önce tek değişkenli türev hesabı yapınız.", "Bilgi", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
MainForm.Instance?.NavigateToGraph(_lastSingleFn, _lastX0, _lastY0);
|
||||||
|
if (!string.IsNullOrWhiteSpace(_lastTangentEq))
|
||||||
|
{
|
||||||
|
MainForm.Instance?.NavigateToGraph(_lastTangentEq);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region 2. Multivariable Analysis, Gradient & Directional Derivative
|
||||||
|
|
||||||
private async void BtnCalcPartial_Click(object sender, EventArgs e)
|
private async void BtnCalcPartial_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
string origBtnText = btnCalcPartial.Text;
|
string origBtnText = btnCalcPartial.Text;
|
||||||
|
|
@ -176,8 +270,7 @@ namespace MathApp.Controls
|
||||||
if (string.IsNullOrWhiteSpace(eq)) return;
|
if (string.IsNullOrWhiteSpace(eq)) return;
|
||||||
|
|
||||||
string targetVar = txtTargetVar.Text.Trim();
|
string targetVar = txtTargetVar.Text.Trim();
|
||||||
int deg = (int)numPartialDegree.Value;
|
decimal h = ParseDec(txtStepH.Text, "Adım Boyutu (h)", 0.001m);
|
||||||
decimal h = ParseDec(txtStepH.Text, "Adım Boyutu (h)");
|
|
||||||
int acc = (cmbAccuracy.SelectedIndex + 1) * 2;
|
int acc = (cmbAccuracy.SelectedIndex + 1) * 2;
|
||||||
|
|
||||||
Dictionary<string, decimal> pts = new Dictionary<string, decimal>();
|
Dictionary<string, decimal> pts = new Dictionary<string, decimal>();
|
||||||
|
|
@ -189,54 +282,107 @@ namespace MathApp.Controls
|
||||||
|
|
||||||
if (!pts.ContainsKey(targetVar))
|
if (!pts.ContainsKey(targetVar))
|
||||||
{
|
{
|
||||||
txtResult.Text = $"⚠️ Hedef değişken '{targetVar}', değişken listesinde tanımlı olmalıdır.";
|
MessageBox.Show($"Hedef türev değişkeni '{targetVar}', değişken listesinde tanımlı olmalıdır.", "Uyarı", MessageBoxButtons.OK, MessageBoxIcon.Warning);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
string resultText = await Task.Run(() =>
|
// Direction vector parsing
|
||||||
|
string dirRaw = txtDirectionVector.Text.Trim();
|
||||||
|
List<decimal> uVec = new List<decimal>();
|
||||||
|
if (!string.IsNullOrWhiteSpace(dirRaw))
|
||||||
|
{
|
||||||
|
var tokens = dirRaw.Split(new[] { ',', ';', ' ' }, StringSplitOptions.RemoveEmptyEntries);
|
||||||
|
foreach (var tok in tokens)
|
||||||
|
{
|
||||||
|
if (decimal.TryParse(tok.Replace(',', '.'), NumberStyles.Any, CultureInfo.InvariantCulture, out decimal uVal))
|
||||||
|
uVec.Add(uVal);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
await Task.Run(() =>
|
||||||
{
|
{
|
||||||
bool prevRad = Function.UseRadians;
|
bool prevRad = Function.UseRadians;
|
||||||
Function.UseRadians = true;
|
Function.UseRadians = true;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
decimal fVal = NumericalMethods.MethodMultiVar_EvaluateFunction(eq, pts);
|
decimal fVal = NumericalMethods.MethodMultiVar_EvaluateFunction(eq, pts);
|
||||||
decimal partialMat = NumericalMethods.Method_NumericalPartialDifferentiation(eq, deg, targetVar, pts, acc, h);
|
decimal partialVal = NumericalMethods.Method_NumericalPartialDifferentiation(eq, 1, targetVar, pts, acc, h);
|
||||||
decimal partialBin = NumericalMethods.Method_ForwardBinomialPartialDerivative(eq, deg, targetVar, pts, h);
|
|
||||||
|
|
||||||
StringBuilder sb = new StringBuilder();
|
// Gradient Vector
|
||||||
string ptStr = string.Join(", ", pts.Select(kv => $"{kv.Key}={kv.Value}"));
|
Dictionary<string, decimal> gradient = new Dictionary<string, decimal>();
|
||||||
sb.AppendLine($"=== KISMİ TÜREV VE GRADYAN ANALİZİ (∂^{deg}f / ∂{targetVar}^{deg}) ===");
|
|
||||||
sb.AppendLine($" Fonksiyon : f({string.Join(",", pts.Keys)}) = {eq}");
|
|
||||||
sb.AppendLine($" Nokta : ({ptStr}) => f = {Math.Round(fVal, 8).ToString("0.########", CultureInfo.InvariantCulture)}");
|
|
||||||
sb.AppendLine();
|
|
||||||
sb.AppendLine($"--- '{targetVar}' Değişkenine Göre {deg}. Derece Kısmi Türev ---");
|
|
||||||
sb.AppendLine($" • Merkezi Matris Yöntemi (Method_NumericalPartialDifferentiation) : {Math.Round(partialMat, 8).ToString("0.########", CultureInfo.InvariantCulture)}");
|
|
||||||
sb.AppendLine($" • İleri Binom Yöntemi (Method_PartialDerivative) : {Math.Round(partialBin, 8).ToString("0.########", CultureInfo.InvariantCulture)}");
|
|
||||||
sb.AppendLine();
|
|
||||||
sb.AppendLine("--- Noktadaki Gradyan Vektörü (∇f) ---");
|
|
||||||
List<string> gradParts = new List<string>();
|
|
||||||
foreach (string vName in pts.Keys)
|
foreach (string vName in pts.Keys)
|
||||||
{
|
{
|
||||||
decimal df = NumericalMethods.Method_NumericalPartialDifferentiation(eq, 1, vName, pts, acc, h);
|
decimal df = NumericalMethods.Method_NumericalPartialDifferentiation(eq, 1, vName, pts, acc, h);
|
||||||
decimal rDf = Math.Round(df, 6);
|
gradient[vName] = df;
|
||||||
gradParts.Add(rDf.ToString("0.######", CultureInfo.InvariantCulture));
|
|
||||||
sb.AppendLine($" • ∂f / ∂{vName} = {rDf.ToString("0.######", CultureInfo.InvariantCulture)}");
|
|
||||||
}
|
}
|
||||||
sb.AppendLine($" ∇f({ptStr}) = [ {string.Join(", ", gradParts)} ]");
|
|
||||||
|
|
||||||
return sb.ToString();
|
// Directional Derivative
|
||||||
|
decimal? dirDeriv = null;
|
||||||
|
if (uVec.Count == pts.Count)
|
||||||
|
{
|
||||||
|
decimal normSq = uVec.Sum(u => u * u);
|
||||||
|
if (normSq > 0m)
|
||||||
|
{
|
||||||
|
decimal norm = DecimalMath.Sqrt(normSq);
|
||||||
|
decimal sum = 0m;
|
||||||
|
int idx = 0;
|
||||||
|
foreach (var kv in gradient)
|
||||||
|
{
|
||||||
|
sum += kv.Value * (uVec[idx] / norm);
|
||||||
|
idx++;
|
||||||
|
}
|
||||||
|
dirDeriv = sum;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
this.Invoke((Action)(() =>
|
||||||
|
{
|
||||||
|
string gradStr = string.Join(", ", gradient.Select(kv => $"{kv.Value:F4}"));
|
||||||
|
lblKpiTitle.Text = $"GRADYAN VEKTÖRÜ ∇f({string.Join(",", pts.Keys)})";
|
||||||
|
lblKpiValue.Text = $"∇f = [ {gradStr} ]";
|
||||||
|
lblKpiSubtitle.Text = $"∂f/∂{targetVar} = {partialVal:F6} • f({string.Join(",", pts.Values.Select(v => v.ToString("G4")))}) = {fVal:F6}";
|
||||||
|
|
||||||
|
StringBuilder sb = new StringBuilder();
|
||||||
|
sb.AppendLine("=======================================================================");
|
||||||
|
sb.AppendLine(" ÇOK DEĞİŞKENLİ KISMİ TÜREV, GRADYAN VE YÖNLÜ TÜREV RAPORU");
|
||||||
|
sb.AppendLine("=======================================================================");
|
||||||
|
sb.AppendLine($" Fonksiyon : f({string.Join(", ", pts.Keys)}) = {eq}");
|
||||||
|
sb.AppendLine($" Nokta : ({string.Join(", ", pts.Select(kv => $"{kv.Key} = {kv.Value}"))}) => f = {fVal:G18}");
|
||||||
|
sb.AppendLine($" Adım (h) : {h} | Doğruluk: O(h^{acc})");
|
||||||
|
sb.AppendLine();
|
||||||
|
sb.AppendLine($" 1. '{targetVar}' DEĞİŞKENİNE GÖRE 1. MERTEBE KISMİ TÜREV:");
|
||||||
|
sb.AppendLine($" • ∂f / ∂{targetVar} = {partialVal:G18}");
|
||||||
|
sb.AppendLine();
|
||||||
|
sb.AppendLine(" 2. NOKTADAKİ GRADYAN VEKTÖRÜ (∇f):");
|
||||||
|
foreach (var kv in gradient)
|
||||||
|
{
|
||||||
|
sb.AppendLine($" • ∂f / ∂{kv.Key,-6} = {kv.Value:F8}");
|
||||||
|
}
|
||||||
|
sb.AppendLine($" ∇f = [ {gradStr} ]ᵀ");
|
||||||
|
sb.AppendLine($" |∇f| (Büyüklük/Maksimum Artış Eğimi) = {Math.Sqrt((double)gradient.Sum(kv => kv.Value * kv.Value)):F8}");
|
||||||
|
sb.AppendLine();
|
||||||
|
|
||||||
|
if (dirDeriv.HasValue)
|
||||||
|
{
|
||||||
|
sb.AppendLine(" 3. YÖNLÜ TÜREV (Directional Derivative - D_u f):");
|
||||||
|
sb.AppendLine($" • Birim Yön Vektörü (u) : [ {string.Join(", ", uVec.Select(u => u.ToString("F3")))} ]");
|
||||||
|
sb.AppendLine($" • D_u f = ∇f · u = {dirDeriv.Value:G18}");
|
||||||
|
}
|
||||||
|
|
||||||
|
txtSummaryView.Text = sb.ToString();
|
||||||
|
txtResult.Text = sb.ToString();
|
||||||
|
tabResults.SelectedTab = tabSummary;
|
||||||
|
}));
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
Function.UseRadians = prevRad;
|
Function.UseRadians = prevRad;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
txtResult.Text = resultText;
|
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
txtResult.Text = "❌ Hata: " + ex.Message;
|
MessageBox.Show("Kısmi türev hatası:\n" + ex.Message, "Hata", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
|
|
@ -245,5 +391,164 @@ namespace MathApp.Controls
|
||||||
Cursor = Cursors.Default;
|
Cursor = Cursors.Default;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region 3. Hessian Matrix & Local Extremum Test
|
||||||
|
|
||||||
|
private async void BtnCalcHessian_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
string origBtnText = btnCalcHessian.Text;
|
||||||
|
btnCalcHessian.Enabled = false;
|
||||||
|
btnCalcHessian.Text = "⏳ Hesaplanıyor...";
|
||||||
|
Cursor = Cursors.WaitCursor;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
string eq = txtPartialFn.Text.Trim();
|
||||||
|
if (string.IsNullOrWhiteSpace(eq)) return;
|
||||||
|
|
||||||
|
decimal h = ParseDec(txtStepH.Text, "Adım Boyutu (h)", 0.001m);
|
||||||
|
int acc = (cmbAccuracy.SelectedIndex + 1) * 2;
|
||||||
|
|
||||||
|
Dictionary<string, decimal> pts = new Dictionary<string, decimal>();
|
||||||
|
foreach (var row in partialRows)
|
||||||
|
{
|
||||||
|
if (string.IsNullOrWhiteSpace(row.Variable)) continue;
|
||||||
|
pts[row.Variable] = ParseDec(row.Value, row.Variable);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (pts.Count < 2)
|
||||||
|
{
|
||||||
|
MessageBox.Show("Hessian matrisi için en az 2 değişken tanımlanmalıdır (Örn: x ve y).", "Uyarı", MessageBoxButtons.OK, MessageBoxIcon.Warning);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
List<string> varNames = pts.Keys.ToList();
|
||||||
|
int n = varNames.Count;
|
||||||
|
decimal[,] hessian = new decimal[n, n];
|
||||||
|
|
||||||
|
await Task.Run(() =>
|
||||||
|
{
|
||||||
|
bool prevRad = Function.UseRadians;
|
||||||
|
Function.UseRadians = true;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
for (int i = 0; i < n; i++)
|
||||||
|
{
|
||||||
|
for (int j = 0; j < n; j++)
|
||||||
|
{
|
||||||
|
string vi = varNames[i];
|
||||||
|
string vj = varNames[j];
|
||||||
|
|
||||||
|
if (i == j)
|
||||||
|
{
|
||||||
|
// Second partial derivative ∂²f / ∂vi²
|
||||||
|
hessian[i, j] = NumericalMethods.Method_NumericalPartialDifferentiation(eq, 2, vi, pts, acc, h);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Mixed partial derivative ∂²f / ∂vi∂vj via Central Difference:
|
||||||
|
// [f(vi+h, vj+h) - f(vi+h, vj-h) - f(vi-h, vj+h) + f(vi-h, vj-h)] / (4h²)
|
||||||
|
var pPlusPlus = new Dictionary<string, decimal>(pts);
|
||||||
|
var pPlusMinus = new Dictionary<string, decimal>(pts);
|
||||||
|
var pMinusPlus = new Dictionary<string, decimal>(pts);
|
||||||
|
var pMinusMinus = new Dictionary<string, decimal>(pts);
|
||||||
|
|
||||||
|
pPlusPlus[vi] += h; pPlusPlus[vj] += h;
|
||||||
|
pPlusMinus[vi] += h; pPlusMinus[vj] -= h;
|
||||||
|
pMinusPlus[vi] -= h; pMinusPlus[vj] += h;
|
||||||
|
pMinusMinus[vi] -= h; pMinusMinus[vj] -= h;
|
||||||
|
|
||||||
|
decimal fPP = NumericalMethods.MethodMultiVar_EvaluateFunction(eq, pPlusPlus);
|
||||||
|
decimal fPM = NumericalMethods.MethodMultiVar_EvaluateFunction(eq, pPlusMinus);
|
||||||
|
decimal fMP = NumericalMethods.MethodMultiVar_EvaluateFunction(eq, pMinusPlus);
|
||||||
|
decimal fMM = NumericalMethods.MethodMultiVar_EvaluateFunction(eq, pMinusMinus);
|
||||||
|
|
||||||
|
decimal mixed = (fPP - fPM - fMP + fMM) / (4m * h * h);
|
||||||
|
hessian[i, j] = mixed;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
this.Invoke((Action)(() =>
|
||||||
|
{
|
||||||
|
// Populate DataGridView
|
||||||
|
dgvHessian.Columns.Clear();
|
||||||
|
dgvHessian.Rows.Clear();
|
||||||
|
|
||||||
|
for (int j = 0; j < n; j++)
|
||||||
|
{
|
||||||
|
dgvHessian.Columns.Add($"col_{varNames[j]}", $"∂ / ∂{varNames[j]}");
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int i = 0; i < n; i++)
|
||||||
|
{
|
||||||
|
object[] rowValues = new object[n];
|
||||||
|
for (int j = 0; j < n; j++)
|
||||||
|
{
|
||||||
|
rowValues[j] = hessian[i, j].ToString("F6", CultureInfo.InvariantCulture);
|
||||||
|
}
|
||||||
|
int rIdx = dgvHessian.Rows.Add(rowValues);
|
||||||
|
dgvHessian.Rows[rIdx].HeaderCell.Value = $"∂ / ∂{varNames[i]}";
|
||||||
|
}
|
||||||
|
|
||||||
|
// 2x2 Extremum Test
|
||||||
|
if (n == 2)
|
||||||
|
{
|
||||||
|
decimal fxx = hessian[0, 0];
|
||||||
|
decimal fyy = hessian[1, 1];
|
||||||
|
decimal fxy = hessian[0, 1];
|
||||||
|
decimal detH = fxx * fyy - (fxy * fxy);
|
||||||
|
|
||||||
|
if (detH > 0m && fxx > 0m)
|
||||||
|
{
|
||||||
|
lblHessianAnalysis.Text = $"✓ D = {detH:F6} > 0 ve f_xx > 0 => Bu nokta YEREL MİNİMUM noktasıdır.";
|
||||||
|
lblHessianAnalysis.ForeColor = Color.FromArgb(52, 211, 153); // Emerald
|
||||||
|
}
|
||||||
|
else if (detH > 0m && fxx < 0m)
|
||||||
|
{
|
||||||
|
lblHessianAnalysis.Text = $"✓ D = {detH:F6} > 0 ve f_xx < 0 => Bu nokta YEREL MAKSİMUM noktasıdır.";
|
||||||
|
lblHessianAnalysis.ForeColor = Color.FromArgb(56, 189, 248); // Sky Blue
|
||||||
|
}
|
||||||
|
else if (detH < 0m)
|
||||||
|
{
|
||||||
|
lblHessianAnalysis.Text = $"⚠️ D = {detH:F6} < 0 => Bu nokta bir EYER NOKTASIDIR (Saddle Point).";
|
||||||
|
lblHessianAnalysis.ForeColor = Color.FromArgb(244, 63, 94); // Rose
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
lblHessianAnalysis.Text = $"❓ D = {detH:F6} = 0 => İkinci türev testi belirsizdir.";
|
||||||
|
lblHessianAnalysis.ForeColor = Color.FromArgb(245, 158, 11); // Amber
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
lblHessianAnalysis.Text = $"{n}×{n} Simetrik Hessian Matrisi başarıyla hesaplandı.";
|
||||||
|
lblHessianAnalysis.ForeColor = Color.FromArgb(168, 85, 247);
|
||||||
|
}
|
||||||
|
|
||||||
|
tabResults.SelectedTab = tabHessian;
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
Function.UseRadians = prevRad;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
MessageBox.Show("Hessian hesaplama hatası:\n" + ex.Message, "Hata", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
btnCalcHessian.Enabled = true;
|
||||||
|
btnCalcHessian.Text = origBtnText;
|
||||||
|
Cursor = Cursors.Default;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -469,6 +469,21 @@ namespace MathApp.Controls
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void AddMarkedPoint(float x, float y, string pointType = "Serbest", Color? color = null)
|
||||||
|
{
|
||||||
|
_points.Add(new PlotPoint
|
||||||
|
{
|
||||||
|
X = x,
|
||||||
|
Y = y,
|
||||||
|
Color = color ?? Color.FromArgb(16, 185, 129),
|
||||||
|
Shape = PointShape.Circle,
|
||||||
|
Size = 10,
|
||||||
|
PointType = pointType
|
||||||
|
});
|
||||||
|
RefreshPointsList();
|
||||||
|
pnlCanvas.Invalidate();
|
||||||
|
}
|
||||||
|
|
||||||
public void AddVerticalLine(float x, float minY, float maxY, Color color, DashStyle dash = DashStyle.Solid, float thickness = 2f)
|
public void AddVerticalLine(float x, float minY, float maxY, Color color, DashStyle dash = DashStyle.Solid, float thickness = 2f)
|
||||||
{
|
{
|
||||||
var curve = new PlotCurve
|
var curve = new PlotCurve
|
||||||
|
|
|
||||||
340
src/ttCalculator/Controls/RootFinderControl.Designer.cs
generated
340
src/ttCalculator/Controls/RootFinderControl.Designer.cs
generated
|
|
@ -7,6 +7,59 @@ namespace MathApp.Controls
|
||||||
{
|
{
|
||||||
private System.ComponentModel.IContainer components = null;
|
private System.ComponentModel.IContainer components = null;
|
||||||
|
|
||||||
|
private Panel pnlHeader;
|
||||||
|
private Panel pnlContent;
|
||||||
|
private FlowLayoutPanel pnlPresets;
|
||||||
|
private Label lblPresets;
|
||||||
|
private Button btnEx1;
|
||||||
|
private Button btnEx2;
|
||||||
|
private Button btnEx3;
|
||||||
|
|
||||||
|
private Panel pnlInputsCard;
|
||||||
|
private Label lblMethod;
|
||||||
|
private ComboBox cmbMethod;
|
||||||
|
private Label lblMethodDesc;
|
||||||
|
|
||||||
|
private Label lblEquation;
|
||||||
|
private TextBox txtEquation;
|
||||||
|
private Label lblVariable;
|
||||||
|
private TextBox txtVariable;
|
||||||
|
|
||||||
|
private Label lblInitialPoint;
|
||||||
|
private TextBox txtInitialPoint;
|
||||||
|
private Label lblMinX;
|
||||||
|
private TextBox txtMinX;
|
||||||
|
private Label lblMaxX;
|
||||||
|
private TextBox txtMaxX;
|
||||||
|
|
||||||
|
private Label lblTolerance;
|
||||||
|
private TextBox txtTolerance;
|
||||||
|
private Label lblIterations;
|
||||||
|
private TextBox txtIterations;
|
||||||
|
private Button btnFindRoot;
|
||||||
|
|
||||||
|
// Vurgulu Sonuç Kartı (KPI Card)
|
||||||
|
private Panel pnlSummary;
|
||||||
|
private Label lblRootSummaryTitle;
|
||||||
|
private Label lblRootValue;
|
||||||
|
private Label lblRootDetails;
|
||||||
|
private FlowLayoutPanel pnlBadges;
|
||||||
|
private Label lblBadgeIter;
|
||||||
|
private Label lblBadgeError;
|
||||||
|
private Label lblBadgeStatus;
|
||||||
|
private Button btnPlotOnGraph;
|
||||||
|
private Button btnCopyResult;
|
||||||
|
|
||||||
|
// Split / Tabbed View for Results
|
||||||
|
private TabControl tabResults;
|
||||||
|
private TabPage tabGrid;
|
||||||
|
private TabPage tabPlot;
|
||||||
|
private TabPage tabText;
|
||||||
|
|
||||||
|
private DataGridView dgvIterations;
|
||||||
|
private Panel pnlConvergencePlot;
|
||||||
|
private TextBox txtResult;
|
||||||
|
|
||||||
protected override void Dispose(bool disposing)
|
protected override void Dispose(bool disposing)
|
||||||
{
|
{
|
||||||
if (disposing && (components != null)) components.Dispose();
|
if (disposing && (components != null)) components.Dispose();
|
||||||
|
|
@ -17,7 +70,7 @@ namespace MathApp.Controls
|
||||||
{
|
{
|
||||||
this.pnlHeader = ThemeHelper.CreateHeaderPanel(
|
this.pnlHeader = ThemeHelper.CreateHeaderPanel(
|
||||||
"Denklem Kökü Bulucu (Root Finder)",
|
"Denklem Kökü Bulucu (Root Finder)",
|
||||||
"Newton-Raphson, Bisection, Secant ve Regula Falsi algoritmaları ile yüksek hassasiyetli sayısal kök bulma.");
|
"Newton-Raphson, Bisection, Secant, Regula Falsi ve Çoklu Kök Taraması ile yüksek hassasiyetli sayısal analiz.");
|
||||||
|
|
||||||
this.pnlContent = new Panel();
|
this.pnlContent = new Panel();
|
||||||
this.pnlPresets = new FlowLayoutPanel();
|
this.pnlPresets = new FlowLayoutPanel();
|
||||||
|
|
@ -43,40 +96,59 @@ namespace MathApp.Controls
|
||||||
this.lblMaxX = new Label();
|
this.lblMaxX = new Label();
|
||||||
this.txtMaxX = new TextBox();
|
this.txtMaxX = new TextBox();
|
||||||
|
|
||||||
|
this.lblTolerance = new Label();
|
||||||
|
this.txtTolerance = new TextBox();
|
||||||
this.lblIterations = new Label();
|
this.lblIterations = new Label();
|
||||||
this.txtIterations = new TextBox();
|
this.txtIterations = new TextBox();
|
||||||
this.btnFindRoot = ThemeHelper.CreateActionButton("🔍 Kökü Hesapla", 180, 36, true);
|
this.btnFindRoot = ThemeHelper.CreateActionButton("🔍 Kökü Hesapla", 180, 34, true);
|
||||||
|
|
||||||
// Hero Summary Card
|
// KPI Result Card
|
||||||
this.pnlSummary = new Panel();
|
this.pnlSummary = new Panel();
|
||||||
this.lblRootSummaryTitle = new Label();
|
this.lblRootSummaryTitle = new Label();
|
||||||
this.lblRootValue = new Label();
|
this.lblRootValue = new Label();
|
||||||
this.lblRootDetails = new Label();
|
this.lblRootDetails = new Label();
|
||||||
|
this.pnlBadges = new FlowLayoutPanel();
|
||||||
|
this.lblBadgeIter = new Label();
|
||||||
|
this.lblBadgeError = new Label();
|
||||||
|
this.lblBadgeStatus = new Label();
|
||||||
|
this.btnPlotOnGraph = new Button();
|
||||||
this.btnCopyResult = ThemeHelper.CreateCopyButton("📋 Kopyala");
|
this.btnCopyResult = ThemeHelper.CreateCopyButton("📋 Kopyala");
|
||||||
|
|
||||||
// Results details
|
// Tabbed Area
|
||||||
this.lblLogTitle = new Label();
|
this.tabResults = new TabControl();
|
||||||
|
this.tabGrid = new TabPage();
|
||||||
|
this.tabPlot = new TabPage();
|
||||||
|
this.tabText = new TabPage();
|
||||||
|
|
||||||
|
this.dgvIterations = new DataGridView();
|
||||||
|
this.pnlConvergencePlot = new Panel();
|
||||||
this.txtResult = new TextBox();
|
this.txtResult = new TextBox();
|
||||||
|
|
||||||
this.pnlContent.SuspendLayout();
|
this.pnlContent.SuspendLayout();
|
||||||
this.pnlInputsCard.SuspendLayout();
|
this.pnlInputsCard.SuspendLayout();
|
||||||
this.pnlSummary.SuspendLayout();
|
this.pnlSummary.SuspendLayout();
|
||||||
|
this.pnlBadges.SuspendLayout();
|
||||||
|
this.tabResults.SuspendLayout();
|
||||||
|
this.tabGrid.SuspendLayout();
|
||||||
|
this.tabPlot.SuspendLayout();
|
||||||
|
this.tabText.SuspendLayout();
|
||||||
|
((System.ComponentModel.ISupportInitialize)(this.dgvIterations)).BeginInit();
|
||||||
this.SuspendLayout();
|
this.SuspendLayout();
|
||||||
|
|
||||||
this.pnlContent.Dock = DockStyle.Fill;
|
this.pnlContent.Dock = DockStyle.Fill;
|
||||||
this.pnlContent.BackColor = ThemeHelper.DarkBackground;
|
this.pnlContent.BackColor = ThemeHelper.DarkBackground;
|
||||||
this.pnlContent.Padding = new Padding(24, 14, 24, 20);
|
this.pnlContent.Padding = new Padding(20, 10, 20, 16);
|
||||||
this.pnlContent.AutoScroll = true;
|
this.pnlContent.AutoScroll = true;
|
||||||
|
|
||||||
// Presets row
|
// Presets row
|
||||||
this.lblPresets.Text = "⚡ Hızlı Örnekler:";
|
this.lblPresets.Text = "⚡ Hızlı Örnekler:";
|
||||||
this.lblPresets.AutoSize = true;
|
this.lblPresets.AutoSize = true;
|
||||||
this.lblPresets.ForeColor = ThemeHelper.MutedText;
|
this.lblPresets.ForeColor = ThemeHelper.MutedText;
|
||||||
this.lblPresets.Font = new Font("Segoe UI Semibold", 9.5F, FontStyle.Bold);
|
this.lblPresets.Font = new Font("Segoe UI Semibold", 9F, FontStyle.Bold);
|
||||||
this.lblPresets.Margin = new Padding(0, 5, 8, 0);
|
this.lblPresets.Margin = new Padding(0, 5, 8, 0);
|
||||||
|
|
||||||
this.pnlPresets.Location = new Point(24, 12);
|
this.pnlPresets.Location = new Point(20, 8);
|
||||||
this.pnlPresets.Size = new Size(860, 34);
|
this.pnlPresets.Size = new Size(870, 32);
|
||||||
this.pnlPresets.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
|
this.pnlPresets.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
|
||||||
this.pnlPresets.Controls.Add(this.lblPresets);
|
this.pnlPresets.Controls.Add(this.lblPresets);
|
||||||
this.pnlPresets.Controls.Add(this.btnEx1);
|
this.pnlPresets.Controls.Add(this.btnEx1);
|
||||||
|
|
@ -84,18 +156,18 @@ namespace MathApp.Controls
|
||||||
this.pnlPresets.Controls.Add(this.btnEx3);
|
this.pnlPresets.Controls.Add(this.btnEx3);
|
||||||
|
|
||||||
// Inputs Card
|
// Inputs Card
|
||||||
this.pnlInputsCard.Location = new Point(24, 52);
|
this.pnlInputsCard.Location = new Point(20, 44);
|
||||||
this.pnlInputsCard.Size = new Size(860, 166);
|
this.pnlInputsCard.Size = new Size(870, 175);
|
||||||
this.pnlInputsCard.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
|
this.pnlInputsCard.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
|
||||||
this.pnlInputsCard.BackColor = ThemeHelper.CardBackground;
|
this.pnlInputsCard.BackColor = ThemeHelper.CardBackground;
|
||||||
this.pnlInputsCard.Padding = new Padding(16, 12, 16, 12);
|
this.pnlInputsCard.Padding = new Padding(14, 10, 14, 10);
|
||||||
|
|
||||||
void StyleLabel(Label l, string text, Point loc)
|
void StyleLabel(Label l, string text, Point loc)
|
||||||
{
|
{
|
||||||
l.Text = text;
|
l.Text = text;
|
||||||
l.Location = loc;
|
l.Location = loc;
|
||||||
l.AutoSize = true;
|
l.AutoSize = true;
|
||||||
l.Font = new Font("Segoe UI", 9.5F, FontStyle.Regular);
|
l.Font = new Font("Segoe UI", 9F, FontStyle.Regular);
|
||||||
l.ForeColor = ThemeHelper.LightText;
|
l.ForeColor = ThemeHelper.LightText;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -106,57 +178,59 @@ namespace MathApp.Controls
|
||||||
t.BackColor = Color.FromArgb(15, 23, 42);
|
t.BackColor = Color.FromArgb(15, 23, 42);
|
||||||
t.BorderStyle = BorderStyle.FixedSingle;
|
t.BorderStyle = BorderStyle.FixedSingle;
|
||||||
t.ForeColor = Color.White;
|
t.ForeColor = Color.White;
|
||||||
t.Font = new Font("Consolas", 10.5F);
|
t.Font = new Font("Consolas", 10F);
|
||||||
t.Text = def;
|
t.Text = def;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Method Selector
|
// Method Selector
|
||||||
StyleLabel(this.lblMethod, "Nümerik Yöntem:", new Point(14, 15));
|
StyleLabel(this.lblMethod, "Nümerik Yöntem:", new Point(14, 14));
|
||||||
this.cmbMethod.FormattingEnabled = true;
|
this.cmbMethod.FormattingEnabled = true;
|
||||||
this.cmbMethod.Items.AddRange(new object[] {
|
this.cmbMethod.Items.AddRange(new object[] {
|
||||||
"Newton-Raphson (Türev Tabanlı — En Hızlı Yakınsama)",
|
"Newton-Raphson (Türev Tabanlı — Kuadratik Yakınsama)",
|
||||||
"Bisection (İkiye Bölme — Garantili Aralık Yakınsaması)",
|
"Bisection (İkiye Bölme — Garantili Aralık Kısıtlama)",
|
||||||
"Secant (Kiriş Yöntemi — Türev Gerektirmeyen Yaklaşım)",
|
"Secant (Kiriş Yöntemi — Türevsiz İki Noktalı Yaklaşım)",
|
||||||
"Regula Falsi (Doğrusal İnterpolasyon ile Kök Bulma)",
|
"Regula Falsi (Doğrusal İnterpolasyon ile Kök Bulma)",
|
||||||
"🎯 Tüm Kökleri Bul (Otomatik Çoklu Kök Taraması [a, b])"
|
"🎯 Tüm Kökleri Bul (Otomatik Çoklu Kök Taraması [a, b])"
|
||||||
});
|
});
|
||||||
this.cmbMethod.Location = new Point(140, 12);
|
this.cmbMethod.Location = new Point(140, 11);
|
||||||
this.cmbMethod.Size = new Size(440, 26);
|
this.cmbMethod.Size = new Size(420, 25);
|
||||||
this.cmbMethod.Font = new Font("Segoe UI", 9.5F);
|
this.cmbMethod.Font = new Font("Segoe UI", 9F);
|
||||||
this.cmbMethod.BackColor = Color.FromArgb(15, 23, 42);
|
this.cmbMethod.BackColor = Color.FromArgb(15, 23, 42);
|
||||||
this.cmbMethod.ForeColor = Color.White;
|
this.cmbMethod.ForeColor = Color.White;
|
||||||
this.cmbMethod.DropDownStyle = ComboBoxStyle.DropDownList;
|
this.cmbMethod.DropDownStyle = ComboBoxStyle.DropDownList;
|
||||||
|
|
||||||
// Method description hint
|
this.lblMethodDesc.Location = new Point(140, 39);
|
||||||
this.lblMethodDesc.Location = new Point(140, 42);
|
this.lblMethodDesc.Size = new Size(710, 18);
|
||||||
this.lblMethodDesc.Size = new Size(700, 18);
|
this.lblMethodDesc.Font = new Font("Segoe UI", 8.25F);
|
||||||
this.lblMethodDesc.Font = new Font("Segoe UI", 8.5F);
|
this.lblMethodDesc.ForeColor = Color.FromArgb(56, 189, 248);
|
||||||
this.lblMethodDesc.ForeColor = Color.FromArgb(125, 211, 252);
|
|
||||||
this.lblMethodDesc.Text = "💡 Fonksiyonun analitik türevi ile teğet çizerek hızlıca köke ulaşır. Tek bir başlangıç (x₀) yeterlidir.";
|
this.lblMethodDesc.Text = "💡 Fonksiyonun analitik türevi ile teğet çizerek hızlıca köke ulaşır. Tek bir başlangıç (x₀) yeterlidir.";
|
||||||
|
|
||||||
// Equation & Variable
|
// Equation & Variable
|
||||||
StyleLabel(this.lblEquation, "Denklem f(x) = 0:", new Point(14, 69));
|
StyleLabel(this.lblEquation, "Denklem f(x) = 0:", new Point(14, 66));
|
||||||
StyleInput(this.txtEquation, "x^3 - x - 2", new Point(140, 66), new Size(340, 26));
|
StyleInput(this.txtEquation, "x^3 - x - 2", new Point(140, 63), new Size(320, 25));
|
||||||
|
|
||||||
StyleLabel(this.lblVariable, "Değişken:", new Point(495, 69));
|
StyleLabel(this.lblVariable, "Değişken:", new Point(475, 66));
|
||||||
StyleInput(this.txtVariable, "x", new Point(565, 66), new Size(60, 26));
|
StyleInput(this.txtVariable, "x", new Point(545, 63), new Size(50, 25));
|
||||||
|
|
||||||
// Numerical points
|
// Numerical points
|
||||||
StyleLabel(this.lblInitialPoint, "Başlangıç (x₀):", new Point(14, 102));
|
StyleLabel(this.lblInitialPoint, "Başlangıç (x₀):", new Point(14, 98));
|
||||||
StyleInput(this.txtInitialPoint, "1.5", new Point(140, 99), new Size(110, 26));
|
StyleInput(this.txtInitialPoint, "1.5", new Point(140, 95), new Size(100, 25));
|
||||||
|
|
||||||
StyleLabel(this.lblMinX, "Alt Sınır (a):", new Point(14, 102));
|
StyleLabel(this.lblMinX, "Alt Sınır (a):", new Point(14, 98));
|
||||||
StyleInput(this.txtMinX, "1", new Point(140, 99), new Size(110, 26));
|
StyleInput(this.txtMinX, "1", new Point(140, 95), new Size(100, 25));
|
||||||
|
|
||||||
StyleLabel(this.lblMaxX, "Üst Sınır (b):", new Point(270, 102));
|
StyleLabel(this.lblMaxX, "Üst Sınır (b):", new Point(255, 98));
|
||||||
StyleInput(this.txtMaxX, "2", new Point(360, 99), new Size(110, 26));
|
StyleInput(this.txtMaxX, "2", new Point(340, 95), new Size(100, 25));
|
||||||
|
|
||||||
StyleLabel(this.lblIterations, "Maks. İterasyon:", new Point(495, 102));
|
StyleLabel(this.lblTolerance, "Tolerans (ε):", new Point(455, 98));
|
||||||
StyleInput(this.txtIterations, "50", new Point(610, 99), new Size(65, 26));
|
StyleInput(this.txtTolerance, "1e-7", new Point(545, 95), new Size(90, 25));
|
||||||
|
|
||||||
|
StyleLabel(this.lblIterations, "Maks. Adım:", new Point(650, 98));
|
||||||
|
StyleInput(this.txtIterations, "50", new Point(735, 95), new Size(55, 25));
|
||||||
|
|
||||||
// Solve Button
|
// Solve Button
|
||||||
this.btnFindRoot.Location = new Point(140, 131);
|
this.btnFindRoot.Location = new Point(140, 128);
|
||||||
this.btnFindRoot.Size = new Size(220, 32);
|
this.btnFindRoot.Size = new Size(200, 34);
|
||||||
|
|
||||||
this.pnlInputsCard.Controls.Add(this.lblMethod);
|
this.pnlInputsCard.Controls.Add(this.lblMethod);
|
||||||
this.pnlInputsCard.Controls.Add(this.cmbMethod);
|
this.pnlInputsCard.Controls.Add(this.cmbMethod);
|
||||||
|
|
@ -171,67 +245,154 @@ namespace MathApp.Controls
|
||||||
this.pnlInputsCard.Controls.Add(this.txtMinX);
|
this.pnlInputsCard.Controls.Add(this.txtMinX);
|
||||||
this.pnlInputsCard.Controls.Add(this.lblMaxX);
|
this.pnlInputsCard.Controls.Add(this.lblMaxX);
|
||||||
this.pnlInputsCard.Controls.Add(this.txtMaxX);
|
this.pnlInputsCard.Controls.Add(this.txtMaxX);
|
||||||
|
this.pnlInputsCard.Controls.Add(this.lblTolerance);
|
||||||
|
this.pnlInputsCard.Controls.Add(this.txtTolerance);
|
||||||
this.pnlInputsCard.Controls.Add(this.lblIterations);
|
this.pnlInputsCard.Controls.Add(this.lblIterations);
|
||||||
this.pnlInputsCard.Controls.Add(this.txtIterations);
|
this.pnlInputsCard.Controls.Add(this.txtIterations);
|
||||||
this.pnlInputsCard.Controls.Add(this.btnFindRoot);
|
this.pnlInputsCard.Controls.Add(this.btnFindRoot);
|
||||||
|
|
||||||
// Hero Summary Card
|
// ==========================================
|
||||||
this.pnlSummary.Location = new Point(24, 226);
|
// Vurgulu Sonuç Kartı (KPI Card)
|
||||||
this.pnlSummary.Size = new Size(860, 68);
|
// ==========================================
|
||||||
|
this.pnlSummary.Location = new Point(20, 226);
|
||||||
|
this.pnlSummary.Size = new Size(870, 96);
|
||||||
this.pnlSummary.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
|
this.pnlSummary.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
|
||||||
this.pnlSummary.BackColor = Color.FromArgb(20, 30, 48);
|
this.pnlSummary.BackColor = Color.FromArgb(22, 32, 50);
|
||||||
this.pnlSummary.Padding = new Padding(16, 8, 16, 8);
|
this.pnlSummary.Padding = new Padding(14, 8, 14, 8);
|
||||||
|
|
||||||
this.lblRootSummaryTitle.Text = "HESAPLANAN KÖK DEĞERİ";
|
this.lblRootSummaryTitle.Text = "HESAPLANAN KÖK ($x^*$)";
|
||||||
this.lblRootSummaryTitle.Location = new Point(16, 8);
|
this.lblRootSummaryTitle.Location = new Point(14, 8);
|
||||||
this.lblRootSummaryTitle.AutoSize = true;
|
this.lblRootSummaryTitle.AutoSize = true;
|
||||||
this.lblRootSummaryTitle.Font = new Font("Segoe UI Semibold", 8F, FontStyle.Bold);
|
this.lblRootSummaryTitle.Font = new Font("Segoe UI Semibold", 8F, FontStyle.Bold);
|
||||||
this.lblRootSummaryTitle.ForeColor = Color.FromArgb(148, 163, 184);
|
this.lblRootSummaryTitle.ForeColor = Color.FromArgb(148, 163, 184);
|
||||||
|
|
||||||
this.lblRootValue.Text = "x ≈ —";
|
this.lblRootValue.Text = "x* ≈ —";
|
||||||
this.lblRootValue.Location = new Point(14, 25);
|
this.lblRootValue.Location = new Point(12, 24);
|
||||||
this.lblRootValue.AutoSize = true;
|
this.lblRootValue.AutoSize = true;
|
||||||
this.lblRootValue.Font = new Font("Consolas", 15F, FontStyle.Bold);
|
this.lblRootValue.Font = new Font("Consolas", 18F, FontStyle.Bold);
|
||||||
this.lblRootValue.ForeColor = Color.FromArgb(52, 211, 153); // Emerald 400
|
this.lblRootValue.ForeColor = Color.FromArgb(52, 211, 153); // Emerald Green
|
||||||
|
|
||||||
this.lblRootDetails.Text = "Henüz hesaplama yapılmadı. \"Kökü Hesapla\" butonuna basınız.";
|
this.lblRootDetails.Text = "Henüz hesaplama yapılmadı. Parametreleri belirleyip 'Kökü Hesapla' butonuna basınız.";
|
||||||
this.lblRootDetails.Location = new Point(280, 29);
|
this.lblRootDetails.Location = new Point(14, 66);
|
||||||
this.lblRootDetails.AutoSize = true;
|
this.lblRootDetails.AutoSize = true;
|
||||||
this.lblRootDetails.Font = new Font("Segoe UI", 9F);
|
this.lblRootDetails.Font = new Font("Segoe UI", 8.25F);
|
||||||
this.lblRootDetails.ForeColor = Color.FromArgb(203, 213, 225);
|
this.lblRootDetails.ForeColor = Color.FromArgb(203, 213, 225);
|
||||||
|
|
||||||
this.btnCopyResult.Location = new Point(740, 18);
|
// Badges FlowPanel
|
||||||
|
this.pnlBadges.Location = new Point(380, 16);
|
||||||
|
this.pnlBadges.Size = new Size(260, 44);
|
||||||
|
this.pnlBadges.BackColor = Color.Transparent;
|
||||||
|
|
||||||
|
void StyleBadge(Label b, string text, Color fg, Color bg)
|
||||||
|
{
|
||||||
|
b.Text = text;
|
||||||
|
b.AutoSize = true;
|
||||||
|
b.Font = new Font("Segoe UI Semibold", 7.5F, FontStyle.Bold);
|
||||||
|
b.ForeColor = fg;
|
||||||
|
b.BackColor = bg;
|
||||||
|
b.Padding = new Padding(5, 3, 5, 3);
|
||||||
|
b.Margin = new Padding(3, 4, 3, 4);
|
||||||
|
}
|
||||||
|
|
||||||
|
StyleBadge(this.lblBadgeIter, "İterasyon: —", Color.FromArgb(56, 189, 248), Color.FromArgb(12, 74, 110));
|
||||||
|
StyleBadge(this.lblBadgeError, "Hata: —", Color.FromArgb(245, 158, 11), Color.FromArgb(120, 53, 15));
|
||||||
|
StyleBadge(this.lblBadgeStatus, "Durum: Bekliyor", Color.FromArgb(148, 163, 184), Color.FromArgb(30, 41, 59));
|
||||||
|
|
||||||
|
this.pnlBadges.Controls.Add(this.lblBadgeIter);
|
||||||
|
this.pnlBadges.Controls.Add(this.lblBadgeError);
|
||||||
|
this.pnlBadges.Controls.Add(this.lblBadgeStatus);
|
||||||
|
|
||||||
|
// Actions in Card
|
||||||
|
this.btnPlotOnGraph.Text = "📈 Grafikte Göster";
|
||||||
|
this.btnPlotOnGraph.Location = new Point(650, 14);
|
||||||
|
this.btnPlotOnGraph.Size = new Size(120, 32);
|
||||||
|
this.btnPlotOnGraph.Anchor = AnchorStyles.Top | AnchorStyles.Right;
|
||||||
|
this.btnPlotOnGraph.FlatStyle = FlatStyle.Flat;
|
||||||
|
this.btnPlotOnGraph.BackColor = Color.FromArgb(14, 165, 233);
|
||||||
|
this.btnPlotOnGraph.ForeColor = Color.White;
|
||||||
|
this.btnPlotOnGraph.Font = new Font("Segoe UI Semibold", 8F, FontStyle.Bold);
|
||||||
|
this.btnPlotOnGraph.Cursor = Cursors.Hand;
|
||||||
|
this.btnPlotOnGraph.FlatAppearance.BorderSize = 0;
|
||||||
|
|
||||||
|
this.btnCopyResult.Location = new Point(780, 14);
|
||||||
|
this.btnCopyResult.Size = new Size(80, 32);
|
||||||
this.btnCopyResult.Anchor = AnchorStyles.Top | AnchorStyles.Right;
|
this.btnCopyResult.Anchor = AnchorStyles.Top | AnchorStyles.Right;
|
||||||
|
|
||||||
this.pnlSummary.Controls.Add(this.lblRootSummaryTitle);
|
this.pnlSummary.Controls.Add(this.lblRootSummaryTitle);
|
||||||
this.pnlSummary.Controls.Add(this.lblRootValue);
|
this.pnlSummary.Controls.Add(this.lblRootValue);
|
||||||
this.pnlSummary.Controls.Add(this.lblRootDetails);
|
this.pnlSummary.Controls.Add(this.lblRootDetails);
|
||||||
|
this.pnlSummary.Controls.Add(this.pnlBadges);
|
||||||
|
this.pnlSummary.Controls.Add(this.btnPlotOnGraph);
|
||||||
this.pnlSummary.Controls.Add(this.btnCopyResult);
|
this.pnlSummary.Controls.Add(this.btnCopyResult);
|
||||||
|
|
||||||
// Log Label
|
// ==========================================
|
||||||
this.lblLogTitle.Text = "📊 Detaylı İterasyon Adımları ve Hata Analizi:";
|
// Tabbed Results Area
|
||||||
this.lblLogTitle.Location = new Point(24, 302);
|
// ==========================================
|
||||||
this.lblLogTitle.AutoSize = true;
|
this.tabResults.Location = new Point(20, 330);
|
||||||
this.lblLogTitle.Font = new Font("Segoe UI Semibold", 9.5F, FontStyle.Bold);
|
this.tabResults.Size = new Size(870, 310);
|
||||||
this.lblLogTitle.ForeColor = ThemeHelper.LightText;
|
this.tabResults.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
|
||||||
|
this.tabResults.ItemSize = new Size(160, 26);
|
||||||
|
this.tabResults.SizeMode = TabSizeMode.Fixed;
|
||||||
|
|
||||||
// Log Text Box
|
this.tabGrid.Text = " İterasyon Tablosu ";
|
||||||
this.txtResult.Location = new Point(24, 324);
|
this.tabGrid.BackColor = Color.FromArgb(15, 23, 42);
|
||||||
this.txtResult.Size = new Size(860, 240);
|
this.tabGrid.Padding = new Padding(6);
|
||||||
this.txtResult.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
|
|
||||||
|
this.tabPlot.Text = " Yakınsama Hızı Grafiği ";
|
||||||
|
this.tabPlot.BackColor = Color.FromArgb(15, 23, 42);
|
||||||
|
this.tabPlot.Padding = new Padding(6);
|
||||||
|
|
||||||
|
this.tabText.Text = " Analitik Rapor ";
|
||||||
|
this.tabText.BackColor = Color.FromArgb(15, 23, 42);
|
||||||
|
this.tabText.Padding = new Padding(6);
|
||||||
|
|
||||||
|
// Tab 1: DataGridView
|
||||||
|
this.dgvIterations.Dock = DockStyle.Fill;
|
||||||
|
this.dgvIterations.BackgroundColor = Color.FromArgb(15, 23, 42);
|
||||||
|
this.dgvIterations.BorderStyle = BorderStyle.None;
|
||||||
|
this.dgvIterations.CellBorderStyle = DataGridViewCellBorderStyle.SingleHorizontal;
|
||||||
|
this.dgvIterations.GridColor = Color.FromArgb(30, 41, 59);
|
||||||
|
this.dgvIterations.RowHeadersVisible = false;
|
||||||
|
this.dgvIterations.AllowUserToAddRows = false;
|
||||||
|
this.dgvIterations.AllowUserToDeleteRows = false;
|
||||||
|
this.dgvIterations.ReadOnly = true;
|
||||||
|
this.dgvIterations.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
|
||||||
|
this.dgvIterations.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
|
||||||
|
this.dgvIterations.DefaultCellStyle.BackColor = Color.FromArgb(15, 23, 42);
|
||||||
|
this.dgvIterations.DefaultCellStyle.ForeColor = Color.White;
|
||||||
|
this.dgvIterations.DefaultCellStyle.Font = new Font("Consolas", 9F);
|
||||||
|
this.dgvIterations.AlternatingRowsDefaultCellStyle.BackColor = Color.FromArgb(22, 32, 50);
|
||||||
|
this.dgvIterations.ColumnHeadersDefaultCellStyle.BackColor = Color.FromArgb(30, 41, 59);
|
||||||
|
this.dgvIterations.ColumnHeadersDefaultCellStyle.ForeColor = Color.FromArgb(148, 163, 184);
|
||||||
|
this.dgvIterations.ColumnHeadersDefaultCellStyle.Font = new Font("Segoe UI Semibold", 8.5F, FontStyle.Bold);
|
||||||
|
this.dgvIterations.EnableHeadersVisualStyles = false;
|
||||||
|
|
||||||
|
this.tabGrid.Controls.Add(this.dgvIterations);
|
||||||
|
|
||||||
|
// Tab 2: Canvas
|
||||||
|
this.pnlConvergencePlot.Dock = DockStyle.Fill;
|
||||||
|
this.pnlConvergencePlot.BackColor = Color.FromArgb(15, 23, 42);
|
||||||
|
this.tabPlot.Controls.Add(this.pnlConvergencePlot);
|
||||||
|
|
||||||
|
// Tab 3: Text Report
|
||||||
|
this.txtResult.Dock = DockStyle.Fill;
|
||||||
this.txtResult.BackColor = Color.FromArgb(15, 23, 42);
|
this.txtResult.BackColor = Color.FromArgb(15, 23, 42);
|
||||||
this.txtResult.BorderStyle = BorderStyle.FixedSingle;
|
this.txtResult.BorderStyle = BorderStyle.None;
|
||||||
this.txtResult.ForeColor = Color.FromArgb(186, 230, 253);
|
this.txtResult.ForeColor = Color.FromArgb(186, 230, 253);
|
||||||
this.txtResult.Multiline = true;
|
this.txtResult.Multiline = true;
|
||||||
this.txtResult.ReadOnly = true;
|
this.txtResult.ReadOnly = true;
|
||||||
this.txtResult.ScrollBars = ScrollBars.Vertical;
|
this.txtResult.ScrollBars = ScrollBars.Vertical;
|
||||||
this.txtResult.Font = new Font("Consolas", 9.5F);
|
this.txtResult.Font = new Font("Consolas", 9.5F);
|
||||||
|
this.tabText.Controls.Add(this.txtResult);
|
||||||
|
|
||||||
|
this.tabResults.TabPages.Add(this.tabGrid);
|
||||||
|
this.tabResults.TabPages.Add(this.tabPlot);
|
||||||
|
this.tabResults.TabPages.Add(this.tabText);
|
||||||
|
|
||||||
this.pnlContent.Controls.Add(this.pnlPresets);
|
this.pnlContent.Controls.Add(this.pnlPresets);
|
||||||
this.pnlContent.Controls.Add(this.pnlInputsCard);
|
this.pnlContent.Controls.Add(this.pnlInputsCard);
|
||||||
this.pnlContent.Controls.Add(this.pnlSummary);
|
this.pnlContent.Controls.Add(this.pnlSummary);
|
||||||
this.pnlContent.Controls.Add(this.lblLogTitle);
|
this.pnlContent.Controls.Add(this.tabResults);
|
||||||
this.pnlContent.Controls.Add(this.txtResult);
|
|
||||||
|
|
||||||
this.AutoScaleDimensions = new SizeF(7F, 15F);
|
this.AutoScaleDimensions = new SizeF(7F, 15F);
|
||||||
this.AutoScaleMode = AutoScaleMode.Font;
|
this.AutoScaleMode = AutoScaleMode.Font;
|
||||||
|
|
@ -241,48 +402,21 @@ namespace MathApp.Controls
|
||||||
this.Name = "RootFinderControl";
|
this.Name = "RootFinderControl";
|
||||||
this.Size = new Size(910, 680);
|
this.Size = new Size(910, 680);
|
||||||
|
|
||||||
|
this.pnlBadges.ResumeLayout(false);
|
||||||
|
this.pnlBadges.PerformLayout();
|
||||||
this.pnlSummary.ResumeLayout(false);
|
this.pnlSummary.ResumeLayout(false);
|
||||||
this.pnlSummary.PerformLayout();
|
this.pnlSummary.PerformLayout();
|
||||||
this.pnlInputsCard.ResumeLayout(false);
|
this.pnlInputsCard.ResumeLayout(false);
|
||||||
this.pnlInputsCard.PerformLayout();
|
this.pnlInputsCard.PerformLayout();
|
||||||
this.pnlContent.ResumeLayout(false);
|
this.pnlContent.ResumeLayout(false);
|
||||||
this.pnlContent.PerformLayout();
|
this.pnlContent.PerformLayout();
|
||||||
|
this.tabResults.ResumeLayout(false);
|
||||||
|
this.tabGrid.ResumeLayout(false);
|
||||||
|
this.tabPlot.ResumeLayout(false);
|
||||||
|
this.tabText.ResumeLayout(false);
|
||||||
|
this.tabText.PerformLayout();
|
||||||
|
((System.ComponentModel.ISupportInitialize)(this.dgvIterations)).EndInit();
|
||||||
this.ResumeLayout(false);
|
this.ResumeLayout(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
private Panel pnlHeader;
|
|
||||||
private Panel pnlContent;
|
|
||||||
private FlowLayoutPanel pnlPresets;
|
|
||||||
private Label lblPresets;
|
|
||||||
private Button btnEx1;
|
|
||||||
private Button btnEx2;
|
|
||||||
private Button btnEx3;
|
|
||||||
|
|
||||||
private Panel pnlInputsCard;
|
|
||||||
private Label lblMethod;
|
|
||||||
public ComboBox cmbMethod;
|
|
||||||
private Label lblMethodDesc;
|
|
||||||
private Label lblEquation;
|
|
||||||
public TextBox txtEquation;
|
|
||||||
private Label lblVariable;
|
|
||||||
public TextBox txtVariable;
|
|
||||||
private Label lblInitialPoint;
|
|
||||||
public TextBox txtInitialPoint;
|
|
||||||
private Label lblMinX;
|
|
||||||
public TextBox txtMinX;
|
|
||||||
private Label lblMaxX;
|
|
||||||
public TextBox txtMaxX;
|
|
||||||
private Label lblIterations;
|
|
||||||
public TextBox txtIterations;
|
|
||||||
public Button btnFindRoot;
|
|
||||||
|
|
||||||
private Panel pnlSummary;
|
|
||||||
private Label lblRootSummaryTitle;
|
|
||||||
private Label lblRootValue;
|
|
||||||
private Label lblRootDetails;
|
|
||||||
private Button btnCopyResult;
|
|
||||||
|
|
||||||
private Label lblLogTitle;
|
|
||||||
public TextBox txtResult;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,10 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
|
using System.Drawing.Drawing2D;
|
||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
|
|
||||||
|
|
@ -10,9 +12,31 @@ namespace MathApp.Controls
|
||||||
{
|
{
|
||||||
public partial class RootFinderControl : UserControl
|
public partial class RootFinderControl : UserControl
|
||||||
{
|
{
|
||||||
|
public class IterationStep
|
||||||
|
{
|
||||||
|
public int Step { get; set; }
|
||||||
|
public decimal X { get; set; }
|
||||||
|
public decimal Fx { get; set; }
|
||||||
|
public decimal AbsError { get; set; }
|
||||||
|
public decimal RelError { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
private List<IterationStep> _steps = new List<IterationStep>();
|
||||||
|
private decimal? _lastRoot = null;
|
||||||
|
private string _lastEquation = "";
|
||||||
|
private decimal _targetTolerance = 1e-7m;
|
||||||
|
|
||||||
public RootFinderControl()
|
public RootFinderControl()
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
|
ThemeHelper.StyleModernTabControl(tabResults);
|
||||||
|
|
||||||
|
typeof(Panel).InvokeMember("DoubleBuffered",
|
||||||
|
System.Reflection.BindingFlags.SetProperty | System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic,
|
||||||
|
null, pnlConvergencePlot, new object[] { true });
|
||||||
|
|
||||||
|
pnlConvergencePlot.Paint += PnlConvergencePlot_Paint;
|
||||||
|
|
||||||
cmbMethod.SelectedIndex = 0;
|
cmbMethod.SelectedIndex = 0;
|
||||||
UpdateVisibility();
|
UpdateVisibility();
|
||||||
cmbMethod.SelectedIndexChanged += (s, e) => UpdateVisibility();
|
cmbMethod.SelectedIndexChanged += (s, e) => UpdateVisibility();
|
||||||
|
|
@ -20,22 +44,31 @@ namespace MathApp.Controls
|
||||||
|
|
||||||
btnEx1.Click += (s, e) => LoadPreset("x^3 - x - 2", "x", 0, "1.5", "1", "2");
|
btnEx1.Click += (s, e) => LoadPreset("x^3 - x - 2", "x", 0, "1.5", "1", "2");
|
||||||
btnEx2.Click += (s, e) => LoadPreset("cos(x) - x", "x", 1, "0.5", "0", "1");
|
btnEx2.Click += (s, e) => LoadPreset("cos(x) - x", "x", 1, "0.5", "0", "1");
|
||||||
btnEx3.Click += (s, e) => LoadPreset("e^x - 3*x", "x", 2, "0.5", "0", "1");
|
btnEx3.Click += (s, e) => LoadPreset("exp(x) - 3*x", "x", 2, "0.5", "0", "1");
|
||||||
|
|
||||||
btnCopyResult.Click += (s, e) => {
|
btnPlotOnGraph.Click += BtnPlotOnGraph_Click;
|
||||||
if (!string.IsNullOrEmpty(txtResult.Text))
|
btnCopyResult.Click += BtnCopyResult_Click;
|
||||||
{
|
|
||||||
Clipboard.SetText(txtResult.Text);
|
|
||||||
MessageBox.Show("Sonuç ve iterasyon adımları panoya kopyalandı!", "Bilgi", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
// Enter key triggers search
|
|
||||||
txtEquation.KeyDown += Input_KeyDown;
|
txtEquation.KeyDown += Input_KeyDown;
|
||||||
txtInitialPoint.KeyDown += Input_KeyDown;
|
txtInitialPoint.KeyDown += Input_KeyDown;
|
||||||
txtMinX.KeyDown += Input_KeyDown;
|
txtMinX.KeyDown += Input_KeyDown;
|
||||||
txtMaxX.KeyDown += Input_KeyDown;
|
txtMaxX.KeyDown += Input_KeyDown;
|
||||||
|
txtTolerance.KeyDown += Input_KeyDown;
|
||||||
txtIterations.KeyDown += Input_KeyDown;
|
txtIterations.KeyDown += Input_KeyDown;
|
||||||
|
|
||||||
|
// Setup DataGridView Columns
|
||||||
|
dgvIterations.Columns.Clear();
|
||||||
|
dgvIterations.Columns.Add("Step", "Adım (k)");
|
||||||
|
dgvIterations.Columns.Add("Xk", "x_k (Tahmin)");
|
||||||
|
dgvIterations.Columns.Add("Fxk", "f(x_k)");
|
||||||
|
dgvIterations.Columns.Add("AbsErr", "Mutlak Hata |Δx|");
|
||||||
|
dgvIterations.Columns.Add("RelErr", "Bağıl Hata (%)");
|
||||||
|
|
||||||
|
dgvIterations.Columns["Step"].Width = 80;
|
||||||
|
dgvIterations.Columns["Xk"].Width = 180;
|
||||||
|
dgvIterations.Columns["Fxk"].Width = 160;
|
||||||
|
dgvIterations.Columns["AbsErr"].Width = 160;
|
||||||
|
dgvIterations.Columns["RelErr"].Width = 120;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Input_KeyDown(object sender, KeyEventArgs e)
|
private void Input_KeyDown(object sender, KeyEventArgs e)
|
||||||
|
|
@ -74,34 +107,35 @@ namespace MathApp.Controls
|
||||||
switch (idx)
|
switch (idx)
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
lblMethodDesc.Text = "💡 Fonksiyonun analitik türevi ile teğet çizerek hızlıca köke ulaşır. Tek bir başlangıç tahmini (x₀) yeterlidir.";
|
lblMethodDesc.Text = "💡 Newton-Raphson: Analitik teğet doğrusu ile kuadratik hızda köke ulaşır. Tek bir başlangıç (x₀) yeterlidir.";
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
lblMethodDesc.Text = "💡 [a, b] aralığında f(a)·f(b) < 0 ise kökü bulmayı garanti eder. Güvenli ve kararlıdır.";
|
lblMethodDesc.Text = "💡 Bisection (İkiye Bölme): [a, b] aralığında f(a)·f(b) < 0 ise kökü bulmayı garanti eder. Kararlıdır.";
|
||||||
lblMinX.Text = "Alt Sınır (a):";
|
lblMinX.Text = "Alt Sınır (a):";
|
||||||
lblMaxX.Text = "Üst Sınır (b):";
|
lblMaxX.Text = "Üst Sınır (b):";
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
lblMethodDesc.Text = "💡 Türev almadan iki nokta arasındaki kiriş eğimi ile yaklaşır. İki başlangıç tahmini (x₀, x₁) ister.";
|
lblMethodDesc.Text = "💡 Secant (Kiriş): Türev gerektirmeden iki nokta (x₀, x₁) arasındaki kiriş doğrusuyla hızla yaklaşır.";
|
||||||
lblMinX.Text = "Başlangıç 1 (x₀):";
|
lblMinX.Text = "Başlangıç 1 (x₀):";
|
||||||
lblMaxX.Text = "Başlangıç 2 (x₁):";
|
lblMaxX.Text = "Başlangıç 2 (x₁):";
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
lblMethodDesc.Text = "💡 Doğrusal interpolasyon ile aralığı daraltarak köke ulaşır. [a, b] aralığı ister.";
|
lblMethodDesc.Text = "💡 Regula Falsi: Doğrusal interpolasyonla kök sınırlarını daraltır. [a, b] kapalı aralığı ister.";
|
||||||
lblMinX.Text = "Alt Sınır (a):";
|
lblMinX.Text = "Alt Sınır (a):";
|
||||||
lblMaxX.Text = "Üst Sınır (b):";
|
lblMaxX.Text = "Üst Sınır (b):";
|
||||||
break;
|
break;
|
||||||
case 4:
|
case 4:
|
||||||
lblMethodDesc.Text = "🎯 [a, b] aralığını 500 adımlı ızgara taramasıyla inceler; aralıktaki TÜM kökleri yüksek hassasiyetle bulur.";
|
lblMethodDesc.Text = "🎯 Çoklu Kök Taraması: [a, b] aralığındaki tüm kökleri 500 adımlı ızgara ile otomatik tespit eder.";
|
||||||
lblMinX.Text = "Arama Alt Sınırı (a):";
|
lblMinX.Text = "Arama Altı (a):";
|
||||||
lblMaxX.Text = "Arama Üst Sınırı (b):";
|
lblMaxX.Text = "Arama Üstü (b):";
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private decimal ParseDecimal(string input, string fieldName)
|
private decimal ParseDecimal(string input, string fieldName, decimal defVal = 0m)
|
||||||
{
|
{
|
||||||
string norm = (input ?? "").Trim().Replace(',', '.');
|
string norm = (input ?? "").Trim().Replace(',', '.');
|
||||||
|
if (string.IsNullOrWhiteSpace(norm)) return defVal;
|
||||||
if (decimal.TryParse(norm, NumberStyles.Any, CultureInfo.InvariantCulture, out decimal val))
|
if (decimal.TryParse(norm, NumberStyles.Any, CultureInfo.InvariantCulture, out decimal val))
|
||||||
return val;
|
return val;
|
||||||
throw new ArgumentException($"'{fieldName}' alanı için geçerli bir sayı giriniz.");
|
throw new ArgumentException($"'{fieldName}' alanı için geçerli bir sayı giriniz.");
|
||||||
|
|
@ -119,153 +153,342 @@ namespace MathApp.Controls
|
||||||
string eq = txtEquation.Text.Trim();
|
string eq = txtEquation.Text.Trim();
|
||||||
if (string.IsNullOrWhiteSpace(eq))
|
if (string.IsNullOrWhiteSpace(eq))
|
||||||
{
|
{
|
||||||
txtResult.Text = "Lütfen bir denklem giriniz (Örn: x^3 - x - 2).";
|
MessageBox.Show("Lütfen bir denklem giriniz (Örn: x^3 - x - 2).", "Uyarı", MessageBoxButtons.OK, MessageBoxIcon.Warning);
|
||||||
lblRootValue.Text = "x ≈ —";
|
|
||||||
lblRootDetails.Text = "Lütfen denklem giriniz.";
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
string variable = string.IsNullOrWhiteSpace(txtVariable.Text) ? "x" : txtVariable.Text.Trim();
|
_lastEquation = eq;
|
||||||
if (!int.TryParse(txtIterations.Text.Trim(), out int iterCount) || iterCount < 1)
|
string varName = string.IsNullOrWhiteSpace(txtVariable.Text) ? "x" : txtVariable.Text.Trim();
|
||||||
iterCount = 50;
|
if (!int.TryParse(txtIterations.Text.Trim(), out int maxIter) || maxIter < 1) maxIter = 50;
|
||||||
|
|
||||||
int idx = cmbMethod.SelectedIndex;
|
_targetTolerance = ParseDecimal(txtTolerance.Text, "Tolerans (ε)", 1e-7m);
|
||||||
string initPtText = txtInitialPoint.Text;
|
if (_targetTolerance <= 0m) _targetTolerance = 1e-7m;
|
||||||
string minXText = txtMinX.Text;
|
|
||||||
string maxXText = txtMaxX.Text;
|
|
||||||
|
|
||||||
if (idx == 4) // Find All Roots in Interval
|
int methodIdx = cmbMethod.SelectedIndex;
|
||||||
{
|
decimal x0 = ParseDecimal(txtInitialPoint.Text, "Başlangıç (x₀)", 1.5m);
|
||||||
decimal minX = ParseDecimal(minXText, "Arama Alt Sınırı (a)");
|
decimal minX = ParseDecimal(txtMinX.Text, "Alt Sınır (a)", 1m);
|
||||||
decimal maxX = ParseDecimal(maxXText, "Arama Üst Sınırı (b)");
|
decimal maxX = ParseDecimal(txtMaxX.Text, "Üst Sınır (b)", 2m);
|
||||||
|
|
||||||
var sw = System.Diagnostics.Stopwatch.StartNew();
|
_steps.Clear();
|
||||||
var allRoots = await Task.Run(() =>
|
bool converged = false;
|
||||||
|
decimal rootVal = 0m;
|
||||||
|
string statusMessage = "";
|
||||||
|
|
||||||
|
await Task.Run(() =>
|
||||||
{
|
{
|
||||||
bool prevRad = Function.UseRadians;
|
bool prevRad = Function.UseRadians;
|
||||||
Function.UseRadians = true;
|
Function.UseRadians = true;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
return NumericalMethods.FindAllRoots(eq, minX, maxX, variable);
|
Function fn = NumericalMethods.CompileFunction(eq);
|
||||||
}
|
|
||||||
finally
|
|
||||||
{
|
|
||||||
Function.UseRadians = prevRad;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
sw.Stop();
|
|
||||||
|
|
||||||
if (allRoots.Count == 0)
|
decimal Eval(decimal xVal) => NumericalMethods.EvaluateCompiled(fn, varName, xVal);
|
||||||
|
decimal EvalDeriv(decimal xVal)
|
||||||
{
|
{
|
||||||
txtResult.Text = $"[{minX}, {maxX}] aralığında kök bulunamadı.";
|
decimal h = 0.0001m;
|
||||||
lblRootValue.Text = "Kök Bulunamadı";
|
return (Eval(xVal + h) - Eval(xVal - h)) / (2m * h);
|
||||||
lblRootValue.ForeColor = Color.FromArgb(239, 68, 68);
|
}
|
||||||
lblRootDetails.Text = $"[{minX}, {maxX}] aralığında f({variable}) = 0 sağlayan kök bulunamadı. (⏱️ {sw.ElapsedMilliseconds} ms)";
|
|
||||||
|
// ==========================================
|
||||||
|
// Method 0: Newton-Raphson
|
||||||
|
// ==========================================
|
||||||
|
if (methodIdx == 0)
|
||||||
|
{
|
||||||
|
decimal curX = x0;
|
||||||
|
for (int k = 1; k <= maxIter; k++)
|
||||||
|
{
|
||||||
|
decimal fx = Eval(curX);
|
||||||
|
decimal dfx = EvalDeriv(curX);
|
||||||
|
|
||||||
|
if (Math.Abs(dfx) < 1e-12m)
|
||||||
|
{
|
||||||
|
throw new InvalidOperationException($"Sıfıra bölme hatası: f'({curX:F4}) türevi sıfır veya sıfıra çok yakın oldu. Farklı bir başlangıç noktası (x₀) seçin.");
|
||||||
|
}
|
||||||
|
|
||||||
|
decimal nextX = curX - (fx / dfx);
|
||||||
|
decimal absErr = Math.Abs(nextX - curX);
|
||||||
|
decimal relErr = (Math.Abs(nextX) > 1e-10m) ? (absErr / Math.Abs(nextX)) * 100m : absErr * 100m;
|
||||||
|
|
||||||
|
_steps.Add(new IterationStep
|
||||||
|
{
|
||||||
|
Step = k,
|
||||||
|
X = nextX,
|
||||||
|
Fx = Eval(nextX),
|
||||||
|
AbsError = absErr,
|
||||||
|
RelError = relErr
|
||||||
|
});
|
||||||
|
|
||||||
|
if (absErr < _targetTolerance || Math.Abs(Eval(nextX)) < _targetTolerance)
|
||||||
|
{
|
||||||
|
converged = true;
|
||||||
|
rootVal = nextX;
|
||||||
|
statusMessage = "Toleransa ulaşıldı (Başarıyla Yakınsadı).";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
curX = nextX;
|
||||||
|
}
|
||||||
|
if (!converged && _steps.Count > 0)
|
||||||
|
{
|
||||||
|
rootVal = _steps.Last().X;
|
||||||
|
statusMessage = "Maksimum iterasyonda toleransa ulaşılamadı (Divergence / Yavaş Yakınsama).";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// ==========================================
|
||||||
|
// Method 1: Bisection (İkiye Bölme)
|
||||||
|
// ==========================================
|
||||||
|
else if (methodIdx == 1)
|
||||||
|
{
|
||||||
|
decimal a = minX;
|
||||||
|
decimal b = maxX;
|
||||||
|
decimal fa = Eval(a);
|
||||||
|
decimal fb = Eval(b);
|
||||||
|
|
||||||
|
if (fa * fb > 0m)
|
||||||
|
{
|
||||||
|
statusMessage = $"Uyarı: f(a)={fa:F3} ve f(b)={fb:F3} aynı işaretli! [a, b] aralığında kök bulunmayabilir.";
|
||||||
|
}
|
||||||
|
|
||||||
|
decimal prevMid = a;
|
||||||
|
for (int k = 1; k <= maxIter; k++)
|
||||||
|
{
|
||||||
|
decimal mid = (a + b) / 2m;
|
||||||
|
decimal fmid = Eval(mid);
|
||||||
|
decimal absErr = Math.Abs(mid - prevMid);
|
||||||
|
decimal relErr = (Math.Abs(mid) > 1e-10m) ? (absErr / Math.Abs(mid)) * 100m : absErr * 100m;
|
||||||
|
|
||||||
|
_steps.Add(new IterationStep
|
||||||
|
{
|
||||||
|
Step = k,
|
||||||
|
X = mid,
|
||||||
|
Fx = fmid,
|
||||||
|
AbsError = (b - a) / 2m,
|
||||||
|
RelError = relErr
|
||||||
|
});
|
||||||
|
|
||||||
|
if ((b - a) / 2m < _targetTolerance || Math.Abs(fmid) < _targetTolerance)
|
||||||
|
{
|
||||||
|
converged = true;
|
||||||
|
rootVal = mid;
|
||||||
|
statusMessage = "Aralık tolerans altına indi (Başarıyla Yakınsadı).";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (fa * fmid <= 0m)
|
||||||
|
{
|
||||||
|
b = mid;
|
||||||
|
fb = fmid;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
var rootLines = new List<string>
|
a = mid;
|
||||||
|
fa = fmid;
|
||||||
|
}
|
||||||
|
prevMid = mid;
|
||||||
|
}
|
||||||
|
if (!converged && _steps.Count > 0)
|
||||||
{
|
{
|
||||||
$"=== [{minX}, {maxX}] ARALIĞINDA BULUNAN TÜM KÖKLER ===",
|
rootVal = _steps.Last().X;
|
||||||
$"Denklem : f({variable}) = {eq}",
|
statusMessage = "Maksimum adım tamamlandı.";
|
||||||
$"Tarama Aralığı : [{minX}, {maxX}]",
|
}
|
||||||
$"Bulunan Kök Sayısı: {allRoots.Count} adet | ⏱️ {sw.ElapsedMilliseconds} ms",
|
}
|
||||||
new string('-', 55)
|
// ==========================================
|
||||||
};
|
// Method 2: Secant (Kiriş)
|
||||||
|
// ==========================================
|
||||||
|
else if (methodIdx == 2)
|
||||||
|
{
|
||||||
|
decimal xPrev = minX; // x0
|
||||||
|
decimal xCur = maxX; // x1
|
||||||
|
|
||||||
for (int k = 0; k < allRoots.Count; k++)
|
for (int k = 1; k <= maxIter; k++)
|
||||||
{
|
{
|
||||||
string rStr = allRoots[k].Root.ToString("0.##########", CultureInfo.InvariantCulture);
|
decimal fPrev = Eval(xPrev);
|
||||||
string fStr = allRoots[k].FVal.ToString("G5", CultureInfo.InvariantCulture);
|
decimal fCur = Eval(xCur);
|
||||||
rootLines.Add($" {k + 1}) {variable}_{k + 1} = {rStr,-16} => f({variable}_{k + 1}) = {fStr}");
|
|
||||||
|
decimal denom = fCur - fPrev;
|
||||||
|
if (Math.Abs(denom) < 1e-12m)
|
||||||
|
{
|
||||||
|
throw new InvalidOperationException("Kiriş eğimi sıfırlandı: f(x_k) - f(x_{k-1}) sıfıra çok yakın.");
|
||||||
}
|
}
|
||||||
|
|
||||||
txtResult.Text = string.Join(Environment.NewLine, rootLines);
|
decimal xNext = xCur - fCur * (xCur - xPrev) / denom;
|
||||||
|
decimal absErr = Math.Abs(xNext - xCur);
|
||||||
|
decimal relErr = (Math.Abs(xNext) > 1e-10m) ? (absErr / Math.Abs(xNext)) * 100m : absErr * 100m;
|
||||||
|
|
||||||
string heroText = string.Join(", ", allRoots.Take(4).Select((r, k) => $"{variable}_{k + 1} ≈ {r.Root.ToString("0.#####", CultureInfo.InvariantCulture)}"));
|
_steps.Add(new IterationStep
|
||||||
if (allRoots.Count > 4) heroText += $" ... (+{allRoots.Count - 4} kök daha)";
|
{
|
||||||
|
Step = k,
|
||||||
|
X = xNext,
|
||||||
|
Fx = Eval(xNext),
|
||||||
|
AbsError = absErr,
|
||||||
|
RelError = relErr
|
||||||
|
});
|
||||||
|
|
||||||
lblRootValue.Text = heroText;
|
if (absErr < _targetTolerance || Math.Abs(Eval(xNext)) < _targetTolerance)
|
||||||
lblRootValue.ForeColor = Color.FromArgb(52, 211, 153);
|
{
|
||||||
lblRootDetails.Text = $"🎯 [{minX}, {maxX}] aralığında {allRoots.Count} kök bulundu | ⏱️ {sw.ElapsedMilliseconds} ms";
|
converged = true;
|
||||||
}
|
rootVal = xNext;
|
||||||
return;
|
statusMessage = "Kiriş yöntemiyle yakınsama sağlandı.";
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
var (logs, finalRoot) = await Task.Run(() =>
|
xPrev = xCur;
|
||||||
{
|
xCur = xNext;
|
||||||
List<string> stepLogs;
|
|
||||||
bool prevRad = Function.UseRadians;
|
|
||||||
Function.UseRadians = true;
|
|
||||||
try
|
|
||||||
{
|
|
||||||
if (idx == 0) // Newton-Raphson
|
|
||||||
{
|
|
||||||
decimal initialP = ParseDecimal(initPtText, "Başlangıç Noktası (x₀)");
|
|
||||||
stepLogs = NumericalMethods.Method_NewtonRaphson(eq, initialP, iterCount, variable);
|
|
||||||
}
|
}
|
||||||
else if (idx == 1) // Bisection
|
if (!converged && _steps.Count > 0)
|
||||||
{
|
{
|
||||||
decimal minX = ParseDecimal(minXText, "Alt Sınır (a)");
|
rootVal = _steps.Last().X;
|
||||||
decimal maxX = ParseDecimal(maxXText, "Üst Sınır (b)");
|
statusMessage = "Maksimum iterasyon doldu.";
|
||||||
stepLogs = NumericalMethods.Method_Bisection(eq, minX, maxX, iterCount, variable);
|
|
||||||
}
|
}
|
||||||
else if (idx == 2) // Secant
|
|
||||||
{
|
|
||||||
decimal minX = ParseDecimal(minXText, "Başlangıç 1 (x₀)");
|
|
||||||
decimal maxX = ParseDecimal(maxXText, "Başlangıç 2 (x₁)");
|
|
||||||
stepLogs = NumericalMethods.Method_Secant(eq, minX, maxX, iterCount, variable);
|
|
||||||
}
|
}
|
||||||
else // Regula Falsi
|
// ==========================================
|
||||||
|
// Method 3: Regula Falsi
|
||||||
|
// ==========================================
|
||||||
|
else if (methodIdx == 3)
|
||||||
{
|
{
|
||||||
decimal minX = ParseDecimal(minXText, "Alt Sınır (a)");
|
decimal a = minX;
|
||||||
decimal maxX = ParseDecimal(maxXText, "Üst Sınır (b)");
|
decimal b = maxX;
|
||||||
stepLogs = NumericalMethods.Method_RegulaFalsi(eq, minX, maxX, iterCount, variable);
|
decimal prevC = a;
|
||||||
|
|
||||||
|
for (int k = 1; k <= maxIter; k++)
|
||||||
|
{
|
||||||
|
decimal fa = Eval(a);
|
||||||
|
decimal fb = Eval(b);
|
||||||
|
|
||||||
|
decimal denom = fb - fa;
|
||||||
|
if (Math.Abs(denom) < 1e-12m) break;
|
||||||
|
|
||||||
|
decimal c = (a * fb - b * fa) / denom;
|
||||||
|
decimal fc = Eval(c);
|
||||||
|
decimal absErr = Math.Abs(c - prevC);
|
||||||
|
decimal relErr = (Math.Abs(c) > 1e-10m) ? (absErr / Math.Abs(c)) * 100m : absErr * 100m;
|
||||||
|
|
||||||
|
_steps.Add(new IterationStep
|
||||||
|
{
|
||||||
|
Step = k,
|
||||||
|
X = c,
|
||||||
|
Fx = fc,
|
||||||
|
AbsError = absErr,
|
||||||
|
RelError = relErr
|
||||||
|
});
|
||||||
|
|
||||||
|
if (Math.Abs(fc) < _targetTolerance || absErr < _targetTolerance)
|
||||||
|
{
|
||||||
|
converged = true;
|
||||||
|
rootVal = c;
|
||||||
|
statusMessage = "Regula Falsi ile yakınsama sağlandı.";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (fa * fc <= 0m) b = c;
|
||||||
|
else a = c;
|
||||||
|
prevC = c;
|
||||||
|
}
|
||||||
|
if (!converged && _steps.Count > 0) rootVal = _steps.Last().X;
|
||||||
|
}
|
||||||
|
// ==========================================
|
||||||
|
// Method 4: All Roots in Interval [a, b]
|
||||||
|
// ==========================================
|
||||||
|
else if (methodIdx == 4)
|
||||||
|
{
|
||||||
|
var allRoots = NumericalMethods.FindAllRoots(eq, minX, maxX, varName);
|
||||||
|
if (allRoots.Count > 0)
|
||||||
|
{
|
||||||
|
converged = true;
|
||||||
|
rootVal = allRoots.First().Root;
|
||||||
|
statusMessage = $"[{minX}, {maxX}] aralığında toplam {allRoots.Count} kök bulundu.";
|
||||||
|
|
||||||
|
int stepIdx = 1;
|
||||||
|
foreach (var r in allRoots)
|
||||||
|
{
|
||||||
|
_steps.Add(new IterationStep
|
||||||
|
{
|
||||||
|
Step = stepIdx++,
|
||||||
|
X = r.Root,
|
||||||
|
Fx = r.FVal,
|
||||||
|
AbsError = 0m,
|
||||||
|
RelError = 0m
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
statusMessage = $"Belirtilen [{minX}, {maxX}] aralığında reel kök bulunamadı.";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
Function.UseRadians = prevRad;
|
Function.UseRadians = prevRad;
|
||||||
}
|
}
|
||||||
|
|
||||||
string rootFound = "";
|
|
||||||
for (int i = stepLogs.Count - 1; i >= 0; i--)
|
|
||||||
{
|
|
||||||
string line = stepLogs[i];
|
|
||||||
if (line.Contains("BULUNAN KÖK") || line.Contains("Root found:") || line.Contains($"{variable} =") || line.Contains("x ="))
|
|
||||||
{
|
|
||||||
rootFound = line;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return (stepLogs, rootFound);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
txtResult.Text = string.Join(Environment.NewLine, logs);
|
_lastRoot = rootVal;
|
||||||
|
|
||||||
if (!string.IsNullOrEmpty(finalRoot))
|
// Update KPI Card
|
||||||
|
if (converged || _steps.Count > 0)
|
||||||
{
|
{
|
||||||
string displayRoot = finalRoot.Replace(">>>", "").Replace("BULUNAN KÖK:", "").Replace("Root found:", "").Trim();
|
lblRootValue.Text = $"x* = {rootVal:F10}";
|
||||||
int parenIdx = displayRoot.IndexOf('(');
|
lblBadgeIter.Text = $"İterasyon: {_steps.Count} Adım";
|
||||||
if (parenIdx > 0) displayRoot = displayRoot.Substring(0, parenIdx).Trim();
|
lblBadgeError.Text = $"Son Hata: {(_steps.Count > 0 ? _steps.Last().AbsError.ToString("E3", CultureInfo.InvariantCulture) : "0")}";
|
||||||
lblRootValue.Text = displayRoot;
|
lblBadgeStatus.Text = converged ? "✓ Başarıyla Yakınsadı" : "⚠️ Yakınsamadı";
|
||||||
lblRootDetails.Text = $"✅ {logs.Count} iterasyon adımında başarıyla hesaplandı.";
|
lblBadgeStatus.BackColor = converged ? Color.FromArgb(6, 78, 59) : Color.FromArgb(127, 29, 29);
|
||||||
lblRootValue.ForeColor = Color.FromArgb(52, 211, 153);
|
lblBadgeStatus.ForeColor = converged ? Color.FromArgb(52, 211, 153) : Color.FromArgb(244, 63, 94);
|
||||||
|
|
||||||
|
lblRootDetails.Text = $"f(x*) = {NumericalMethods.Method_EvaluateFunction(eq, varName, rootVal):E4} • {statusMessage}";
|
||||||
}
|
}
|
||||||
else if (logs.Count > 0)
|
else
|
||||||
{
|
{
|
||||||
lblRootValue.Text = "Tamamlandı";
|
lblRootValue.Text = "Kök Bulunamadı";
|
||||||
lblRootDetails.Text = $"İterasyonlar tamamlandı ({logs.Count} adım).";
|
lblBadgeStatus.Text = "Hata / Tanımsız";
|
||||||
lblRootValue.ForeColor = Color.FromArgb(56, 189, 248);
|
lblRootDetails.Text = statusMessage;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Populate Grid
|
||||||
|
dgvIterations.Rows.Clear();
|
||||||
|
foreach (var st in _steps)
|
||||||
|
{
|
||||||
|
dgvIterations.Rows.Add(
|
||||||
|
st.Step,
|
||||||
|
st.X.ToString("F9", CultureInfo.InvariantCulture),
|
||||||
|
st.Fx.ToString("E4", CultureInfo.InvariantCulture),
|
||||||
|
st.AbsError.ToString("E4", CultureInfo.InvariantCulture),
|
||||||
|
st.RelError.ToString("F4", CultureInfo.InvariantCulture) + "%"
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Invalidate Plot
|
||||||
|
pnlConvergencePlot.Invalidate();
|
||||||
|
|
||||||
|
// Detailed Text Report
|
||||||
|
StringBuilder sb = new StringBuilder();
|
||||||
|
sb.AppendLine("=======================================================================");
|
||||||
|
sb.AppendLine(" DENKLEM KÖKÜ BULUCU ANALİTİK RAPORU");
|
||||||
|
sb.AppendLine("=======================================================================");
|
||||||
|
sb.AppendLine($" Denklem : f({varName}) = {eq} = 0");
|
||||||
|
sb.AppendLine($" Yöntem : {cmbMethod.SelectedItem}");
|
||||||
|
sb.AppendLine($" Tolerans (ε) : {_targetTolerance:E2}");
|
||||||
|
sb.AppendLine($" Maks. Adım : {maxIter}");
|
||||||
|
sb.AppendLine();
|
||||||
|
sb.AppendLine($" HESAPLANAN KÖK: x* = {rootVal:F10}");
|
||||||
|
sb.AppendLine($" f(x*) Değeri : {NumericalMethods.Method_EvaluateFunction(eq, varName, rootVal):G18}");
|
||||||
|
sb.AppendLine($" Toplam Adım : {_steps.Count}");
|
||||||
|
sb.AppendLine($" Durum Raporu : {statusMessage}");
|
||||||
|
sb.AppendLine();
|
||||||
|
sb.AppendLine("--- İterasyon Detayları ---");
|
||||||
|
foreach (var st in _steps)
|
||||||
|
{
|
||||||
|
sb.AppendLine($" Adım {st.Step,2}: x = {st.X:F9} │ f(x) = {st.Fx,12:E4} │ |Δx| = {st.AbsError:E4}");
|
||||||
|
}
|
||||||
|
txtResult.Text = sb.ToString();
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
txtResult.Text = "❌ Hata: " + ex.Message;
|
MessageBox.Show("Kök bulma hatası:\n" + ex.Message, "Hata", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
lblRootValue.Text = "Hata Oluştu";
|
lblRootValue.Text = "Hata Oluştu";
|
||||||
lblRootValue.ForeColor = Color.FromArgb(239, 68, 68);
|
|
||||||
lblRootDetails.Text = ex.Message;
|
lblRootDetails.Text = ex.Message;
|
||||||
|
lblBadgeStatus.Text = "❌ Hata";
|
||||||
|
lblBadgeStatus.BackColor = Color.FromArgb(127, 29, 29);
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
|
|
@ -274,5 +497,153 @@ namespace MathApp.Controls
|
||||||
Cursor = Cursors.Default;
|
Cursor = Cursors.Default;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void PnlConvergencePlot_Paint(object sender, PaintEventArgs e)
|
||||||
|
{
|
||||||
|
Graphics g = e.Graphics;
|
||||||
|
g.SmoothingMode = SmoothingMode.AntiAlias;
|
||||||
|
|
||||||
|
int w = pnlConvergencePlot.Width;
|
||||||
|
int h = pnlConvergencePlot.Height;
|
||||||
|
|
||||||
|
// Background
|
||||||
|
using (Brush bg = new SolidBrush(Color.FromArgb(15, 23, 42)))
|
||||||
|
{
|
||||||
|
g.FillRectangle(bg, 0, 0, w, h);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (_steps.Count < 2)
|
||||||
|
{
|
||||||
|
using (Font f = new Font("Segoe UI", 9F))
|
||||||
|
using (Brush b = new SolidBrush(Color.FromArgb(148, 163, 184)))
|
||||||
|
{
|
||||||
|
g.DrawString("Yakınsama grafiği için en az 2 iterasyon adımı gereklidir.", f, b, 20, 20);
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
int padLeft = 65;
|
||||||
|
int padRight = 30;
|
||||||
|
int padTop = 30;
|
||||||
|
int padBottom = 40;
|
||||||
|
|
||||||
|
float plotW = w - padLeft - padRight;
|
||||||
|
float plotH = h - padTop - padBottom;
|
||||||
|
if (plotW <= 10 || plotH <= 10) return;
|
||||||
|
|
||||||
|
// Compute Log10 of Errors
|
||||||
|
List<float> logErrors = new List<float>();
|
||||||
|
foreach (var st in _steps)
|
||||||
|
{
|
||||||
|
double err = (double)Math.Max(1e-16m, st.AbsError);
|
||||||
|
logErrors.Add((float)Math.Log10(err));
|
||||||
|
}
|
||||||
|
|
||||||
|
float minLog = logErrors.Min();
|
||||||
|
float maxLog = Math.Max(0f, logErrors.Max());
|
||||||
|
if (Math.Abs(maxLog - minLog) < 1f) { maxLog += 0.5f; minLog -= 0.5f; }
|
||||||
|
|
||||||
|
float MapX(int stepIdx) => padLeft + (stepIdx / (float)(_steps.Count - 1)) * plotW;
|
||||||
|
float MapY(float logVal) => padTop + (1f - (logVal - minLog) / (maxLog - minLog)) * plotH;
|
||||||
|
|
||||||
|
// Draw Grid Lines & Y Labels
|
||||||
|
using (Pen gridPen = new Pen(Color.FromArgb(30, 41, 59), 1f) { DashStyle = DashStyle.Dash })
|
||||||
|
using (Font f = new Font("Segoe UI", 8F))
|
||||||
|
using (Brush fontBr = new SolidBrush(Color.FromArgb(148, 163, 184)))
|
||||||
|
{
|
||||||
|
for (float lv = (float)Math.Floor(minLog); lv <= maxLog; lv += 2f)
|
||||||
|
{
|
||||||
|
float sy = MapY(lv);
|
||||||
|
if (sy >= padTop && sy <= padTop + plotH)
|
||||||
|
{
|
||||||
|
g.DrawLine(gridPen, padLeft, sy, padLeft + plotW, sy);
|
||||||
|
g.DrawString($"10^{lv:F0}", f, fontBr, 10, sy - 7);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// X Axis Steps
|
||||||
|
for (int s = 0; s < _steps.Count; s += Math.Max(1, _steps.Count / 8))
|
||||||
|
{
|
||||||
|
float sx = MapX(s);
|
||||||
|
g.DrawLine(gridPen, sx, padTop, sx, padTop + plotH);
|
||||||
|
g.DrawString($"k={_steps[s].Step}", f, fontBr, sx - 10, padTop + plotH + 8);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Title
|
||||||
|
g.DrawString("📉 Hata Yakınsama Hızı Grafiği (Log10(|Δx|) vs İterasyon)", new Font("Segoe UI Semibold", 8.5F, FontStyle.Bold), fontBr, padLeft, 8);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Draw Tolerance Line
|
||||||
|
float tolLog = (float)Math.Log10((double)_targetTolerance);
|
||||||
|
float tolY = MapY(tolLog);
|
||||||
|
if (tolY >= padTop && tolY <= padTop + plotH)
|
||||||
|
{
|
||||||
|
using (Pen tolPen = new Pen(Color.FromArgb(244, 63, 94), 1.2f) { DashStyle = DashStyle.Dot })
|
||||||
|
using (Font tf = new Font("Segoe UI", 7.5F))
|
||||||
|
using (Brush tb = new SolidBrush(Color.FromArgb(244, 63, 94)))
|
||||||
|
{
|
||||||
|
g.DrawLine(tolPen, padLeft, tolY, padLeft + plotW, tolY);
|
||||||
|
g.DrawString($"Hedef ε ({_targetTolerance:E1})", tf, tb, padLeft + plotW - 90, tolY - 14);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Draw Convergence Line & Points
|
||||||
|
List<PointF> pts = new List<PointF>();
|
||||||
|
for (int i = 0; i < logErrors.Count; i++)
|
||||||
|
{
|
||||||
|
pts.Add(new PointF(MapX(i), MapY(logErrors[i])));
|
||||||
|
}
|
||||||
|
|
||||||
|
using (Pen linePen = new Pen(Color.FromArgb(52, 211, 153), 2.2f))
|
||||||
|
using (Brush dotBrush = new SolidBrush(Color.FromArgb(250, 204, 21)))
|
||||||
|
{
|
||||||
|
if (pts.Count > 1)
|
||||||
|
{
|
||||||
|
g.DrawLines(linePen, pts.ToArray());
|
||||||
|
}
|
||||||
|
foreach (var p in pts)
|
||||||
|
{
|
||||||
|
g.FillEllipse(dotBrush, p.X - 3.5f, p.Y - 3.5f, 7f, 7f);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void BtnPlotOnGraph_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (string.IsNullOrWhiteSpace(_lastEquation))
|
||||||
|
{
|
||||||
|
MessageBox.Show("Önce bir fonksiyon kökü hesaplayınız.", "Bilgi", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
float? rootX = _lastRoot.HasValue ? (float)_lastRoot.Value : null;
|
||||||
|
MainForm.Instance?.NavigateToGraph(_lastEquation, rootX, 0f);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void BtnCopyResult_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
string copyText = "";
|
||||||
|
if (tabResults.SelectedTab == tabText) copyText = txtResult.Text;
|
||||||
|
else if (tabResults.SelectedTab == tabGrid)
|
||||||
|
{
|
||||||
|
StringBuilder sb = new StringBuilder();
|
||||||
|
sb.AppendLine("Adım\tx_k\tf(x_k)\t|Δx|\tBağıl Hata");
|
||||||
|
foreach (DataGridViewRow r in dgvIterations.Rows)
|
||||||
|
{
|
||||||
|
sb.AppendLine($"{r.Cells[0].Value}\t{r.Cells[1].Value}\t{r.Cells[2].Value}\t{r.Cells[3].Value}\t{r.Cells[4].Value}");
|
||||||
|
}
|
||||||
|
copyText = sb.ToString();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
copyText = $"Kök: {_lastRoot}\nDenklem: {_lastEquation}";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!string.IsNullOrEmpty(copyText))
|
||||||
|
{
|
||||||
|
Clipboard.SetText(copyText);
|
||||||
|
MessageBox.Show("Sonuç panoya kopyalandı!", "Başarılı", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
2
src/ttCalculator/MainForm.Designer.cs
generated
2
src/ttCalculator/MainForm.Designer.cs
generated
|
|
@ -156,7 +156,7 @@ namespace MathApp
|
||||||
// Footer version label
|
// Footer version label
|
||||||
this.lblVersion.Dock = DockStyle.Bottom;
|
this.lblVersion.Dock = DockStyle.Bottom;
|
||||||
this.lblVersion.Height = 28;
|
this.lblVersion.Height = 28;
|
||||||
this.lblVersion.Text = "v3.3 • 128-bit Decimal Motoru • 60 FPS";
|
this.lblVersion.Text = "v3.4 • 128-bit Decimal Motoru • 60 FPS";
|
||||||
this.lblVersion.Font = new Font("Segoe UI", 8F);
|
this.lblVersion.Font = new Font("Segoe UI", 8F);
|
||||||
this.lblVersion.ForeColor = Color.FromArgb(100, 116, 139);
|
this.lblVersion.ForeColor = Color.FromArgb(100, 116, 139);
|
||||||
this.lblVersion.TextAlign = ContentAlignment.MiddleCenter;
|
this.lblVersion.TextAlign = ContentAlignment.MiddleCenter;
|
||||||
|
|
|
||||||
|
|
@ -27,6 +27,8 @@ namespace MathApp
|
||||||
private Button[] allNavButtons;
|
private Button[] allNavButtons;
|
||||||
private Button activeNavButton;
|
private Button activeNavButton;
|
||||||
|
|
||||||
|
public static MainForm Instance { get; private set; }
|
||||||
|
|
||||||
protected override CreateParams CreateParams
|
protected override CreateParams CreateParams
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
|
|
@ -41,6 +43,7 @@ namespace MathApp
|
||||||
|
|
||||||
public MainForm()
|
public MainForm()
|
||||||
{
|
{
|
||||||
|
Instance = this;
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
ThemeHelper.EnableDoubleBuffering(this);
|
ThemeHelper.EnableDoubleBuffering(this);
|
||||||
LoadApplicationIcon();
|
LoadApplicationIcon();
|
||||||
|
|
@ -233,6 +236,20 @@ namespace MathApp
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void NavigateToGraph(string equation, float? pointX = null, float? pointY = null)
|
||||||
|
{
|
||||||
|
if (!string.IsNullOrWhiteSpace(equation))
|
||||||
|
{
|
||||||
|
graphControl.AddFunctionCurve(equation, false, -10f, 10f);
|
||||||
|
}
|
||||||
|
if (pointX.HasValue && pointY.HasValue)
|
||||||
|
{
|
||||||
|
graphControl.AddMarkedPoint(pointX.Value, pointY.Value, "Kök", Color.FromArgb(16, 185, 129));
|
||||||
|
}
|
||||||
|
ShowControl(graphControl);
|
||||||
|
HighlightButton(btnNavGraph);
|
||||||
|
}
|
||||||
|
|
||||||
private void ShowControl(UserControl control)
|
private void ShowControl(UserControl control)
|
||||||
{
|
{
|
||||||
if (control == null || allControls == null) return;
|
if (control == null || allControls == null) return;
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,7 @@
|
||||||
<ApplicationIcon>logo.ico</ApplicationIcon>
|
<ApplicationIcon>logo.ico</ApplicationIcon>
|
||||||
<AssemblyName>ttCalculator</AssemblyName>
|
<AssemblyName>ttCalculator</AssemblyName>
|
||||||
<Product>ttCalculator - Gelişmiş Matematik & Nümerik Analiz Stüdyosu</Product>
|
<Product>ttCalculator - Gelişmiş Matematik & Nümerik Analiz Stüdyosu</Product>
|
||||||
<Version>3.3.0</Version>
|
<Version>3.4.0</Version>
|
||||||
<Company>ttCalculator</Company>
|
<Company>ttCalculator</Company>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@ namespace MathApp.Tests
|
||||||
static void Main(string[] args)
|
static void Main(string[] args)
|
||||||
{
|
{
|
||||||
Console.WriteLine("=================================================");
|
Console.WriteLine("=================================================");
|
||||||
Console.WriteLine("ttCalculator v3.3 Graph Plotter Studio Verification");
|
Console.WriteLine("ttCalculator v3.4 Numerical Studios Verification");
|
||||||
Console.WriteLine("=================================================");
|
Console.WriteLine("=================================================");
|
||||||
|
|
||||||
int passed = 0;
|
int passed = 0;
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue