A simple Wolfram Alpha alternative
(Trigger warning: Jank implementation)
To use it, submit POST requests to the endpoint with the body as an expression you want to calculate.
Example: curl -d "420+69" -H "Content-Type: text/plain" -X POST https://wolpha-calculator.herokuapp.com/
would return 489.0.
- Arbitrary input precision, up to 10 decimal digits of output precision.
- Elementary operations:
+
,-
,*
orx
,/
,^
- Elementary functions:
sin
,cos
,tan
,sqrt
,ln
orlog
- Parenthesis and order of operations (PEMDAS)
- Constants:
e
andpi
- Decimals and negative values (e.g., -1.5)
1+1
returns 2.05-(-1.9)
returns 6.92+2*2
returns 6.0 (by PEMDAS)2^2^3
returns 256.0 (evaluate right to left for exponents)sin(cos(pi/2))
returns 0.01.99999999999999999999
returns 2.0error
returns HTTP 400
(The rest of this file is only for if you want to host the repository separately.)
- Clone this repository.
- Install and initialize PostgreSQL.
- Run the program with specified environment variables.
DB_HOST
: Host name (e.g., localhost)DB_PORT
: PostgreSQL port (e.g., 5432)DB_USER
: Username (e.g., jean)DB_PASS
: Password (e.g., password)DB_NAME
: Database (e.g., jean)
- Create a Heroku app, then push the repository.
- View database credentials at App -> Resources -> Heroku Postgres -> Settings -> View Credentials...
- To access the database, use
heroku pg:psql
. - View the table using
SELECT * FROM entity
.