kececinumbers 0.3.0__py3-none-any.whl → 0.3.1__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
kececinumbers/__init__.py CHANGED
@@ -34,4 +34,4 @@ def eski_fonksiyon():
34
34
 
35
35
 
36
36
  # Paket sürüm numarası
37
- __version__ = "0.3.0"
37
+ __version__ = "0.3.1"
kececinumbers/_version.py CHANGED
@@ -1,6 +1,6 @@
1
1
  # _version.py
2
2
 
3
- __version__ = "0.3.0"
3
+ __version__ = "0.3.1"
4
4
  __license__ = "MIT"
5
5
  __description__ = "Keçeci Numbers: An Exploration of a Dynamic Sequence Across Diverse Number Sets."
6
6
  __author__ = "Mehmet Keçeci"
@@ -457,142 +457,6 @@ def _is_divisible(value, divisor, kececi_type):
457
457
  return False
458
458
  return False
459
459
 
460
- # ==============================================================================
461
- # --- CORE GENERATOR ---
462
- # ==============================================================================
463
-
464
- def unified_generator(kececi_type, start_input_raw, add_input_base_scalar, iterations):
465
- """
466
- Herhangi bir desteklenen türde Keçeci Sayı dizileri üreten çekirdek motor.
467
- Bu sürüm, tüm tipler için sağlam tür dönüştürme ve özel format ayrıştırma içerir.
468
- """
469
- current_value = None
470
- add_value_typed = None
471
- ask_unit = None
472
- use_integer_division = False
473
-
474
- try:
475
- # --- Adım 1: Keçeci Türüne Göre Başlatma ---
476
- a_float = float(add_input_base_scalar)
477
-
478
- if kececi_type in [TYPE_POSITIVE_REAL, TYPE_NEGATIVE_REAL]:
479
- s_int = int(float(start_input_raw))
480
- current_value = s_int
481
- add_value_typed = int(a_float)
482
- ask_unit = 1
483
- use_integer_division = True
484
-
485
- elif kececi_type == TYPE_FLOAT:
486
- current_value = float(start_input_raw)
487
- add_value_typed = a_float
488
- ask_unit = 1.0
489
-
490
- elif kececi_type == TYPE_RATIONAL:
491
- current_value = Fraction(start_input_raw)
492
- add_value_typed = Fraction(add_input_base_scalar)
493
- ask_unit = Fraction(1)
494
-
495
- elif kececi_type == TYPE_COMPLEX:
496
- current_value = _parse_complex(start_input_raw)
497
- add_value_typed = complex(a_float, a_float)
498
- ask_unit = 1 + 1j
499
-
500
- elif kececi_type == TYPE_NEUTROSOPHIC:
501
- a, b = _parse_neutrosophic(start_input_raw)
502
- current_value = NeutrosophicNumber(a, b)
503
- add_value_typed = NeutrosophicNumber(a_float, 0)
504
- ask_unit = NeutrosophicNumber(1, 1)
505
-
506
- # --- YENİ EKLENEN/DÜZELTİLEN BLOKLAR ---
507
-
508
- elif kececi_type == TYPE_NEUTROSOPHIC_COMPLEX: # HATA DÜZELTİLDİ
509
- s_complex = _parse_complex(start_input_raw)
510
- # Başlangıç indeterminacy değerini 0 olarak varsayalım
511
- current_value = NeutrosophicComplexNumber(s_complex.real, s_complex.imag, 0.0)
512
- # Artış, deterministik reel kısma etki eder
513
- add_value_typed = NeutrosophicComplexNumber(a_float, 0.0, 0.0)
514
- ask_unit = NeutrosophicComplexNumber(1, 1, 1)
515
-
516
- elif kececi_type == TYPE_HYPERREAL: # HATA DÜZELTİLDİ
517
- a, b = _parse_hyperreal(start_input_raw)
518
- # 'a' reel kısmı, 'b' ise sonsuz küçükleri ölçekler
519
- sequence_list = [a + b / n for n in range(1, 11)]
520
- current_value = HyperrealNumber(sequence_list)
521
- # Artış, sadece standart (ilk) reel kısma etki eder
522
- add_sequence = [a_float] + [0.0] * 9
523
- add_value_typed = HyperrealNumber(add_sequence)
524
- ask_unit = HyperrealNumber([1.0] * 10)
525
-
526
- elif kececi_type == TYPE_BICOMPLEX: # Mantık aynı, sadece ayrıştırıcıyı kullanıyor
527
- s_complex = _parse_complex(start_input_raw)
528
- a_complex = complex(a_float)
529
- current_value = BicomplexNumber(s_complex, s_complex / 2)
530
- add_value_typed = BicomplexNumber(a_complex, a_complex / 2)
531
- ask_unit = BicomplexNumber(complex(1, 1), complex(0.5, 0.5))
532
-
533
- elif kececi_type == TYPE_NEUTROSOPHIC_BICOMPLEX: # HATA DÜZELTİLDİ
534
- s_complex = _parse_complex(start_input_raw)
535
- # Başlangıç değeri olarak kompleks sayıyı kullanıp diğer 6 bileşeni 0 yapalım
536
- current_value = NeutrosophicBicomplexNumber(s_complex.real, s_complex.imag, 0, 0, 0, 0, 0, 0)
537
- # Artış, sadece ana reel kısma etki eder
538
- add_value_typed = NeutrosophicBicomplexNumber(a_float, 0, 0, 0, 0, 0, 0, 0)
539
- ask_unit = NeutrosophicBicomplexNumber(*([1.0] * 8))
540
-
541
- # --- DİĞER TİPLER ---
542
-
543
- elif kececi_type == TYPE_QUATERNION:
544
- s_float = float(start_input_raw)
545
- current_value = np.quaternion(s_float, s_float, s_float, s_float)
546
- add_value_typed = np.quaternion(a_float, a_float, a_float, a_float)
547
- ask_unit = np.quaternion(1, 1, 1, 1)
548
-
549
- else:
550
- raise ValueError(f"Geçersiz veya desteklenmeyen Keçeci Sayı Tipi: {kececi_type}")
551
-
552
- except (ValueError, TypeError) as e:
553
- print(f"HATA: Tip {kececi_type} için '{start_input_raw}' girdisiyle başlatma başarısız: {e}")
554
- return []
555
-
556
- # --- Adım 2: İterasyon Döngüsü ---
557
- sequence = [current_value]
558
- last_divisor_used = None
559
- ask_counter = 0
560
-
561
- for _ in range(iterations):
562
- added_value = current_value + add_value_typed
563
- sequence.append(added_value)
564
-
565
- result_value = added_value
566
- divided_successfully = False
567
-
568
- primary_divisor = 3 if last_divisor_used == 2 or last_divisor_used is None else 2
569
- alternative_divisor = 2 if primary_divisor == 3 else 3
570
-
571
- for divisor in [primary_divisor, alternative_divisor]:
572
- if _is_divisible(added_value, divisor, kececi_type):
573
- result_value = added_value // divisor if use_integer_division else added_value / divisor
574
- last_divisor_used = divisor
575
- divided_successfully = True
576
- break
577
-
578
- if not divided_successfully and is_prime(added_value):
579
- modified_value = (added_value + ask_unit) if ask_counter == 0 else (added_value - ask_unit)
580
- ask_counter = 1 - ask_counter
581
- sequence.append(modified_value)
582
-
583
- result_value = modified_value
584
-
585
- for divisor in [primary_divisor, alternative_divisor]:
586
- if _is_divisible(modified_value, divisor, kececi_type):
587
- result_value = modified_value // divisor if use_integer_division else modified_value / divisor
588
- last_divisor_used = divisor
589
- break
590
-
591
- sequence.append(result_value)
592
- current_value = result_value
593
-
594
- return sequence
595
-
596
460
  def _parse_complex(s: str) -> complex:
597
461
  """
598
462
  Bir string'i kompleks sayıya çevirir.
@@ -700,6 +564,58 @@ def _parse_hyperreal(s: str) -> (float, float):
700
564
 
701
565
  return a, b
702
566
 
567
+ def _parse_quaternion(s: str) -> np.quaternion:
568
+ """
569
+ Kullanıcıdan gelen metin girdisini ('a+bi+cj+dk' veya sadece skaler)
570
+ bir kuaterniyon nesnesine çevirir.
571
+
572
+ Örnekler:
573
+ - '2.5' -> quaternion(2.5, 2.5, 2.5, 2.5)
574
+ - '2.5+2.5i+2.5j+2.5k' -> quaternion(2.5, 2.5, 2.5, 2.5)
575
+ - '1-2i+3.5j-k' -> quaternion(1, -2, 3.5, -1)
576
+ """
577
+ s_clean = s.replace(" ", "").lower()
578
+ if not s_clean:
579
+ raise ValueError("Girdi boş olamaz.")
580
+
581
+ # Girdinin sadece bir sayı olup olmadığını kontrol et
582
+ try:
583
+ val = float(s_clean)
584
+ # Programın orijinal mantığına göre skalerden kuaterniyon oluştur
585
+ return np.quaternion(val, val, val, val)
586
+ except ValueError:
587
+ # Girdi tam bir kuaterniyon ifadesi, ayrıştırmaya devam et
588
+ pass
589
+
590
+ # Tüm kuaterniyon bileşenlerini bulmak için daha esnek bir regex
591
+ # Örnek: '-10.5j', '+2i', '5', '-k' gibi parçaları yakalar
592
+ pattern = re.compile(r'([+-]?\d*\.?\d+)([ijk])?')
593
+ matches = pattern.findall(s_clean.replace('i', 'i ').replace('j', 'j ').replace('k', 'k ')) # Ayrıştırmayı kolaylaştır
594
+
595
+ parts = {'w': 0.0, 'x': 0.0, 'y': 0.0, 'z': 0.0}
596
+
597
+ # 'i', 'j', 'k' olmayan katsayıları ('-1k' gibi) düzeltmek için
598
+ s_temp = s_clean
599
+ for val_str, comp in re.findall(r'([+-])([ijk])', s_clean):
600
+ s_temp = s_temp.replace(val_str+comp, f'{val_str}1{comp}')
601
+
602
+ matches = pattern.findall(s_temp)
603
+
604
+ if not matches:
605
+ raise ValueError(f"Geçersiz kuaterniyon formatı: '{s}'")
606
+
607
+ for value_str, component in matches:
608
+ value = float(value_str)
609
+ if component == 'i':
610
+ parts['x'] += value
611
+ elif component == 'j':
612
+ parts['y'] += value
613
+ elif component == 'k':
614
+ parts['z'] += value
615
+ else: # Reel kısım
616
+ parts['w'] += value
617
+
618
+ return np.quaternion(parts['w'], parts['x'], parts['y'], parts['z'])
703
619
 
704
620
  def get_random_type(num_iterations, fixed_start_raw="0", fixed_add_base_scalar=9.0):
705
621
  """
@@ -730,6 +646,146 @@ def get_random_type(num_iterations, fixed_start_raw="0", fixed_add_base_scalar=9
730
646
 
731
647
  return generated_sequence
732
648
 
649
+ # ==============================================================================
650
+ # --- CORE GENERATOR ---
651
+ # ==============================================================================
652
+
653
+ def unified_generator(kececi_type, start_input_raw, add_input_base_scalar, iterations):
654
+ """
655
+ Herhangi bir desteklenen türde Keçeci Sayı dizileri üreten çekirdek motor.
656
+ Bu sürüm, tüm tipler için sağlam tür dönüştürme ve özel format ayrıştırma içerir.
657
+ """
658
+ current_value = None
659
+ add_value_typed = None
660
+ ask_unit = None
661
+ use_integer_division = False
662
+
663
+ try:
664
+ # --- Adım 1: Keçeci Türüne Göre Başlatma ---
665
+ a_float = float(add_input_base_scalar)
666
+
667
+ if kececi_type in [TYPE_POSITIVE_REAL, TYPE_NEGATIVE_REAL]:
668
+ s_int = int(float(start_input_raw))
669
+ current_value = s_int
670
+ add_value_typed = int(a_float)
671
+ ask_unit = 1
672
+ use_integer_division = True
673
+
674
+ elif kececi_type == TYPE_FLOAT:
675
+ current_value = float(start_input_raw)
676
+ add_value_typed = a_float
677
+ ask_unit = 1.0
678
+
679
+ elif kececi_type == TYPE_RATIONAL:
680
+ current_value = Fraction(start_input_raw)
681
+ add_value_typed = Fraction(add_input_base_scalar)
682
+ ask_unit = Fraction(1)
683
+
684
+ elif kececi_type == TYPE_COMPLEX:
685
+ current_value = _parse_complex(start_input_raw)
686
+ add_value_typed = complex(a_float, a_float)
687
+ ask_unit = 1 + 1j
688
+
689
+ elif kececi_type == TYPE_NEUTROSOPHIC:
690
+ a, b = _parse_neutrosophic(start_input_raw)
691
+ current_value = NeutrosophicNumber(a, b)
692
+ add_value_typed = NeutrosophicNumber(a_float, 0)
693
+ ask_unit = NeutrosophicNumber(1, 1)
694
+
695
+ # --- YENİ EKLENEN/DÜZELTİLEN BLOKLAR ---
696
+
697
+ elif kececi_type == TYPE_NEUTROSOPHIC_COMPLEX: # HATA DÜZELTİLDİ
698
+ s_complex = _parse_complex(start_input_raw)
699
+ # Başlangıç indeterminacy değerini 0 olarak varsayalım
700
+ current_value = NeutrosophicComplexNumber(s_complex.real, s_complex.imag, 0.0)
701
+ # Artış, deterministik reel kısma etki eder
702
+ add_value_typed = NeutrosophicComplexNumber(a_float, 0.0, 0.0)
703
+ ask_unit = NeutrosophicComplexNumber(1, 1, 1)
704
+
705
+ elif kececi_type == TYPE_HYPERREAL: # HATA DÜZELTİLDİ
706
+ a, b = _parse_hyperreal(start_input_raw)
707
+ # 'a' reel kısmı, 'b' ise sonsuz küçükleri ölçekler
708
+ sequence_list = [a + b / n for n in range(1, 11)]
709
+ current_value = HyperrealNumber(sequence_list)
710
+ # Artış, sadece standart (ilk) reel kısma etki eder
711
+ add_sequence = [a_float] + [0.0] * 9
712
+ add_value_typed = HyperrealNumber(add_sequence)
713
+ ask_unit = HyperrealNumber([1.0] * 10)
714
+
715
+ elif kececi_type == TYPE_BICOMPLEX: # Mantık aynı, sadece ayrıştırıcıyı kullanıyor
716
+ s_complex = _parse_complex(start_input_raw)
717
+ a_complex = complex(a_float)
718
+ current_value = BicomplexNumber(s_complex, s_complex / 2)
719
+ add_value_typed = BicomplexNumber(a_complex, a_complex / 2)
720
+ ask_unit = BicomplexNumber(complex(1, 1), complex(0.5, 0.5))
721
+
722
+ elif kececi_type == TYPE_NEUTROSOPHIC_BICOMPLEX: # HATA DÜZELTİLDİ
723
+ s_complex = _parse_complex(start_input_raw)
724
+ # Başlangıç değeri olarak kompleks sayıyı kullanıp diğer 6 bileşeni 0 yapalım
725
+ current_value = NeutrosophicBicomplexNumber(s_complex.real, s_complex.imag, 0, 0, 0, 0, 0, 0)
726
+ # Artış, sadece ana reel kısma etki eder
727
+ add_value_typed = NeutrosophicBicomplexNumber(a_float, 0, 0, 0, 0, 0, 0, 0)
728
+ ask_unit = NeutrosophicBicomplexNumber(*([1.0] * 8))
729
+
730
+ # --- DİĞER TİPLER ---
731
+
732
+ elif kececi_type == TYPE_QUATERNION:
733
+ # Artık girdiyi doğrudan float'a çevirmek yerine,
734
+ # hem skaler hem de tam ifadeyi ayrıştırabilen fonksiyonu kullanıyoruz.
735
+ current_value = _parse_quaternion(start_input_raw)
736
+
737
+ # Artırım değeri (add_value) genellikle basit bir skalerdir,
738
+ # bu yüzden bu kısım aynı kalabilir.
739
+ add_value_typed = np.quaternion(a_float, a_float, a_float, a_float)
740
+ ask_unit = np.quaternion(1, 1, 1, 1)
741
+
742
+ else:
743
+ raise ValueError(f"Geçersiz veya desteklenmeyen Keçeci Sayı Tipi: {kececi_type}")
744
+
745
+ except (ValueError, TypeError) as e:
746
+ print(f"HATA: Tip {kececi_type} için '{start_input_raw}' girdisiyle başlatma başarısız: {e}")
747
+ return []
748
+
749
+ # --- Adım 2: İterasyon Döngüsü ---
750
+ sequence = [current_value]
751
+ last_divisor_used = None
752
+ ask_counter = 0
753
+
754
+ for _ in range(iterations):
755
+ added_value = current_value + add_value_typed
756
+ sequence.append(added_value)
757
+
758
+ result_value = added_value
759
+ divided_successfully = False
760
+
761
+ primary_divisor = 3 if last_divisor_used == 2 or last_divisor_used is None else 2
762
+ alternative_divisor = 2 if primary_divisor == 3 else 3
763
+
764
+ for divisor in [primary_divisor, alternative_divisor]:
765
+ if _is_divisible(added_value, divisor, kececi_type):
766
+ result_value = added_value // divisor if use_integer_division else added_value / divisor
767
+ last_divisor_used = divisor
768
+ divided_successfully = True
769
+ break
770
+
771
+ if not divided_successfully and is_prime(added_value):
772
+ modified_value = (added_value + ask_unit) if ask_counter == 0 else (added_value - ask_unit)
773
+ ask_counter = 1 - ask_counter
774
+ sequence.append(modified_value)
775
+
776
+ result_value = modified_value
777
+
778
+ for divisor in [primary_divisor, alternative_divisor]:
779
+ if _is_divisible(modified_value, divisor, kececi_type):
780
+ result_value = modified_value // divisor if use_integer_division else modified_value / divisor
781
+ last_divisor_used = divisor
782
+ break
783
+
784
+ sequence.append(result_value)
785
+ current_value = result_value
786
+
787
+ return sequence
788
+
733
789
  def print_detailed_report(sequence, params):
734
790
  """
735
791
  Generates and prints a detailed report of the Keçeci sequence results.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: kececinumbers
3
- Version: 0.3.0
3
+ Version: 0.3.1
4
4
  Summary: Keçeci Numbers: An Exploration of a Dynamic Sequence Across Diverse Number Sets
5
5
  Home-page: https://github.com/WhiteSymmetry/kececinumbers
6
6
  Author: Mehmet Keçeci
@@ -218,7 +218,17 @@ Keçeci Number Types:
218
218
 
219
219
  6: Quaternions (scalar start input becomes q(s,s,s,s): e.g., 1 or 2.5)
220
220
 
221
- Please select Keçeci Number Type (1-6): 1
221
+ 7: Neutrosophic
222
+
223
+ 8: Neutro-Complex
224
+
225
+ 9: Hyperreal
226
+
227
+ 10: Bicomplex
228
+
229
+ 11: Neutro-Bicomplex
230
+
231
+ Please select Keçeci Number Type (1-11): 1
222
232
 
223
233
  Enter the starting number (e.g., 0 or 2.5, complex:3+4j, rational: 3/4, quaternions: 1) : 0
224
234
 
@@ -0,0 +1,8 @@
1
+ kececinumbers/__init__.py,sha256=LvYVIpFwtVQFC96CoVl_6Dl-wGDq5Z_wdYNM9xEOm_o,1427
2
+ kececinumbers/_version.py,sha256=5Me7OC9f5i_J_SZL1X16-PL4uJBlBEVYbEQzP10j62Y,428
3
+ kececinumbers/kececinumbers.py,sha256=yoYthgKqEx4h4Mk3vAcKuc5bQ9R6nQqcPK7fBT8FXfY,48675
4
+ kececinumbers-0.3.1.dist-info/licenses/LICENSE,sha256=NJZsJEbQuKzxn1mWPWCbRx8jRUqGS22thl8wwuRQJ9c,1071
5
+ kececinumbers-0.3.1.dist-info/METADATA,sha256=jOkFLfHvc2MUC8re9-YaiV9w1jp3iI02lwdFB9wDM1o,15499
6
+ kececinumbers-0.3.1.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
7
+ kececinumbers-0.3.1.dist-info/top_level.txt,sha256=VvlbQKmTjOlzBbvq54-AaXp_WPRZ5dOhw91lV-ytPRQ,14
8
+ kececinumbers-0.3.1.dist-info/RECORD,,
@@ -1,8 +0,0 @@
1
- kececinumbers/__init__.py,sha256=PPcSRN9XDmCebyzqVkNUIv2lWsMGRc2F_C8QDv0DPL4,1427
2
- kececinumbers/_version.py,sha256=4nBagc2NMpbf3Ot8Of1OyJ26DHuiiw3plqDzffzYx3Q,428
3
- kececinumbers/kececinumbers.py,sha256=xQVXYKnhdm2-7ExXkTIPeIvV26Y4Z9flKXyCDdAG4qo,46489
4
- kececinumbers-0.3.0.dist-info/licenses/LICENSE,sha256=NJZsJEbQuKzxn1mWPWCbRx8jRUqGS22thl8wwuRQJ9c,1071
5
- kececinumbers-0.3.0.dist-info/METADATA,sha256=0T0kaFaiz7je-_aDd-USw6-QeTXmMftybMLcwVspLvQ,15394
6
- kececinumbers-0.3.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
7
- kececinumbers-0.3.0.dist-info/top_level.txt,sha256=VvlbQKmTjOlzBbvq54-AaXp_WPRZ5dOhw91lV-ytPRQ,14
8
- kececinumbers-0.3.0.dist-info/RECORD,,