Code Monkey home page Code Monkey logo

ptolemy's Introduction

Ptolemy

A Sexagesimal Calculator for Ancient Astronomy

This is a web-based sexagesimal calculator for doing ancient astronomy. There is a live version available on sexagesimal.app.

It follows the notation conventions of G.J. Toomer's translation of Ptolemy's Almagest. 1.5 is written as 1;30, where 30 represents thirty parts of sixty. Likewise, 0;30,30 is equal to 0 + 30/60 + 30/(60^2). Whole numbers are in decimal notation: 12;0 = 12.0. Division is written with : instead of /, though / will be automatically converted to :.

You can also use crd to take the chord of a number. Example: 3;45*crd1;2,50. As written, this is not calculated using Ptolemy's method, though it will be eventually.

What it does and doesn't do

The calculator takes a query like 3;0+2;30*4;45,45 and returns a value in sexagesimal. Order of operations is PEMDAS. Decimal numbers and mixed decimal-sexagesimal expressions are also supported, e.g. 1;30*1.5. Parentheses are respected, though there may still be some instances where they do not work. An example:

Requirements

Ptolemy requires Flask.

To run dev version

  • source ptolemy-venv/bin/activate
  • May need to install requirements from requirements.txt at this point.
  • flask --app ptolemy run

ptolemy's People

Contributors

johnvining avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

ptolemy's Issues

Move evaluate() to a more fitting class.

evaluate() should probably live in a Calculator class, along with the other functionality to break apart an input string and to decide what to evaluate first.

Mistyped operators can cause numbers to merge.

If you want the query:

1;1+2;3+5

and you mistype the + and instead input:

1;1+2;3=5

it will evaluate:

1;1+2;35

This should probably just give the user and error and a chance to fix their mistake.

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.