Skip to content

This is a discord bot that allows you to quickly calculate and graph math.

License

Notifications You must be signed in to change notification settings

AlexisTM/discord-calculator-bot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

37 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

discord-calculator-bot

This is a discord bot that allows you to quickly calculate and graph math.

Come and test on Discord!: https://discord.gg/Y8XPcj2Q

Start the bot

export DISCORD_BOT_TOKEN="Your token"

python3 /home/alarm/calculator.py

Usage

calc

The calc command is used for quick maths with most Python math functions available and floats are handled as Decimals:

calc 0.1 + 0.2 # exact decimals
> 0.3
- calc 12**23 # large integers
> 6624737266949237011120128
calc 1 | 2 # bitwize operations
> 6624737266949237011120128
calc sqrt(abs(sin(pi*e))) # python's math functions
> 0.8797401237108087

>>

This is a basic python execution, but you do not have access to loops. Yet, you can execute all string operators and use map, reduce, filter functions.

>> "hello".upper()
> HELLO
>> list(map(ord, "hello"))
> [104, 101, 108, 108, 111]

graph

The graph command uses pyplot to graph one or multiple functions. The functions will be of the type: y = x where you only write the right side of it.

graph x
> graphs the function y = x
graph [x, -x]
> graphs the functions y = x and y = -x

Beautiful (truly) of a graph

conic

Graphs a 2D conic of type y**2 + x**2 = 1. Due to limitations, you have to move all arguments on one side to make it = 0.

conic x**2 + y**2 - 3**2
> makes a circle of radius 3 (x² + y² = 3²)
conic (x**2 + y**2 -1)**3 - x**2 * y**3
> Surprise!

*Overwhelming image of a circle

Releases

No releases published

Packages

No packages published

Languages