Mathics icon indicating copy to clipboard operation
Mathics copied to clipboard

Add KnotTheory as a provided package.

Open rocky opened this issue 3 years ago • 10 comments

rocky avatar May 06 '21 16:05 rocky

Just to know, is this loading now? Maybe we can add a few tests for this package.

@mmatera Two tests have been added. But this now really slows down testing since loading KnotTheory is slow as is memory cleanup after the test finishes.

rocky avatar May 06 '21 19:05 rocky

OK, once we pass the tests, we can just comment it out, and keep it for when we have a faster kernel or a specific module.

mmatera avatar May 06 '21 20:05 mmatera

OK, once we pass the tests, we can just comment it out, and keep it for when we have a faster kernel or a specific module.

Interestingly it works for both me and @soehms who I got it from. So there is something weird going on here.

Probably the test would just be that we can load the package.

But I need to defer looking at this until later.

rocky avatar May 06 '21 20:05 rocky

I checked it, and for some reason, the test passes if you run it alone pytest test/test_knoththeory.py , but fails if you run all the tests together with pytest test This does not changes if I change the name of the test to make that it run as the first test.

mmatera avatar May 07 '21 02:05 mmatera

Let's keep it commenting the test. We also need to put the reference of the original source of the knoththeory package in the AUTHORS.txt file.

mmatera avatar May 07 '21 02:05 mmatera

I checked it, and for some reason, the test passes if you run it alone pytest test/test_knoththeory.py , but fails if you run all the tests together with pytest test This does not changes if I change the name of the test to make that it run as the first test.

interesting.

Let's keep it commenting the test. We also need to put the reference of the original source of the knoththeory package in the AUTHORS.txt file.

Sure. This is not the end of this.

rocky avatar May 07 '21 04:05 rocky

@mmatera In https://github.com/mathics/Mathics/pull/1358/commits/5626fbbe7a841008c3f32c479511c3bff7fbc7e4 we get closer.

If you know off hand the right rule for BeginPackage[string, needs_list] and have the time, please fill it in and uncomment the rule, and revert init.m to what it should be.

As for AUTHORS.txt it is not our practice to put here included Packages and that makes sense because that refers to people writing Mathics, not that packages it includes. And even of the libraries we use, we only mention that we use them.

Attribution would go inside the package and that makes sense too. When the package is moved the attribution goes with it. However, I don't see any special files giving credit or mention. We do refer to http://katlas.org/wiki/The_Mathematica_Package_KnotTheory but that doesn't give attribution either.

rocky avatar May 07 '21 08:05 rocky

Regarding the full thing, since the tests are so heavy, I think that the best would be to maintain for now an independent repository for KnothTheory and Feyncalc mathics packages. We can test there against "experimental" specific branches inside Mathics, in a way that we can update on both sides as we make progress in the support for the required symbols. At the same time, we can go adding new specific tests in the master branch of Mathics, inspired by those packages.

mmatera avatar May 09 '21 22:05 mmatera

Regarding the full thing, since the tests are so heavy, I think that the best would be to maintain for now an independent repository for KnothTheory and Feyncalc mathics packages. We can test there against "experimental" specific branches inside Mathics, in a way that we can update on both sides as we make progress in the support for the required symbols. At the same time, we can go adding new specific tests in the master branch of Mathics, inspired by those packages.

Sure, I tried setting this up separately, but wasn't able to do in the time I had allotted for it. If you want to do - go ahead.

For now this can just live here.

rocky avatar May 09 '21 22:05 rocky

I've experimented with that branch (merged with current master) and it seems that there is a problem with importing dependent files.

If I work on master branch with a copy of the original files form http://katlas.org in the local path then the tests I made last May still work.

(mathics:30544): dbind-WARNING **: 23:23:14.323: Couldn't register with accessibility bus: Did not receive a reply. Possible causes include: the remote application did not send a reply, the message bus security policy blocked the reply, the reply timeout expired, or the network connection was broken.

Mathics 3.1.1.dev0
on CPython 3.6.9 (default, Jan 26 2021, 15:33:00)
using SymPy 1.8, mpmath 1.2.1, numpy 1.19.5

Copyright (C) 2011-2021 The Mathics Team.
This program comes with ABSOLUTELY NO WARRANTY.
This is free software, and you are welcome to redistribute it
under certain conditions.
See the documentation for the full license.

Quit by evaluating Quit[] or by pressing CONTROL-D.

In[1]:= Needs["KnotTheory`"]
Loading KnotTheory` version of September 6, 2014, 13:37:37.2841.
        Read more at http://katlas.org/wiki/KnotTheory.
EndPackage::noctx: No previous context defined.
Syntax::sntxf: "\!\(\(PowerQ[_Integer] := True;\)" cannot be followed by "" (line 2729 of "./KnotTheory/init.m").
Out[1]= None

In[2]:= SymmetryType[Knot[5, 2]]
KnotTheory::credits: The symmetry type data known to KnotTheory` is taken from Charles Livingston's http://www.indiana.edu/~knotinfo/.
KnotTheory::loading: Loading precomputed data in IndianaData`.
Unset::norep: Assignment on SymmetryType for SymmetryType[KnotTheory`Indiana`K1_] not found.
Out[2]= Reversible

But, if I work on add-KnotTheoryPackage then I run into an infinite recursion:

(mathics:30457): dbind-WARNING **: 23:19:22.953: Couldn't register with accessibility bus: Did not receive a reply. Possible causes include: the remote application did not send a reply, the message bus security policy blocked the reply, the reply timeout expired, or the network connection was broken.

Mathics 3.1.1.dev0
on CPython 3.6.9 (default, Jan 26 2021, 15:33:00)
using SymPy 1.8, mpmath 1.2.1, numpy 1.19.5

Copyright (C) 2011-2021 The Mathics Team.
This program comes with ABSOLUTELY NO WARRANTY.
This is free software, and you are welcome to redistribute it
under certain conditions.
See the documentation for the full license.

Quit by evaluating Quit[] or by pressing CONTROL-D.

In[1]:= Needs["KnotTheory`"]
Loading KnotTheory` version of September 6, 2014, 13:37:37.2841 modified for Mathics.
        Read more at http://katlas.org/wiki/KnotTheory.
Warning: this package is mostly not working. It is provided as is in hope that people will help out to fix.
Out[1]= None

In[2]:= SymmetryType[Knot[5, 2]]
KnotTheory::credits: The symmetry type data known to KnotTheory` is taken from Charles Livingston's http://www.indiana.edu/~knotinfo/.
Mathics does not support the second argument: {KnotTheory`}. Please add Needs[] explicitly inside the package.
KnotTheory::loading: Message KnotTheory::loading not found.
Unset::norep: Assignment on SymmetryType for SymmetryType[KnotTheory`Indiana`K1_] not found.
KnotTheory::credits: The symmetry type data known to KnotTheory` is taken from Charles Livingston's http://www.indiana.edu/~knotinfo/.
Unset::norep: Assignment on SymmetryType for SymmetryType[KnotTheory`Indiana`K1_] not found.
KnotTheory::credits: The symmetry type data known to KnotTheory` is taken from Charles Livingston's http://www.indiana.edu/~knotinfo/.
..............

Observe, that you get Message KnotTheory::loading not found instead of Loading precomputed data in IndianaData, now.

soehms avatar Jul 15 '21 06:07 soehms