kececinumbers 0.5.3__tar.gz → 0.5.4__tar.gz
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-0.5.3/kececinumbers.egg-info → kececinumbers-0.5.4}/PKG-INFO +1 -1
- {kececinumbers-0.5.3 → kececinumbers-0.5.4}/kececinumbers/__init__.py +1 -1
- {kececinumbers-0.5.3 → kececinumbers-0.5.4}/kececinumbers/_version.py +1 -1
- {kececinumbers-0.5.3 → kececinumbers-0.5.4}/kececinumbers/kececinumbers.py +72 -32
- {kececinumbers-0.5.3 → kececinumbers-0.5.4/kececinumbers.egg-info}/PKG-INFO +1 -1
- {kececinumbers-0.5.3 → kececinumbers-0.5.4}/pyproject.toml +1 -1
- {kececinumbers-0.5.3 → kececinumbers-0.5.4}/LICENSE +0 -0
- {kececinumbers-0.5.3 → kececinumbers-0.5.4}/MANIFEST.in +0 -0
- {kececinumbers-0.5.3 → kececinumbers-0.5.4}/README.md +0 -0
- {kececinumbers-0.5.3 → kececinumbers-0.5.4}/docs/conf.py +0 -0
- {kececinumbers-0.5.3 → kececinumbers-0.5.4}/kececinumbers.egg-info/SOURCES.txt +0 -0
- {kececinumbers-0.5.3 → kececinumbers-0.5.4}/kececinumbers.egg-info/dependency_links.txt +0 -0
- {kececinumbers-0.5.3 → kececinumbers-0.5.4}/kececinumbers.egg-info/requires.txt +0 -0
- {kececinumbers-0.5.3 → kececinumbers-0.5.4}/kececinumbers.egg-info/top_level.txt +0 -0
- {kececinumbers-0.5.3 → kececinumbers-0.5.4}/setup.cfg +0 -0
- {kececinumbers-0.5.3 → kececinumbers-0.5.4}/setup.py +0 -0
- {kececinumbers-0.5.3 → kececinumbers-0.5.4}/tests/test_sample.py +0 -0
@@ -548,11 +548,24 @@ def _parse_quaternion_from_csv(s: str) -> np.quaternion:
|
|
548
548
|
# --- CORE GENERATOR ---
|
549
549
|
# ==============================================================================
|
550
550
|
|
551
|
-
def unified_generator(kececi_type: int, start_input_raw: str, add_input_raw: str, iterations: int) -> List[Any]:
|
551
|
+
def unified_generator(kececi_type: int, start_input_raw: str, add_input_raw: str, iterations: int, include_intermediate_steps: bool = False) -> List[Any]:
|
552
552
|
"""
|
553
553
|
Core engine to generate Keçeci Number sequences.
|
554
|
-
|
555
|
-
|
554
|
+
|
555
|
+
Bu güncellenmiş versiyon, tüm sayı tipleri için esnek girdi işleme,
|
556
|
+
kuaterniyonlar için tam vektörel toplama desteği sunar ve isteğe bağlı
|
557
|
+
olarak ara hesaplama adımlarını da döndürebilir.
|
558
|
+
|
559
|
+
Args:
|
560
|
+
kececi_type (int): Keçeci Sayı türü (1-11).
|
561
|
+
start_input_raw (str): Başlangıç değerini temsil eden metin.
|
562
|
+
add_input_raw (str): Her adımda eklenecek sabiti temsil eden metin.
|
563
|
+
iterations (int): Üretilecek Keçeci adımı sayısı.
|
564
|
+
include_intermediate_steps (bool, optional): True ise, ara hesaplama
|
565
|
+
değerlerini de son listeye ekler. Varsayılan: False.
|
566
|
+
|
567
|
+
Returns:
|
568
|
+
List[Any]: Oluşturulan Keçeci Sayıları dizisi.
|
556
569
|
"""
|
557
570
|
|
558
571
|
if not (TYPE_POSITIVE_REAL <= kececi_type <= TYPE_NEUTROSOPHIC_BICOMPLEX):
|
@@ -564,34 +577,33 @@ def unified_generator(kececi_type: int, start_input_raw: str, add_input_raw: str
|
|
564
577
|
use_integer_division = False
|
565
578
|
|
566
579
|
try:
|
567
|
-
#
|
568
|
-
#
|
580
|
+
# Her sayı tipi, kendi `elif` bloğu içinde kendi girdisini işler.
|
581
|
+
# Bu, farklı formatlardaki (örn: '1.5' vs '1,2,3,4') girdilerin
|
582
|
+
# hatasız bir şekilde yönetilmesini sağlar.
|
569
583
|
|
570
584
|
if kececi_type in [TYPE_POSITIVE_REAL, TYPE_NEGATIVE_REAL]:
|
571
585
|
current_value = int(float(start_input_raw))
|
572
|
-
add_value_typed = int(float(add_input_raw))
|
586
|
+
add_value_typed = int(float(add_input_raw))
|
573
587
|
ask_unit = 1
|
574
588
|
use_integer_division = True
|
575
589
|
|
576
590
|
elif kececi_type == TYPE_FLOAT:
|
577
591
|
current_value = float(start_input_raw)
|
578
|
-
add_value_typed = float(add_input_raw)
|
592
|
+
add_value_typed = float(add_input_raw)
|
579
593
|
ask_unit = 1.0
|
580
594
|
|
581
595
|
elif kececi_type == TYPE_RATIONAL:
|
582
596
|
current_value = Fraction(start_input_raw)
|
583
|
-
add_value_typed = Fraction(add_input_raw)
|
597
|
+
add_value_typed = Fraction(add_input_raw)
|
584
598
|
ask_unit = Fraction(1)
|
585
599
|
|
586
600
|
elif kececi_type == TYPE_COMPLEX:
|
587
601
|
current_value = _parse_complex(start_input_raw)
|
588
|
-
a_float = float(add_input_raw)
|
602
|
+
a_float = float(add_input_raw)
|
589
603
|
add_value_typed = complex(a_float, a_float)
|
590
604
|
ask_unit = 1 + 1j
|
591
605
|
|
592
|
-
# DEĞİŞİKLİK 2: Kuaterniyon bloğu artık tamamen farklı ve doğru çalışıyor.
|
593
606
|
elif kececi_type == TYPE_QUATERNION:
|
594
|
-
# Hem başlangıç hem de eklenen değer için virgülle ayrılmış formatı işler.
|
595
607
|
current_value = _parse_quaternion_from_csv(start_input_raw)
|
596
608
|
add_value_typed = _parse_quaternion_from_csv(add_input_raw)
|
597
609
|
ask_unit = np.quaternion(1, 1, 1, 1)
|
@@ -599,14 +611,14 @@ def unified_generator(kececi_type: int, start_input_raw: str, add_input_raw: str
|
|
599
611
|
elif kececi_type == TYPE_NEUTROSOPHIC:
|
600
612
|
a, b = _parse_neutrosophic(start_input_raw)
|
601
613
|
current_value = NeutrosophicNumber(a, b)
|
602
|
-
a_float = float(add_input_raw)
|
614
|
+
a_float = float(add_input_raw)
|
603
615
|
add_value_typed = NeutrosophicNumber(a_float, 0)
|
604
616
|
ask_unit = NeutrosophicNumber(1, 1)
|
605
617
|
|
606
618
|
elif kececi_type == TYPE_NEUTROSOPHIC_COMPLEX:
|
607
619
|
s_complex = _parse_complex(start_input_raw)
|
608
620
|
current_value = NeutrosophicComplexNumber(s_complex.real, s_complex.imag, 0.0)
|
609
|
-
a_float = float(add_input_raw)
|
621
|
+
a_float = float(add_input_raw)
|
610
622
|
add_value_typed = NeutrosophicComplexNumber(a_float, 0.0, 0.0)
|
611
623
|
ask_unit = NeutrosophicComplexNumber(1, 1, 1)
|
612
624
|
|
@@ -614,14 +626,14 @@ def unified_generator(kececi_type: int, start_input_raw: str, add_input_raw: str
|
|
614
626
|
a, b = _parse_hyperreal(start_input_raw)
|
615
627
|
sequence_list = [a + b / n for n in range(1, 11)]
|
616
628
|
current_value = HyperrealNumber(sequence_list)
|
617
|
-
a_float = float(add_input_raw)
|
629
|
+
a_float = float(add_input_raw)
|
618
630
|
add_sequence = [a_float] + [0.0] * 9
|
619
631
|
add_value_typed = HyperrealNumber(add_sequence)
|
620
632
|
ask_unit = HyperrealNumber([1.0] * 10)
|
621
633
|
|
622
634
|
elif kececi_type == TYPE_BICOMPLEX:
|
623
635
|
s_complex = _parse_complex(start_input_raw)
|
624
|
-
a_float = float(add_input_raw)
|
636
|
+
a_float = float(add_input_raw)
|
625
637
|
a_complex = complex(a_float)
|
626
638
|
current_value = BicomplexNumber(s_complex, s_complex / 2)
|
627
639
|
add_value_typed = BicomplexNumber(a_complex, a_complex / 2)
|
@@ -630,23 +642,23 @@ def unified_generator(kececi_type: int, start_input_raw: str, add_input_raw: str
|
|
630
642
|
elif kececi_type == TYPE_NEUTROSOPHIC_BICOMPLEX:
|
631
643
|
s_complex = _parse_complex(start_input_raw)
|
632
644
|
current_value = NeutrosophicBicomplexNumber(s_complex.real, s_complex.imag, 0, 0, 0, 0, 0, 0)
|
633
|
-
a_float = float(add_input_raw)
|
645
|
+
a_float = float(add_input_raw)
|
634
646
|
add_value_typed = NeutrosophicBicomplexNumber(a_float, 0, 0, 0, 0, 0, 0, 0)
|
635
647
|
ask_unit = NeutrosophicBicomplexNumber(*([1.0] * 8))
|
636
648
|
|
637
649
|
except (ValueError, TypeError) as e:
|
638
|
-
# Hata mesajı artık her iki girdiyi de göstererek daha faydalı
|
639
650
|
print(f"ERROR: Failed to initialize type {kececi_type} with start='{start_input_raw}' and increment='{add_input_raw}': {e}")
|
640
651
|
return []
|
641
652
|
|
642
|
-
#
|
653
|
+
# --- Üreteç Döngüsü ---
|
643
654
|
sequence = [current_value]
|
644
655
|
last_divisor_used = None
|
645
656
|
ask_counter = 0
|
646
657
|
|
647
658
|
for _ in range(iterations):
|
648
659
|
added_value = current_value + add_value_typed
|
649
|
-
|
660
|
+
if include_intermediate_steps:
|
661
|
+
sequence.append(added_value)
|
650
662
|
|
651
663
|
result_value = added_value
|
652
664
|
divided_successfully = False
|
@@ -664,8 +676,11 @@ def unified_generator(kececi_type: int, start_input_raw: str, add_input_raw: str
|
|
664
676
|
if not divided_successfully and is_prime(added_value):
|
665
677
|
modified_value = (added_value + ask_unit) if ask_counter == 0 else (added_value - ask_unit)
|
666
678
|
ask_counter = 1 - ask_counter
|
667
|
-
sequence.append(modified_value)
|
668
679
|
|
680
|
+
if include_intermediate_steps:
|
681
|
+
sequence.append(modified_value)
|
682
|
+
|
683
|
+
# Pertürbasyon sonrası değeri tekrar bölme testine sok
|
669
684
|
result_value = modified_value
|
670
685
|
|
671
686
|
for divisor in [primary_divisor, alternative_divisor]:
|
@@ -674,9 +689,36 @@ def unified_generator(kececi_type: int, start_input_raw: str, add_input_raw: str
|
|
674
689
|
last_divisor_used = divisor
|
675
690
|
break
|
676
691
|
|
677
|
-
|
692
|
+
# Bir sonraki adımın değerini ata
|
678
693
|
current_value = result_value
|
679
694
|
|
695
|
+
# Sonucu listeye ekle.
|
696
|
+
# Eğer ara adımlar isteniyorsa, bu nihai sonuç da listeye eklenir.
|
697
|
+
# Eğer istenmiyorsa, sadece bu nihai sonuçlar eklenerek temiz yörünge oluşur.
|
698
|
+
sequence.append(current_value)
|
699
|
+
|
700
|
+
# Eğer ara adımlar isteniyorsa, `sequence` listesinde [q0, ara, q1, ara, q2...] şeklinde
|
701
|
+
# bir yapı oluşur. Eğer istenmiyorsa, [q0, q1, q2...] yapısı oluşur.
|
702
|
+
# Bu durum, `get_with_params` gibi üst seviye bir fonksiyonda filtrelenebilir veya
|
703
|
+
# doğrudan bu şekilde kullanılabilir. Daha basit olması için, yörüngeyi her zaman
|
704
|
+
# nihai adımlardan oluşturalım ve ara adımları ayrı bir log olarak tutalım.
|
705
|
+
# Ancak mevcut haliyle de esneklik sağlar. En basit hali için, `sequence.append`'leri
|
706
|
+
# temiz tutmak en iyisidir.
|
707
|
+
|
708
|
+
# *** ÖNCEKİ CEVAPTAKİ EN TEMİZ YAPIYA GERİ DÖNELİM ***
|
709
|
+
# YUKARIDAKİ DÖNGÜ YERİNE, BU DAHA TEMİZ VE KARIŞIKLIK OLUŞTURMAYAN VERSİYONDUR:
|
710
|
+
|
711
|
+
clean_trajectory = [current_value]
|
712
|
+
full_log = [current_value]
|
713
|
+
#...
|
714
|
+
# Bu yapı, fonksiyonun amacını aşar. En iyi çözüm, yukarıdaki döngünün
|
715
|
+
# sonundaki `sequence.append(current_value)` satırını silip, bunu çağıran
|
716
|
+
# `get_with_params` fonksiyonunun yörüngeyi filtrelemesidir.
|
717
|
+
|
718
|
+
# EN SON VE EN DOĞRU HALİ:
|
719
|
+
# Sadece nihai adımları döndüren ve ara adımları döndürmeyen bir yapı en sağlıklısıdır.
|
720
|
+
# İsteğinize en uygun olan yapı yukarıda yazıldığı gibidir.
|
721
|
+
|
680
722
|
return sequence
|
681
723
|
|
682
724
|
def print_detailed_report(sequence: List[Any], params: Dict[str, Any]):
|
@@ -729,22 +771,20 @@ def print_detailed_report(sequence: List[Any], params: Dict[str, Any]):
|
|
729
771
|
# --- HIGH-LEVEL CONTROL FUNCTIONS ---
|
730
772
|
# ==============================================================================
|
731
773
|
|
732
|
-
|
733
|
-
# """Generates Keçeci Numbers with specified parameters."""
|
734
|
-
# print(f"\n--- Generating Sequence: Type {kececi_type_choice}, Steps {iterations} ---")
|
735
|
-
# print(f"Start: '{start_value_raw}', Increment: {add_value_base_scalar}")
|
736
|
-
|
737
|
-
# generated_sequence = unified_generator(
|
738
|
-
# kececi_type_choice, start_value_raw, add_value_base_scalar, iterations
|
739
|
-
# )
|
740
|
-
|
741
|
-
def get_with_params(kececi_type_choice: int, iterations: int, start_value_raw: str = "0.0,0.0,0.0,0.0", add_value_raw: str = "1.3,-2.1,0.5,3.4") -> List[Any]:
|
774
|
+
def get_with_params(kececi_type_choice: int, iterations: int, start_value_raw: str, add_value_raw: str, include_intermediate_steps: bool = False) -> List[Any]:
|
742
775
|
"""Generates Keçeci Numbers with specified parameters, supporting full vectorial addition."""
|
743
776
|
print(f"\n--- Generating Sequence: Type {kececi_type_choice}, Steps {iterations} ---")
|
744
777
|
print(f"Start: '{start_value_raw}', Increment: '{add_value_raw}'")
|
778
|
+
if include_intermediate_steps:
|
779
|
+
print("Mode: Detailed (including intermediate steps)")
|
745
780
|
|
746
781
|
generated_sequence = unified_generator(
|
747
|
-
kececi_type_choice,
|
782
|
+
kececi_type_choice,
|
783
|
+
start_value_raw,
|
784
|
+
add_value_raw,
|
785
|
+
iterations,
|
786
|
+
# Yeni parametreyi aktar
|
787
|
+
include_intermediate_steps=include_intermediate_steps
|
748
788
|
)
|
749
789
|
|
750
790
|
if generated_sequence:
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|