Michele.h is a powerful and flexible library designed for C programming. It simplifies advanced computations, enhances console output, and facilitates operations with physical quantities. With its clear and efficient design, Michele.h is an essential tool for scientific applications, mathematical explorations, and general-purpose programming.
Enhance your terminal output with customizable and vibrant text:
-
Text Colors: Add color to your terminal output with macros:
ROSSO: Red text color.VERDE: Green text color.GIALLO: Yellow text color.BLU: Blue text color.CIANO: Cyan text color.
-
Background Colors: Create contrast with background colors:
S_ROSSO: Red background color.S_VERDE: Green background color.S_GIALLO: Yellow background color.S_BLU: Blue background color.
-
Text Styles: Emphasize your messages using text styles:
GRASSETTO: Bold text style.SOTTOLINEATO: Underlined text style.LAMPEGGIANTE: Blinking text style.INVERSIONE: Inverted text style.
-
Reset Formatting: Reset to default formatting using:
RESET: Resets text formatting to default.
Easily perform operations on physical quantities while considering their uncertainties:
-
Physical Quantity Structure (
Grandezza_Fisica): Define quantities that include both a value (Valore) and an uncertainty (Incertezza). -
Supported Operations:
- Addition & Subtraction: Accurately propagate uncertainties using
Somma_FisicaandDifferenza_Fisica. - Multiplication & Division: Manage uncertainties in product and ratio calculations with
Prodotto_FisicaandDivisione_Fisica. - Power & Root: Raise physical quantities to a power using
Potenza_Fisica, or calculate the n-th root withRadice_Fisica, both with precise uncertainty handling.
- Addition & Subtraction: Accurately propagate uncertainties using
Solve complex mathematical problems with ease:
-
Quadratic Equation Solver (
Formula_Quadratica):- Solve quadratic equations of the form
$Ax^2 + Bx + C = 0$ , returning both solutions (if they exist).
Soluzioni_QuadraticaStructure:-
The structure that holds the solutions for a quadratic equation:
-
Soluzione_Più: The positive solution (root). -
Soluzione_Meno: The negative solution (root).
-
- Solve quadratic equations of the form
-
Fibonacci Sequence (
Fibonacci_Numero):- Efficiently calculate the
$n$ -th Fibonacci number.
- Efficiently calculate the
-
Root Calculation (
Radice):- Use Newton's method to compute the n-th root of a number with high precision.
-
Power Calculation (
Potenza):- Raise a number to any integer exponent. Handles both positive and negative exponents, returning the computed value.
-
Trigonometric Functions:
-
SenCalculate the sine of an angle using a Taylor series approximation. -
Cos: Calculate the cosine of an angle using a Taylor series approximation. -
Tan: Calculate the tangent of an angle. The function checks for values where the tangent is undefined (e.g., when the cosine is close to zero).
-
Streamline your workflows with these utility features:
-
String Conversion (
UniformaString):- Convert strings to lowercase for easier comparisons and uniformity.
-
Logging with Timestamps (
Logging):- Log detailed messages with timestamps for debugging and tracking program behavior. Logs are written to both the console and a file.
Logging Features:
- Supports rotating log files when the log file reaches a specified maximum number of lines (default: 1000).
- Creates log directories (
./Logs/) if they don't exist. - Logs messages to both the console (with timestamps and log level) and a log file.
- Allows for custom log types (e.g., "INFO", "ERROR", "CLOSE").
- If the log reaches the maximum line limit, it automatically renames the old logs and creates a new one.
- Pi: The value of π is defined as
Pifor easy reference in computations.
- Gradi to Radiente: Convert degrees to radians using
Gradi_Radiente. - Radiante to Gradi: Convert radians to degrees using
Radiente_Gradi.
To use the Michele.h library, include it in your project with the following directive:
#include "Michele.h"To view a set of Tests for the various applications, check out the Tests folder in the project repository.
This library is licensed under the MIT License. Feel free to modify and use it for your projects.
This library is still evolving with exciting new features on the way! 🚀