Commit Graph

141 Commits

Author SHA1 Message Date
Stefan Müller 8d4a5c2ed8 Changed root finder to use base-2 exponent of bound
Since the root isolation algorithm uses a power of two as bound anyway,
it makes sense to use it's exponent in method interfaces and throughout
the algorithm. This simplifies multiplications to cheap shifts and will
make it easier to detect when the isolating interval size is 1.

Also added some method documentation.
2024-05-26 17:31:37 +02:00
Stefan Müller 04e1702a2e Added TBigIntPolynomial.ScaleVariableByPowerOfTwo 2024-05-26 16:59:16 +02:00
Stefan Müller ab453b347d Renamed root finding class and methods, now class methods 2024-05-26 14:23:31 +02:00
Stefan Müller ae30889bbb Fixed calculation of root-isolating intervals and tests 2024-05-25 02:51:00 +02:00
Stefan Müller 748964c871 Fixed broken polynomial degree in bisection algorithm 2024-05-25 02:37:34 +02:00
Stefan Müller fa5616f3cc Fixed initializer of zero polynomial 2024-05-25 02:35:55 +02:00
Stefan Müller baa1f8f31f Added bisection root finding algorithm with custom upper bound 2024-05-24 20:47:52 +02:00
Stefan Müller 53e3922654 Updated bisection root finding algorithm and test case 2024-05-24 20:22:06 +02:00
Stefan Müller cbaffbf55e Added TBigIntPolynomial methods needed for bisection algorithm 2024-05-24 12:03:25 +02:00
Stefan Müller aef4f28f46 Changed zero polynomial resulting from scaling to have one coefficient 2024-05-23 22:11:22 +02:00
Stefan Müller 37309d2817 Moved TBigIntPolynomial.IsEqualTo within the class 2024-05-23 22:07:58 +02:00
Stefan Müller 6802da1743 Merge branch 'bigint' into day24-analytical 2024-05-23 22:03:41 +02:00
Stefan Müller 2df8266d42 Added some improvements for TBigInt shift left operator 2024-05-23 22:01:25 +02:00
Stefan Müller 4329041353 Added TBigInt shift right operator and tests 2024-05-23 22:00:45 +02:00
Stefan Müller 18f432bdfe Added parenthesis in TBigInt.ToString for negative values 2024-05-23 21:08:01 +02:00
Stefan Müller cfb74da86b Added TBigInt.One 2024-05-23 21:07:11 +02:00
Stefan Müller fad6e496c0 Removed unintentional WriteLn comments 2024-05-23 21:06:33 +02:00
Stefan Müller 9d444272e0 Merge branch 'bigint' into day24-analytical 2024-05-20 15:04:32 +02:00
Stefan Müller 52cee73123 Added TBigInt.GetMostSignificantBitIndex and tests 2024-05-20 15:03:54 +02:00
Stefan Müller afefbf46e3 Removed main project unit refs from FPCUnit project 2024-05-20 01:05:16 +02:00
Stefan Müller 7ac4a3519a Added TBigIntPolynomial.ToString 2024-05-20 01:04:18 +02:00
Stefan Müller d503968cee Merge branch 'bigint' into day24-analytical 2024-05-20 01:01:20 +02:00
Stefan Müller 2ca960f19c Added TBigInt.ToString for debugging 2024-05-20 00:59:40 +02:00
Stefan Müller 9c951073d9 Removed irrelevant todo 2024-05-20 00:56:52 +02:00
Stefan Müller 18de900a38 Fixed BigInt subtraction for equal operands 2024-05-20 00:56:22 +02:00
Stefan Müller c25317c0fc Merge branch 'bigint' into day24-analytical 2024-05-16 17:14:00 +02:00
Stefan Müller 62887ad1d7 Fixed BigInt multiplication test cases 2024-05-16 17:08:44 +02:00
Stefan Müller 7630bdddeb Fixed array init in BigInt shift and replaced Move 2024-05-16 17:08:05 +02:00
Stefan Müller df8b5c32fd Fixed BigInt test cases 2024-05-14 16:52:32 +02:00
Stefan Müller 1caee9ae6e Fixed BigInt string initializers 2024-05-14 16:52:09 +02:00
Stefan Müller eee05a9646 Added BigInt test cases (many broken) 2024-05-13 18:20:23 +02:00
Stefan Müller e11db7155a Added more BigInt features and fixes
- Fixed some uses of Move
- Added Sign, string initializers (hexadecimal and binary), explicit
converter to Int64, comparison operators
2024-05-13 18:19:15 +02:00
Stefan Müller 53827acf9b Added new unit for polynomial root finding algorithm 2024-05-13 15:22:18 +02:00
Stefan Müller 4c0ff2f23f Added TBigIntPolynomial.ScaleVariable 2024-05-13 15:22:18 +02:00
Stefan Müller 0bbae0a83e Added polynomial degree and coefficients as public properties 2024-05-13 15:22:18 +02:00
Stefan Müller 71c8462358 Added TBigInt unequal operator 2024-05-13 15:22:12 +02:00
Stefan Müller 5808ec24f2 Added polynomials 2024-05-13 15:21:58 +02:00
Stefan Müller eb2b4a3f99 Added TBigInt unequal operator 2024-05-13 15:17:13 +02:00
Stefan Müller 44c2c845e0 Added WIP analytical solution attempt 2024-02-21 21:05:34 +01:00
Stefan Müller 356cc2ad5e Merge branch 'bigint' into day24-analytical 2024-02-14 13:21:15 +01:00
Stefan Müller 9f619adc01 Fixed addition: final carry-over was inserted at the wrong end of the number 2024-02-14 12:09:18 +01:00
Stefan Müller ef1eba4538 Fixed shl operator: incorrect move for full digit shifts 2024-02-14 12:09:18 +01:00
Stefan Müller cec6985489 Updated operators 2024-02-14 12:09:18 +01:00
Stefan Müller 5a3c320942 Fixed TBigInt heap memory allocation (fixed memory leaks) 2024-02-14 12:09:18 +01:00
Stefan Müller bfb33673ee Fixed some redundant parenthesis 2024-02-14 12:09:18 +01:00
Stefan Müller 7a6623c99c Added draft of TBigInt object 2024-02-14 12:09:18 +01:00
Stefan Müller a034fbaedc Added integer factorization and enumeration of dividers 2024-01-31 18:58:49 +01:00
Stefan Müller cccf5693f7 Fixed negative GCD and allow Int64 for GCD and LCM 2024-01-23 12:21:43 +01:00
Stefan Müller 571019d604 Removed fgl references 2023-12-30 23:20:52 +01:00
Stefan Müller fb3f41a6af Added solution for "Day 24: Never Tell Me The Odds", part 1 2023-12-26 19:46:35 +01:00