FORTBITE Usage Guide
FORTBITE (Fortran-based Operations on Real-Time Backend for Interactive Technical Expression) is a high-precision mathematical calculator built with modern Fortran. It provides advanced mathematical capabilities including matrix operations, complex numbers, and high-precision arithmetic.
Table of Contents
- Getting Started
- Basic Arithmetic
- Variables
- Precision Control
- Mathematical Functions
- Complex Numbers
- Matrix Operations
- Advanced Features
- Command Reference
Getting Started
Building FORTBITE
make clean && make
Running FORTBITE
./build/bin/fortbite
Basic Usage
FORTBITE uses an interactive REPL (Read-Eval-Print Loop). Simply type mathematical expressions and press Enter:
fortbite> 2 + 3
5
fortbite> sin(pi/4)
0.7071067811865476
fortbite> exit
Basic Arithmetic
Operators
+Addition-Subtraction*Multiplication/Division**Exponentiation (power)%Modulo
Examples
fortbite> 15 + 25
40
fortbite> 10 - 3.5
6.5
fortbite> 4 * 7
28
fortbite> 22 / 7
3.142857142857143
fortbite> 2**10
1024
fortbite> 17 % 5
2
Order of Operations
FORTBITE follows standard mathematical precedence:
- Parentheses
() - Exponentiation
** - Multiplication
*, Division/, Modulo% - Addition
+, Subtraction-
fortbite> 2 + 3 * 4
14
fortbite> (2 + 3) * 4
20
fortbite> 2**3**2
512
Variables
Variable Assignment
Use := to assign values to variables:
fortbite> x := 42
42
fortbite> y := x * 2
84
fortbite> radius := 5.0
5
fortbite> area := pi * radius**2
78.53981633974483
Variable Names
- Must start with a letter
- Can contain letters, numbers, and underscores
- Case-sensitive
fortbite> my_var := 10
10
fortbite> MyVar := 20
20
fortbite> coefficient_1 := 3.14
3.14
Precision Control
Setting Precision
Use :: to specify the number of decimal digits for high-precision calculations:
fortbite> pi
3.141592653589793
fortbite> pi::50
3.1415926535897932384626433832795028841971693993751
fortbite> 1/3::25
0.3333333333333333333333333
Current Precision
Check current precision settings:
fortbite> precision
Current precision: Double Precision
Decimal digits: 15
Exponent range: ±307
Mathematical Functions
Trigonometric Functions
fortbite> sin(pi/6)
0.49999999999999994
fortbite> cos(0)
1
fortbite> tan(pi/4)
0.9999999999999999
Available functions:
sin(x),cos(x),tan(x)- Basic trigonometric functionsasin(x),acos(x),atan(x)- Inverse trigonometric functionssec(x),csc(x),cot(x)- Additional trigonometric functions
Alternative names:
arcsin(x)=asin(x)arccos(x)=acos(x)arctan(x)=atan(x)
Hyperbolic Functions
fortbite> sinh(1)
1.1752011936438014
fortbite> cosh(0)
1
fortbite> tanh(2)
0.9640275800758169
Available functions:
sinh(x),cosh(x),tanh(x)- Basic hyperbolic functionsasinh(x),acosh(x),atanh(x)- Inverse hyperbolic functionssech(x),csch(x),coth(x)- Additional hyperbolic functions
Logarithmic and Exponential Functions
fortbite> log(e)
1
fortbite> log10(100)
2
fortbite> exp(1)
2.718281828459045
fortbite> sqrt(16)
4
Available functions:
log(x),ln(x)- Natural logarithmlog10(x),lg(x)- Base-10 logarithmlog2(x)- Base-2 logarithmexp(x)- Exponential function (e^x)exp2(x)- Base-2 exponential (2^x)exp10(x)- Base-10 exponential (10^x)expm1(x)- exp(x) - 1 (accurate for small x)
Special Functions
fortbite> factorial(5)
120
fortbite> gamma(4)
6
fortbite> erf(1)
0.8427007929497149
fortbite> abs(-5)
5
Available functions:
factorial(n),fact(n)- Factorial functiongamma(x)- Gamma functionlgamma(x),loggamma(x)- Log-gamma functionerf(x)- Error functionerfc(x)- Complementary error functionabs(x)- Absolute valuesqrt(x)- Square rootceil(x),ceiling(x)- Ceiling functionfloor(x)- Floor functionround(x),nint(x)- Round to nearest integerfrac(x),fraction(x)- Fractional part
Complex Numbers
Creating Complex Numbers
Multiple ways to create complex numbers:
fortbite> 3+4i
3+4i
fortbite> (3,4)
3+4i
fortbite> cmplx(3,4)
3+4i
Complex Functions
fortbite> z := 3+4i
3+4i
fortbite> real(z)
3
fortbite> imag(z)
4
fortbite> abs(z)
5
fortbite> conj(z)
3-4i
fortbite> arg(z)
0.9272952180016122
Available complex functions:
real(z),re(z)- Real partimag(z),im(z)- Imaginary partconj(z),conjugate(z)- Complex conjugateabs(z),cabs(z),modulus(z)- Magnitude/modulusarg(z),phase(z),angle(z)- Phase angle
Complex Arithmetic
fortbite> (3+4i) + (1+2i)
4+6i
fortbite> (3+4i) * (1+2i)
-5+10i
fortbite> (3+4i) / (1+2i)
2.2-0.4i
Matrix Operations
Creating Matrices
Matrix Literals
fortbite> [1,2;3,4]
[2x2 matrix]
1 2
3 4
Special Matrices
fortbite> zeros(3,3)
[3x3 matrix]
0 0 0
0 0 0
0 0 0
fortbite> ones(2,3)
[2x3 matrix]
1 1 1
1 1 1
fortbite> eye(3)
[3x3 matrix]
1 0 0
0 1 0
0 0 1
Matrix creation functions:
zeros(n)- n×n zero matrixzeros(m,n)- m×n zero matrixones(n)- n×n ones matrixones(m,n)- m×n ones matrixeye(n)- n×n identity matrix
Matrix Operations
fortbite> A := [1,2;3,4]
[2x2 matrix]
1 2
3 4
fortbite> transpose(A)
[2x2 matrix]
1 3
2 4
fortbite> det(A)
-2
fortbite> inv(A)
[2x2 matrix]
-2 1
1.5 -0.5
Available matrix functions:
transpose(A),trans(A)- Matrix transposedet(A),determinant(A)- Determinantinv(A),inverse(A)- Matrix inversetrace(A)- Matrix trace (sum of diagonal elements)rank(A)- Matrix ranksolve(A,b)- Solve linear system Ax = b
Matrix Statistics
fortbite> M := [1,2,3;4,5,6]
[2x3 matrix]
1 2 3
4 5 6
fortbite> sum(M)
21
fortbite> mean(M)
3.5
fortbite> std(M)
1.8708286933869707
Statistical functions:
sum(M)- Sum of all elementsmean(M),average(M)- Mean of all elementsstd(M),stddev(M)- Standard deviation
Advanced Features
Built-in Constants
fortbite> pi
3.141592653589793
fortbite> e
2.718281828459045
fortbite> i
0+1i
Chaining Operations
fortbite> result := sin(pi/4) + cos(pi/4)
1.4142135623730951
fortbite> matrix_result := det(inv([1,2;3,4]))
-0.5
High-Precision Calculations
fortbite> pi::100
3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679
fortbite> x := 1/3::50
0.33333333333333333333333333333333333333333333333333
fortbite> y := x * 3::50
0.99999999999999999999999999999999999999999999999999
Command Reference
Interactive Commands
help- Display help informationexit- Exit FORTBITEclear- Clear screen (if supported)precision- Show current precision settingsinfo- Display system information
Special Syntax
:=- Variable assignment::- Precision specification;- Matrix row separator in literals,- Matrix column separator in literalsi- Imaginary unit suffix()- Function calls and grouping[]- Matrix literals
Examples and Use Cases
Scientific Calculations
! Calculate projectile motion
fortbite> g := 9.81
9.81
fortbite> v0 := 50
50
fortbite> angle := 45 * pi/180
0.7853981633974483
fortbite> time_flight := 2 * v0 * sin(angle) / g
7.214390675673431
fortbite> max_height := (v0 * sin(angle))**2 / (2*g)
63.775510204081634
Linear Algebra
! Solve system of equations: 2x + 3y = 8, x - y = 1
fortbite> A := [2,3;1,-1]
[2x2 matrix]
2 3
1 -1
fortbite> b := [8;1]
[2x1 matrix]
8
1
fortbite> solution := solve(A,b)
[2x1 matrix]
2.2
1.2
Complex Analysis
! Euler's formula verification: e^(iπ) + 1 = 0
fortbite> result := exp(i*pi) + 1
1.2246467991473532e-16+0i
! (Very close to zero, within numerical precision)
Statistical Analysis
! Analyze dataset
fortbite> data := [1,2,3,4,5,6,7,8,9,10]
[1x10 matrix]
1 2 3 4 5 6 7 8 9 10
fortbite> data_mean := mean(data)
5.5
fortbite> data_std := std(data)
3.0276503540974917
Tips and Best Practices
- Use descriptive variable names for complex calculations
- Specify precision when you need more than 15 decimal digits
- Check matrix dimensions before operations (FORTBITE will warn you)
- Use parentheses to clarify complex expressions
- Store intermediate results in variables for multi-step calculations
Error Handling
FORTBITE provides helpful error messages for common mistakes:
fortbite> sqrt(-1)
Evaluation error: sqrt() argument must be non-negative
fortbite> solve([1,2])
Evaluation error: solve() expects 2 arguments: solve(A, b)
fortbite> unknown_func(5)
Evaluation error: Unknown function: unknown_func
Limitations
- Matrix operations are limited to reasonable sizes (memory dependent)
- Complex numbers use double precision internally
- Some functions may have domain restrictions (e.g., sqrt of negative numbers)
- High precision mode may be slower for complex calculations
FORTBITE - High-Precision Calculator, Modern Fortran Edition Built with modern Fortran 2008+ standards
View source
| 1 | # FORTBITE Usage Guide |
| 2 | |
| 3 | **FORTBITE** (Fortran-based Operations on Real-Time Backend for Interactive Technical Expression) is a high-precision mathematical calculator built with modern Fortran. It provides advanced mathematical capabilities including matrix operations, complex numbers, and high-precision arithmetic. |
| 4 | |
| 5 | ## Table of Contents |
| 6 | - [Getting Started](#getting-started) |
| 7 | - [Basic Arithmetic](#basic-arithmetic) |
| 8 | - [Variables](#variables) |
| 9 | - [Precision Control](#precision-control) |
| 10 | - [Mathematical Functions](#mathematical-functions) |
| 11 | - [Complex Numbers](#complex-numbers) |
| 12 | - [Matrix Operations](#matrix-operations) |
| 13 | - [Advanced Features](#advanced-features) |
| 14 | - [Command Reference](#command-reference) |
| 15 | |
| 16 | ## Getting Started |
| 17 | |
| 18 | ### Building FORTBITE |
| 19 | ```bash |
| 20 | make clean && make |
| 21 | ``` |
| 22 | |
| 23 | ### Running FORTBITE |
| 24 | ```bash |
| 25 | ./build/bin/fortbite |
| 26 | ``` |
| 27 | |
| 28 | ### Basic Usage |
| 29 | FORTBITE uses an interactive REPL (Read-Eval-Print Loop). Simply type mathematical expressions and press Enter: |
| 30 | |
| 31 | ``` |
| 32 | fortbite> 2 + 3 |
| 33 | 5 |
| 34 | fortbite> sin(pi/4) |
| 35 | 0.7071067811865476 |
| 36 | fortbite> exit |
| 37 | ``` |
| 38 | |
| 39 | ## Basic Arithmetic |
| 40 | |
| 41 | ### Operators |
| 42 | - `+` Addition |
| 43 | - `-` Subtraction |
| 44 | - `*` Multiplication |
| 45 | - `/` Division |
| 46 | - `**` Exponentiation (power) |
| 47 | - `%` Modulo |
| 48 | |
| 49 | ### Examples |
| 50 | ``` |
| 51 | fortbite> 15 + 25 |
| 52 | 40 |
| 53 | fortbite> 10 - 3.5 |
| 54 | 6.5 |
| 55 | fortbite> 4 * 7 |
| 56 | 28 |
| 57 | fortbite> 22 / 7 |
| 58 | 3.142857142857143 |
| 59 | fortbite> 2**10 |
| 60 | 1024 |
| 61 | fortbite> 17 % 5 |
| 62 | 2 |
| 63 | ``` |
| 64 | |
| 65 | ### Order of Operations |
| 66 | FORTBITE follows standard mathematical precedence: |
| 67 | 1. Parentheses `()` |
| 68 | 2. Exponentiation `**` |
| 69 | 3. Multiplication `*`, Division `/`, Modulo `%` |
| 70 | 4. Addition `+`, Subtraction `-` |
| 71 | |
| 72 | ``` |
| 73 | fortbite> 2 + 3 * 4 |
| 74 | 14 |
| 75 | fortbite> (2 + 3) * 4 |
| 76 | 20 |
| 77 | fortbite> 2**3**2 |
| 78 | 512 |
| 79 | ``` |
| 80 | |
| 81 | ## Variables |
| 82 | |
| 83 | ### Variable Assignment |
| 84 | Use `:=` to assign values to variables: |
| 85 | |
| 86 | ``` |
| 87 | fortbite> x := 42 |
| 88 | 42 |
| 89 | fortbite> y := x * 2 |
| 90 | 84 |
| 91 | fortbite> radius := 5.0 |
| 92 | 5 |
| 93 | fortbite> area := pi * radius**2 |
| 94 | 78.53981633974483 |
| 95 | ``` |
| 96 | |
| 97 | ### Variable Names |
| 98 | - Must start with a letter |
| 99 | - Can contain letters, numbers, and underscores |
| 100 | - Case-sensitive |
| 101 | |
| 102 | ``` |
| 103 | fortbite> my_var := 10 |
| 104 | 10 |
| 105 | fortbite> MyVar := 20 |
| 106 | 20 |
| 107 | fortbite> coefficient_1 := 3.14 |
| 108 | 3.14 |
| 109 | ``` |
| 110 | |
| 111 | ## Precision Control |
| 112 | |
| 113 | ### Setting Precision |
| 114 | Use `::` to specify the number of decimal digits for high-precision calculations: |
| 115 | |
| 116 | ``` |
| 117 | fortbite> pi |
| 118 | 3.141592653589793 |
| 119 | fortbite> pi::50 |
| 120 | 3.1415926535897932384626433832795028841971693993751 |
| 121 | fortbite> 1/3::25 |
| 122 | 0.3333333333333333333333333 |
| 123 | ``` |
| 124 | |
| 125 | ### Current Precision |
| 126 | Check current precision settings: |
| 127 | ``` |
| 128 | fortbite> precision |
| 129 | Current precision: Double Precision |
| 130 | Decimal digits: 15 |
| 131 | Exponent range: ±307 |
| 132 | ``` |
| 133 | |
| 134 | ## Mathematical Functions |
| 135 | |
| 136 | ### Trigonometric Functions |
| 137 | ``` |
| 138 | fortbite> sin(pi/6) |
| 139 | 0.49999999999999994 |
| 140 | fortbite> cos(0) |
| 141 | 1 |
| 142 | fortbite> tan(pi/4) |
| 143 | 0.9999999999999999 |
| 144 | ``` |
| 145 | |
| 146 | **Available functions:** |
| 147 | - `sin(x)`, `cos(x)`, `tan(x)` - Basic trigonometric functions |
| 148 | - `asin(x)`, `acos(x)`, `atan(x)` - Inverse trigonometric functions |
| 149 | - `sec(x)`, `csc(x)`, `cot(x)` - Additional trigonometric functions |
| 150 | |
| 151 | **Alternative names:** |
| 152 | - `arcsin(x)` = `asin(x)` |
| 153 | - `arccos(x)` = `acos(x)` |
| 154 | - `arctan(x)` = `atan(x)` |
| 155 | |
| 156 | ### Hyperbolic Functions |
| 157 | ``` |
| 158 | fortbite> sinh(1) |
| 159 | 1.1752011936438014 |
| 160 | fortbite> cosh(0) |
| 161 | 1 |
| 162 | fortbite> tanh(2) |
| 163 | 0.9640275800758169 |
| 164 | ``` |
| 165 | |
| 166 | **Available functions:** |
| 167 | - `sinh(x)`, `cosh(x)`, `tanh(x)` - Basic hyperbolic functions |
| 168 | - `asinh(x)`, `acosh(x)`, `atanh(x)` - Inverse hyperbolic functions |
| 169 | - `sech(x)`, `csch(x)`, `coth(x)` - Additional hyperbolic functions |
| 170 | |
| 171 | ### Logarithmic and Exponential Functions |
| 172 | ``` |
| 173 | fortbite> log(e) |
| 174 | 1 |
| 175 | fortbite> log10(100) |
| 176 | 2 |
| 177 | fortbite> exp(1) |
| 178 | 2.718281828459045 |
| 179 | fortbite> sqrt(16) |
| 180 | 4 |
| 181 | ``` |
| 182 | |
| 183 | **Available functions:** |
| 184 | - `log(x)`, `ln(x)` - Natural logarithm |
| 185 | - `log10(x)`, `lg(x)` - Base-10 logarithm |
| 186 | - `log2(x)` - Base-2 logarithm |
| 187 | - `exp(x)` - Exponential function (e^x) |
| 188 | - `exp2(x)` - Base-2 exponential (2^x) |
| 189 | - `exp10(x)` - Base-10 exponential (10^x) |
| 190 | - `expm1(x)` - exp(x) - 1 (accurate for small x) |
| 191 | |
| 192 | ### Special Functions |
| 193 | ``` |
| 194 | fortbite> factorial(5) |
| 195 | 120 |
| 196 | fortbite> gamma(4) |
| 197 | 6 |
| 198 | fortbite> erf(1) |
| 199 | 0.8427007929497149 |
| 200 | fortbite> abs(-5) |
| 201 | 5 |
| 202 | ``` |
| 203 | |
| 204 | **Available functions:** |
| 205 | - `factorial(n)`, `fact(n)` - Factorial function |
| 206 | - `gamma(x)` - Gamma function |
| 207 | - `lgamma(x)`, `loggamma(x)` - Log-gamma function |
| 208 | - `erf(x)` - Error function |
| 209 | - `erfc(x)` - Complementary error function |
| 210 | - `abs(x)` - Absolute value |
| 211 | - `sqrt(x)` - Square root |
| 212 | - `ceil(x)`, `ceiling(x)` - Ceiling function |
| 213 | - `floor(x)` - Floor function |
| 214 | - `round(x)`, `nint(x)` - Round to nearest integer |
| 215 | - `frac(x)`, `fraction(x)` - Fractional part |
| 216 | |
| 217 | ## Complex Numbers |
| 218 | |
| 219 | ### Creating Complex Numbers |
| 220 | Multiple ways to create complex numbers: |
| 221 | |
| 222 | ``` |
| 223 | fortbite> 3+4i |
| 224 | 3+4i |
| 225 | fortbite> (3,4) |
| 226 | 3+4i |
| 227 | fortbite> cmplx(3,4) |
| 228 | 3+4i |
| 229 | ``` |
| 230 | |
| 231 | ### Complex Functions |
| 232 | ``` |
| 233 | fortbite> z := 3+4i |
| 234 | 3+4i |
| 235 | fortbite> real(z) |
| 236 | 3 |
| 237 | fortbite> imag(z) |
| 238 | 4 |
| 239 | fortbite> abs(z) |
| 240 | 5 |
| 241 | fortbite> conj(z) |
| 242 | 3-4i |
| 243 | fortbite> arg(z) |
| 244 | 0.9272952180016122 |
| 245 | ``` |
| 246 | |
| 247 | **Available complex functions:** |
| 248 | - `real(z)`, `re(z)` - Real part |
| 249 | - `imag(z)`, `im(z)` - Imaginary part |
| 250 | - `conj(z)`, `conjugate(z)` - Complex conjugate |
| 251 | - `abs(z)`, `cabs(z)`, `modulus(z)` - Magnitude/modulus |
| 252 | - `arg(z)`, `phase(z)`, `angle(z)` - Phase angle |
| 253 | |
| 254 | ### Complex Arithmetic |
| 255 | ``` |
| 256 | fortbite> (3+4i) + (1+2i) |
| 257 | 4+6i |
| 258 | fortbite> (3+4i) * (1+2i) |
| 259 | -5+10i |
| 260 | fortbite> (3+4i) / (1+2i) |
| 261 | 2.2-0.4i |
| 262 | ``` |
| 263 | |
| 264 | ## Matrix Operations |
| 265 | |
| 266 | ### Creating Matrices |
| 267 | |
| 268 | #### Matrix Literals |
| 269 | ``` |
| 270 | fortbite> [1,2;3,4] |
| 271 | [2x2 matrix] |
| 272 | 1 2 |
| 273 | 3 4 |
| 274 | ``` |
| 275 | |
| 276 | #### Special Matrices |
| 277 | ``` |
| 278 | fortbite> zeros(3,3) |
| 279 | [3x3 matrix] |
| 280 | 0 0 0 |
| 281 | 0 0 0 |
| 282 | 0 0 0 |
| 283 | |
| 284 | fortbite> ones(2,3) |
| 285 | [2x3 matrix] |
| 286 | 1 1 1 |
| 287 | 1 1 1 |
| 288 | |
| 289 | fortbite> eye(3) |
| 290 | [3x3 matrix] |
| 291 | 1 0 0 |
| 292 | 0 1 0 |
| 293 | 0 0 1 |
| 294 | ``` |
| 295 | |
| 296 | **Matrix creation functions:** |
| 297 | - `zeros(n)` - n×n zero matrix |
| 298 | - `zeros(m,n)` - m×n zero matrix |
| 299 | - `ones(n)` - n×n ones matrix |
| 300 | - `ones(m,n)` - m×n ones matrix |
| 301 | - `eye(n)` - n×n identity matrix |
| 302 | |
| 303 | ### Matrix Operations |
| 304 | ``` |
| 305 | fortbite> A := [1,2;3,4] |
| 306 | [2x2 matrix] |
| 307 | 1 2 |
| 308 | 3 4 |
| 309 | |
| 310 | fortbite> transpose(A) |
| 311 | [2x2 matrix] |
| 312 | 1 3 |
| 313 | 2 4 |
| 314 | |
| 315 | fortbite> det(A) |
| 316 | -2 |
| 317 | |
| 318 | fortbite> inv(A) |
| 319 | [2x2 matrix] |
| 320 | -2 1 |
| 321 | 1.5 -0.5 |
| 322 | ``` |
| 323 | |
| 324 | **Available matrix functions:** |
| 325 | - `transpose(A)`, `trans(A)` - Matrix transpose |
| 326 | - `det(A)`, `determinant(A)` - Determinant |
| 327 | - `inv(A)`, `inverse(A)` - Matrix inverse |
| 328 | - `trace(A)` - Matrix trace (sum of diagonal elements) |
| 329 | - `rank(A)` - Matrix rank |
| 330 | - `solve(A,b)` - Solve linear system Ax = b |
| 331 | |
| 332 | ### Matrix Statistics |
| 333 | ``` |
| 334 | fortbite> M := [1,2,3;4,5,6] |
| 335 | [2x3 matrix] |
| 336 | 1 2 3 |
| 337 | 4 5 6 |
| 338 | |
| 339 | fortbite> sum(M) |
| 340 | 21 |
| 341 | fortbite> mean(M) |
| 342 | 3.5 |
| 343 | fortbite> std(M) |
| 344 | 1.8708286933869707 |
| 345 | ``` |
| 346 | |
| 347 | **Statistical functions:** |
| 348 | - `sum(M)` - Sum of all elements |
| 349 | - `mean(M)`, `average(M)` - Mean of all elements |
| 350 | - `std(M)`, `stddev(M)` - Standard deviation |
| 351 | |
| 352 | ## Advanced Features |
| 353 | |
| 354 | ### Built-in Constants |
| 355 | ``` |
| 356 | fortbite> pi |
| 357 | 3.141592653589793 |
| 358 | fortbite> e |
| 359 | 2.718281828459045 |
| 360 | fortbite> i |
| 361 | 0+1i |
| 362 | ``` |
| 363 | |
| 364 | ### Chaining Operations |
| 365 | ``` |
| 366 | fortbite> result := sin(pi/4) + cos(pi/4) |
| 367 | 1.4142135623730951 |
| 368 | fortbite> matrix_result := det(inv([1,2;3,4])) |
| 369 | -0.5 |
| 370 | ``` |
| 371 | |
| 372 | ### High-Precision Calculations |
| 373 | ``` |
| 374 | fortbite> pi::100 |
| 375 | 3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679 |
| 376 | |
| 377 | fortbite> x := 1/3::50 |
| 378 | 0.33333333333333333333333333333333333333333333333333 |
| 379 | |
| 380 | fortbite> y := x * 3::50 |
| 381 | 0.99999999999999999999999999999999999999999999999999 |
| 382 | ``` |
| 383 | |
| 384 | ## Command Reference |
| 385 | |
| 386 | ### Interactive Commands |
| 387 | - `help` - Display help information |
| 388 | - `exit` - Exit FORTBITE |
| 389 | - `clear` - Clear screen (if supported) |
| 390 | - `precision` - Show current precision settings |
| 391 | - `info` - Display system information |
| 392 | |
| 393 | ### Special Syntax |
| 394 | - `:=` - Variable assignment |
| 395 | - `::` - Precision specification |
| 396 | - `;` - Matrix row separator in literals |
| 397 | - `,` - Matrix column separator in literals |
| 398 | - `i` - Imaginary unit suffix |
| 399 | - `()` - Function calls and grouping |
| 400 | - `[]` - Matrix literals |
| 401 | |
| 402 | ## Examples and Use Cases |
| 403 | |
| 404 | ### Scientific Calculations |
| 405 | ```fortran |
| 406 | ! Calculate projectile motion |
| 407 | fortbite> g := 9.81 |
| 408 | 9.81 |
| 409 | fortbite> v0 := 50 |
| 410 | 50 |
| 411 | fortbite> angle := 45 * pi/180 |
| 412 | 0.7853981633974483 |
| 413 | fortbite> time_flight := 2 * v0 * sin(angle) / g |
| 414 | 7.214390675673431 |
| 415 | fortbite> max_height := (v0 * sin(angle))**2 / (2*g) |
| 416 | 63.775510204081634 |
| 417 | ``` |
| 418 | |
| 419 | ### Linear Algebra |
| 420 | ```fortran |
| 421 | ! Solve system of equations: 2x + 3y = 8, x - y = 1 |
| 422 | fortbite> A := [2,3;1,-1] |
| 423 | [2x2 matrix] |
| 424 | 2 3 |
| 425 | 1 -1 |
| 426 | fortbite> b := [8;1] |
| 427 | [2x1 matrix] |
| 428 | 8 |
| 429 | 1 |
| 430 | fortbite> solution := solve(A,b) |
| 431 | [2x1 matrix] |
| 432 | 2.2 |
| 433 | 1.2 |
| 434 | ``` |
| 435 | |
| 436 | ### Complex Analysis |
| 437 | ```fortran |
| 438 | ! Euler's formula verification: e^(iπ) + 1 = 0 |
| 439 | fortbite> result := exp(i*pi) + 1 |
| 440 | 1.2246467991473532e-16+0i |
| 441 | ! (Very close to zero, within numerical precision) |
| 442 | ``` |
| 443 | |
| 444 | ### Statistical Analysis |
| 445 | ```fortran |
| 446 | ! Analyze dataset |
| 447 | fortbite> data := [1,2,3,4,5,6,7,8,9,10] |
| 448 | [1x10 matrix] |
| 449 | 1 2 3 4 5 6 7 8 9 10 |
| 450 | fortbite> data_mean := mean(data) |
| 451 | 5.5 |
| 452 | fortbite> data_std := std(data) |
| 453 | 3.0276503540974917 |
| 454 | ``` |
| 455 | |
| 456 | ## Tips and Best Practices |
| 457 | |
| 458 | 1. **Use descriptive variable names** for complex calculations |
| 459 | 2. **Specify precision** when you need more than 15 decimal digits |
| 460 | 3. **Check matrix dimensions** before operations (FORTBITE will warn you) |
| 461 | 4. **Use parentheses** to clarify complex expressions |
| 462 | 5. **Store intermediate results** in variables for multi-step calculations |
| 463 | |
| 464 | ## Error Handling |
| 465 | |
| 466 | FORTBITE provides helpful error messages for common mistakes: |
| 467 | |
| 468 | ``` |
| 469 | fortbite> sqrt(-1) |
| 470 | Evaluation error: sqrt() argument must be non-negative |
| 471 | |
| 472 | fortbite> solve([1,2]) |
| 473 | Evaluation error: solve() expects 2 arguments: solve(A, b) |
| 474 | |
| 475 | fortbite> unknown_func(5) |
| 476 | Evaluation error: Unknown function: unknown_func |
| 477 | ``` |
| 478 | |
| 479 | ## Limitations |
| 480 | |
| 481 | - Matrix operations are limited to reasonable sizes (memory dependent) |
| 482 | - Complex numbers use double precision internally |
| 483 | - Some functions may have domain restrictions (e.g., sqrt of negative numbers) |
| 484 | - High precision mode may be slower for complex calculations |
| 485 | |
| 486 | --- |
| 487 | |
| 488 | *FORTBITE - High-Precision Calculator, Modern Fortran Edition* |
| 489 | *Built with modern Fortran 2008+ standards* |