SkillAgentSearch skills...

Kalc

a complex numbers, 2d/3d graphing, arbitrary precision, vector/matrix, cli calculator with real-time output and support for units

Install / Use

/learn @bgkillas/Kalc
About this skill

Quality Score

0/100

Supported Platforms

Universal

README

kalc

crates.io AUR <img src="https://img.shields.io/liberapay/patrons/bgkillas.svg?logo=liberapay">

img.png

history file is stored in config_dir/kalc/kalc.history

config file is stored in config_dir/kalc/kalc.config example in repo

you can set permanent variables and functions in the file config_dir/kalc/kalc.vars example in repo, also contains more advanced example usage

config defaults listed in kalc.config

install instructions

kalc-plot

kalc-plot is the plotting software i made for this, may want to try this instead of gnuplot, just must be in the system path and then it will prefer kalc-plot over gnuplot

linux

use aur or run cargo install kalc

windows

download kalc.exe from https://github.com/bgkillas/kalc/releases/latest

needs a modern terminal like 'windows terminal' or alacritty, alacritty has better latency seemingly

for graphing install gnuplot via winget or sourceforge

macos

install developer tools via xcode-select --install

cargo install kalc

install gnuplot via brew install gnuplot

may need to run kalc from kalc 2> /dev/null for gnuplot not to output error messages

build instructions

if build fails due to gmp-mpfr-sys try changing the line features = ["force-cross"] to features = ["use-system-libs"] at the end of cargo.toml

linux

dependencys are: rust>=1.79.0, diffutils, gcc, m4, make

git clone https://github.com/bgkillas/kalc
git clone https://github.com/bgkillas/kalc-lib
cd kalc
cargo build --release
./target/release/kalc

windows

have cargo and the toolchain stable-x86_64-pc-windows-gnu installed

as per gmp-mpfr-sys

install MSYS2 using the installer

launch MSYS2 MinGW and run

pacman -Syu pacman-mirrors
pacman -S git diffutils m4 make mingw-w64-x86_64-gcc
git clone https://github.com/bgkillas/kalc
git clone https://github.com/bgkillas/kalc-lib
cd kalc
mkdir /mnt
mount C: /mnt

if cargo is locally installed

/mnt/Users/$USER/.cargo/bin/cargo build --release
./target/release/kalc.exe

if cargo is globally installed

cargo build --release
./target/release/kalc.exe

then move kalc.exe wherever you want in /mnt (your C drive)

macos

as per gmp-mpfr-sys

assure the path upto your build path contains no spaces

install developer tools via xcode-select --install

git clone https://github.com/bgkillas/kalc
git clone https://github.com/bgkillas/kalc-lib
cd kalc
cargo build --release
./target/release/kalc

usage

Usage: kalc [FLAGS] equation_1 equation_2 equation_3...
FLAGS: --help (this message)
--man prints a kalc.1 manpage
--help {thing} to get more detail on a function/option/feature, --help help to list all "things"
--interactive/-i allows interaction after finishing the equations given
--units toggles units
--notation=e/E/s/n defines what kind of notation you should use,(e) 3e2,(E) 3E2,(s) 3*10^2,(n) 300
--graph=normal/domain/domain_alt/depth/flat/none changes how a function is graphed, domain/depth/flat relate to complex graphs
--label=[x],[y],[z] sets the labels for the graphs x/y/z axis
--angle=deg/rad/grad sets your angletype
--2d=[num] number of points to graph in 2D, 2d=-1 for integer placements
--3d=[x],[y] number of points to graph in 3D, 3d=-1 for integer placements
--xr=[min],[max] x range for graphing
--yr=[min],[max] y range for graphing
--zr=[min],[max] z range for graphing
--range=[num] sets all ranges to [-num],[num]
--vxr=[min],[max] x range for graphing, graph view override, useful for parametric
--vyr=[min],[max] y range for graphing, graph view override, useful for parametric
--vzr=[min],[max] z range for graphing, graph view override, useful for parametric
--vrange=[num] sets all ranges to [-num],[num], graph view override, useful for parametric
--point [char] point style for graphing
--base=[input],[output] sets the numbers base from 2 to 36
--ticks=[num](,[num](,[num])) sets amount of ticks, optionally set different x/y/z ticks, -2 will be auto, -1 will be at every whole number, 0 will be none
--onaxis toggles showing the ticks on the x/y/z axis on by default for 2d, off by default for 3d
--prompt toggles the prompt
--gnuplot toggles using gnuplot instead of kalc plot
--color=true/false/auto toggles color output, toggled by default when running from arguments
--comma toggles comma seperation
--graph toggles graphing
--vars disables default variables and kalc.vars
--default sets to default settings and ignores kalc.vars
--line=true/false/auto toggles line graphing
--rt toggles real time printing
--polar toggles displaying polar vectors
--frac toggles fraction display
--prec=[num] sets the output precision(default 512)
--graphprec=[num] sets the graph precision(default 64)
--deci=[num] sets how many decimals to display, -1 for length of terminal, -2 for maximum decimal places, may need to up precision for more decimals
--multi toggles multi line display for matrixes
--tabbed toggles tabbed display for matrixes
--surface displays a colored surface(based on z value) for 3d graphing, only supports 1 graph
--scalegraph scales the y part of a 2d graph to the users screen size, setting --windowsize=x,y makes the ratio more accurate
--saveto=[file] saves the graph as a png to the given file, --windowsize=x,y for resolution
--siunits toggles keeping stuff in si units, a newton will show as 'm s^-2 kg' instead of 'N'
--keepzeros dont remove trailing zeros
--progress shows progress on graph
--default_units=unit1,unit2... sets the default single dimensional unit

- flags can be executed in runtime just without the dashes
- '~' will find the var value which makes the left side and right side equal each other, via newtons method starting at 0
- '~~' will find the var value which makes the left side and right side equal each other, via newtons method starting at -2/0/2, another will solve some imaginary values
- '===' given f(x)===b, will compute isolate(x,f(x)-b)
- any function with ' appeneded to the name will be converted like f'(x) goes to slope(t,f(t),x)
- any function with ` appeneded to the name will be converted like f`(x) goes to area(t,f(t),0,x)
- "colors=" to see color settings
- "exit" to exit the program
- "clear" to clear the screen
- "history [arg]" to see the history, arg searches for the arg it if specified
- "vars" to list all variables
- "option/var;function" to set a temporal option/var, example: "a=45;angle=deg;sin(a)" = sqrt(2)/2
- "f(x)=var:function" to set a temporal var when defining function, example: "f(x)=a=2:ax" = f(x)=2x
- "_" or "ans" or "ANS" to use the previous answer
- "a={expr}" to define a variable
- "f(x)=..." to define a function
- "f(x,y,z...)=..." to define a multi variable function
- "...=" display parsed input, show values of stuff like xr/deci/prec etc
- "f...=null" to delete a function or variable
- "{x,y,z...}" to define a cartesian vector
- "[r,θ,φ]" to define a polar vector (same as car{r,θ,φ})
- "f(x)#g(x)" to graph multiple things
- "{vec}#" to graph a vector
- "{mat}#" to graph a matrix
- "number#" to graph a complex number
- "[f(x),x]" to graph a polar graph of f(x)
- "{x,y}" to graph a parametric equation, example: {cos(x),sin(x)} unit circle, {f(x)cos(x),f(x)sin(x)} for polar graph
- "{x,y,z}" to graph a parametric equation in 3d, example: {cos(x),sin(x),x} helix, {sin(x)cos(y),sin(x)sin(y),cos(x)} sphere
- "{{a,b,c},{d,e,f},{g,h,i}}" to define a 3x3 matrix
- "rnd" to generate a random number
- "epoch" to get time in seconds since unix epoch
- Alt+Enter will not print output while still graphing/defining variables
- "help {thing}" to get more detail on a function/option/feature
- "help help" to list all things to query

Order of Operations:
- user defined functions
- functions, !x, x!, x!!, |x|
- % (modulus), .. (a..b creates lists of integers from a to b)
- ^/** (exponentiation), // (a//b is a root b), ^^ (tetration), computed from right to left
- × internal multiplication for units and negitive signs
- * (multiplication), / (division)
- + (addition), - (subtraction), +-/± (creates a list of the calculation if plus and the calculation if minus)
- to/-> (unit conversions, ie 2m->yd=2.2, leaves unitless if perfect conversion)
- < (lt), <= (le), > (gt), >= (ge), == (eq), != (!eq), >> (a>>b shifts b bits right), << (a<<b shifts b bits left)
- and(&&), or(||), not(¬), xor, nand, nor, implies, converse

Functions:
- sin, cos, tan, asin, acos, atan, atan(x,y), atan2(y,x), hypot(y,x), sincos(x)={sin(x),cos(x)}, cossin(x)={cos(x),sin(x)}
- csc, sec, cot, acsc, asec, acot
- sinh, cosh, tanh, asinh, acosh, atanh
- csch, sech, coth, acsch, asech, acoth
- sqrt, cbrt, square, cube, quadratic(a,b,c), cubic(a,b,c,d), quartic(a,b,c,d,e) (finds the zeros for the given polynomial, you can add a '1' to the args to only find real roots)
- ln, log(base,num), W(k,z) (product log, branch k, defaults to k=0)
- root(base,exp), sum(var,func,start,end), prod(var,func,start,end)
- abs, sgn, arg
- ceil, floor, round, int, frac, second argument specifies decimal
- fact, doublefact, subfact
- sinc, cis, exp
- zeta, eta, gamma, lower_gamma, beta, erf, erfc, digamma, ai, multinomial, binomial/bi/C(n,r), P(n,r), pochhammer(x,n)
- re, im, onlyreal, onlyimag, split(x+yi), next(n,to)
- unity(n,k) gets all solutions for x in x^k=n
- factors, nth_prime, is_prime, is_na

Related Skills

View on GitHub
GitHub Stars227
CategoryCustomer
Updated14d ago
Forks10

Languages

Rust

Security Score

100/100

Audited on Mar 14, 2026

No findings