Giter Site home page Giter Site logo

Comments (4)

jfbu avatar jfbu commented on July 18, 2024

The situation is more complicated indeed than for in and cm. I need to ponder your proposal there is something I don't see, but it is too late here, I must sleep.

edit: you can skip most of my chatter here and jump to last line

As I did not see an obvious analytical way, I see a dumber way: very few dimensions are not expressible in bp, only 3 out of very chunk of 803. So start from \texdimenmmdown{N sp} or rather get from its internals the integera such that M = floor(a*7227/2540) is largest one smaller than N. We have 800 chances out of 803 that it will be exactly expressible in bp unit, which we can check by testing M modulo 803 (I must sleep so I don't search now the 3 gaps, maybe they are in your comment). If we are unlucky, replace a by a-1 and check again. In at most 4 steps (here I would need to know the gaps to tell better) we can not have been unlucky systematically (maybe only two steps) because decreasing a by 1 will only decrease M by 2 or 3 and we can not hit 4 gaps in such a short stretch which are all distinct modulo 803. Now probably it is much better still because the gaps are probably at 803/3 distance from one another... oh well let's get them

>>> S=set((n*803)//800 for n in range(800));
>>> T=set(n for n in range(803));
>>> print(T-S);
{802, 267, 535}

so no it's trivial: we only have to do a->a-1 once. Either it works for a or it will work for a-1.

So for algorithm it looks easy, but analytically with a formula like the one for both in and cm ... looks indeed more difficult, but this another matter.

Thanks as clearly I need to add this and I will tomorrow.

from texdimens.

jfbu avatar jfbu commented on July 18, 2024

aside: again I was not notified of issue creation; I am notified of comments on already created issues but not of issue creations... I saw this one yesterday because I came to the web interface

Yesterday was too tired and did not read your post carefully after this paragraph:

The situation is different (and far more complicated) for bp and mm though. I started by looking at inputs in mm unit, so X=floor(a*7227/2540) for some a=2540*k+r (r=0..2539). Since the behavior of X is periodic (mod 2540), we can focus on a=0..2539 only. Now the question is whether this X is attainable from bp or not.

You are right but expressed yourself at a too high level for a dummy like myself. For some reason, when I read that first I had not noticed that 7227=9*803. We want X = floor(a*7227/2540) to be also floor(b*803/800), i.e. X=floor(b*7227/7200). Out the 7227 congruence classes of X modulo 7227 this excludes 27 of them, which as stated in your post are those 27 which modulo 803 are in {267,535,802}. Now the first formula authorizes only 2540, i.e. about one third of all possible classes modulo 7227, and we are axcluding now 27 in total so we expect about 9 will have to be excluded from the 2540 possible values of floor(a*7227/2540). This you obtained by brute force, examining, actually, each of the three exclusion condition modulo 803 one at a turn.

So I agree with your analysis, but it looks a priori an overhead to check for a modulo 2540 and exclude there 9 values. It looks simpler once we have both X and a to apply the test on X mod. 803 that it has to be distinct from {267,535,802}. If it is not distinct we replace a by a-1 and X by a new one which will be either X-2 or X-3.

For implementation I must think: we can go brute force with existing macros, i.e., use first \texdimenmmdown then check if the obtained distance dimension remain invariant under \texdimenbp, if yes we are done, if not we know we must decrease by 1 the a (which verifies a sp = D pt where D = \texdimenmmdown{input}, but we will have hijacked the latter macro which actually computes a first).

As per complete math analytically, we are in a situation where we allow now only 2540-9=2531 values of X modulo 7227. But a priori the allowed X will not be those of the shape floor(k 7227/2531)... I have not checked, I admit a priori I can not believe such a thing will work. And any formula of the type X = floor(k G) where G is a reduced fraction A/B > 1 allows to recover G if we know the values of X for k=0..(B-1) simply by counting them. Time to break out before I err with too approximative things.

from texdimens.

jfbu avatar jfbu commented on July 18, 2024
1. get `a`;

2. test if `a=94`, `282`, `1035`, `1223`, `1317`, `1411`, `1505`, `1693`, or `2446` (mod 2540).

3. if not, leave `a` as is.

4. if yes, `a := a-1`.

I am going probably to do the following:

  1. get a and X (from \texdimenmmdown innards)
  2. test if X=267, 535, 802 modulo 803, i.e. if X sp is attainable by bp [or replace do this by any competitor to check if X sp is attainable by bp, perhaps simply use texdimenbp innards)
  3. if not, leave a as is.
  4. if yes a := a-1.

This scheme would be for a \texdimenbothbpmm whose output will be for mm. It seems for output in bp we need to add a fifth step which is

  1. ... and get the new X then obtain the result in bp unit from \texdimenbp or its innards.

from texdimens.

jfbu avatar jfbu commented on July 18, 2024

This was closed in 7795ab0 (#11)

from texdimens.

Related Issues (15)

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.