Giter VIP home page Giter VIP logo

hops's People

Contributors

akc avatar bawolk avatar suprdewd avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

hops's Issues

Cannot build with the latest version of Cabal

I'm using Cabal 3.6.2.0, and the version of GHC is 8.10.7. When I try to build hops with cabal build, it shows the following error:

Resolving dependencies...
cabal: Could not resolve dependencies:
[__0] trying: hops-0.8.5 (user goal)
[__1] next goal: hops:setup.Cabal (dependency of hops)
[__1] rejecting: hops:setup.Cabal-3.2.1.0/installed-3.2.1.0 (conflict: hops =>
hops:setup.Cabal>=1.9 && <1.25)
[__1] skipping: hops:setup.Cabal-3.6.3.0, hops:setup.Cabal-3.6.2.0,
hops:setup.Cabal-3.6.1.0, hops:setup.Cabal-3.6.0.0, hops:setup.Cabal-3.4.1.0,
hops:setup.Cabal-3.4.0.0, hops:setup.Cabal-3.2.1.0, hops:setup.Cabal-3.2.0.0,
hops:setup.Cabal-3.0.2.0, hops:setup.Cabal-3.0.1.0, hops:setup.Cabal-3.0.0.0,
hops:setup.Cabal-2.4.1.0, hops:setup.Cabal-2.4.0.1, hops:setup.Cabal-2.4.0.0,
hops:setup.Cabal-2.2.0.1, hops:setup.Cabal-2.2.0.0, hops:setup.Cabal-2.0.1.1,
hops:setup.Cabal-2.0.1.0, hops:setup.Cabal-2.0.0.2 (has the same
characteristics that caused the previous version to fail: excluded by
constraint '>=1.9 && <1.25' from 'hops')
[__1] rejecting: hops:setup.Cabal-1.24.2.0, hops:setup.Cabal-1.24.0.0,
hops:setup.Cabal-1.22.8.0, hops:setup.Cabal-1.22.7.0,
hops:setup.Cabal-1.22.6.0, hops:setup.Cabal-1.22.5.0,
hops:setup.Cabal-1.22.4.0, hops:setup.Cabal-1.22.3.0,
hops:setup.Cabal-1.22.2.0, hops:setup.Cabal-1.22.1.1,
hops:setup.Cabal-1.22.1.0, hops:setup.Cabal-1.22.0.0,
hops:setup.Cabal-1.20.0.4, hops:setup.Cabal-1.20.0.3,
hops:setup.Cabal-1.20.0.2, hops:setup.Cabal-1.20.0.1,
hops:setup.Cabal-1.20.0.0, hops:setup.Cabal-1.18.1.7,
hops:setup.Cabal-1.18.1.6, hops:setup.Cabal-1.18.1.5,
hops:setup.Cabal-1.18.1.4, hops:setup.Cabal-1.18.1.3,
hops:setup.Cabal-1.18.1.2, hops:setup.Cabal-1.18.1.1, hops:setup.Cabal-1.18.1,
hops:setup.Cabal-1.18.0, hops:setup.Cabal-1.16.0.3, hops:setup.Cabal-1.16.0.2,
hops:setup.Cabal-1.16.0.1, hops:setup.Cabal-1.16.0, hops:setup.Cabal-1.14.0,
hops:setup.Cabal-1.12.0, hops:setup.Cabal-1.10.2.0, hops:setup.Cabal-1.10.1.0,
hops:setup.Cabal-1.10.0.0, hops:setup.Cabal-1.8.0.6, hops:setup.Cabal-1.8.0.4,
hops:setup.Cabal-1.8.0.2, hops:setup.Cabal-1.6.0.3, hops:setup.Cabal-1.6.0.2,
hops:setup.Cabal-1.6.0.1, hops:setup.Cabal-1.4.0.2, hops:setup.Cabal-1.4.0.1,
hops:setup.Cabal-1.4.0.0, hops:setup.Cabal-1.2.4.0, hops:setup.Cabal-1.2.3.0,
hops:setup.Cabal-1.2.2.0, hops:setup.Cabal-1.2.1, hops:setup.Cabal-1.1.6,
hops:setup.Cabal-1.24.1.0 (constraint from minimum version of Cabal used by
Setup.hs requires >=3.2)
[__1] fail (backjumping, conflict set: hops, hops:setup.Cabal)
After searching the rest of the dependency tree exhaustively, these were the
goals I've had most trouble fulfilling: hops:setup.Cabal, hops

Functional equations via the library

Currently it only seems to be possible to specify functional equations via the command line. It would be nice if this was available through the library, without resorting to parsing a hops program.

Partition function seems odd

Suppose I wish to find the number of partitions of 99 restricted to the summands 1, 5, 10, and 25. I naively try:

$ hops --prec=100 'PARTITION({1,5,10,25})'
{"hops":"PARTITION({1,5,10,25})","seq":[1,1,1,1]}

I first thought that this has to do with your use of Indet as a tool for exploration. However, even if the {1,5,10,25} represents a truncation of a possibly infinite series, any further terms would involve a degree greater than 25. So it would seem that at a minimum the function h in the where clause should use the maximum of cs instead of length cs. Implementing this yields:

$ hops --prec=100 'PARTITION({1,5,10,25})'
{"hops":"PARTITION({1,5,10,25})","seq":[1,1,1,1,2,2,2,2,2,4,4,4,4,4,6,6,6,6,6,9,9,9,9,9,13]}

Better, but there should be some way to get this series to its full precision, so I can determine the coefficient of x^99. Also note what happens if I naively use square brackets:

$ hops --prec=100 'PARTITION([1,5,10,25])'
{"hops":"PARTITION({1,5,10,25})","seq":[]}

This occurs because the square bracket series contains zeros, which causes the empty series to result. We can avoid this by filtering out the zero coefficients. Implementing that yields:

$ hops --prec=100 'PARTITION([1,5,10,25])'
{"hops":"PARTITION({1,5,10,25})","seq":[1,1,1,1,2,2,2,2,2,4,4,4,4,4,6,6,6,6,6,9,9,9,9,9,13]}

Would it make sense to use the full precision if square brackets are used, but keep the current result if curly brackets are used? I think the documentation should be improved even if the current approach is retained.

Don't strip whitespace before parsing

Currently all whitespace is being removed before parsing happens. This leads to weird behaviour such as

> hops 'f2 = x; f 2'
{"hops":"f2=x;f2","seq":[0,1,0,0,0,0,0,0,0,0,0,0,0,0,0]}

Obviously it should still be possible to have whitespace in an expression, but that needs to be handled in a different manner.

Look at alternatives to fixed-point iteration

Currently hops uses fixed-point iteration to solve functional equations.We should look at alternative methods for finding fixed-points, such as Newton's method. It might be faster, and in any case will serve as a neat way to test and apply the library.

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.