Code Monkey home page Code Monkey logo

calc's Introduction

Calc

Similar to UNIX BC (not really).

Usage

You can clone normally or with the --recursive flag to pull submodules.

Build with make, clean buildspace with make clean.

Enter the shell using bin/calc.

Documentation

Operators

Name Definition Description
-x $-x$ Negation
a = b $a = b$ Set $a$ equal to $b$
a + b $a + b$ Addition
a - b $a - b$ Subtraction
a * b $ab$ Multiplication
a / b $\frac{a}{b}$ Division
a ^ b $a^{b}$ Exponentiation
a % b $a\mod{b}$ Modulous

Variables

Name Definition Description
_ default to $0$ Result of previous expression
pi $\pi = 3.14159...$ Constant representing PI
e $e = 2.71828...$ Constant representing Euler's number
h_deriv $10^{-7}$ Infintecimal constant for nderiv
h_integ $10^{-5}$ Infintecimal constant for ninteg

Functions

Name Definition Description
abs(x) $|x| $
sqrt(x) $\sqrt{x}$
ln(x) $\ln{x}$
ln(x, b) $\log_{b}{x}$
exp(x) $e^{x}$
floor(x) $\lfloor{x}\rfloor$
ceil(x) $\lceil{x}\rceil$
round(x) $\lfloor{x}\rceil$
max(a, b) $a \wedge b$ Maximum of $a$ and $b$
min(a, b) $a \vee b$ Minimum of $a$ and $b$
sin(θ) $sin(\theta)$
cos(θ) $cos(\theta)$
tan(θ) $tan(\theta)$
asin(x) $sin^{-1}(x)$
acos(x) $cos^{-1}(x)$
atan(x) $tan^{-1}(x)$
sinh(x) $\frac{e^{x} - e^{x}}{2}$ Hyperbolic sine
cosh(x) $\frac{e^{x} + e^{x}}{2}$ Hyperbolic cosine
tanh(x) $\frac{e^{x} - e^{x}}{e^{x} + e^{x}}$ Hyperbolic tangent
hypot2(a, b) $\sqrt{a^2 + b^2}$
hypot3(a, b, c) $\sqrt{a^2 + b^2 + c^2}$
eq(a, b) $\begin{cases}1 &a = b,\ -1 & a \neq b.\end{cases}$ Equality
neq(a, b) $\begin{cases}1 &a \neq b,\ -1 & a = b.\end{cases}$ Inverse equality
lt(a, b) $\begin{cases}1 &a < b,\ -1 & a \geq b.\end{cases}$ Less than
lte(a, b) $\begin{cases}1 &a \leq b,\ -1 & a > b.\end{cases}$ Less than or equal to
gt(a, b) $\begin{cases}1 &a > b,\ -1 & a \leq b.\end{cases}$ Greater than
gte(a, b) $\begin{cases}1 &a \geq b,\ -1 & a < b.\end{cases}$ Greater than or equal to
ifelse(z, a, b) $\begin{cases}a &z \neq 0,\ b & z = 0.\end{cases}$ If/else ternary
while(z, f) $\sum\limits_{z \neq 0}{f}$ While loop / summation
nderiv(f, x, n) ${\frac{df}{dx} \rvert_{x=n} }$ Derivative at $n$
ninteg(f, x, a, b) ${\int_{a}^{b}{fdx}}$ Definite integral from $a$ to $b$

calc's People

Contributors

juicestus avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.