Thanks Elijah! That's what I was missing.
We could also use J's polynomial solver:

* ] 'x f' =. ; }. p. 4002 _4096 64*

*63.00755956214548803 0.99244043785451341311*


Looks good:

* 4002=64*x*f*

*1*


But only if we rely on J's comparison tolerance.

If we move to rational fractions:


* ] 'x f'=.x: ;}.p. 4002 _4096 64*

*22506410355791r357201747095 8292308694079r8355472406995*

* 4002=64*x*f*

*0*


No luck. There's probably not a true rational solution.


Skip Cave
Cave Consulting LLC


On Tue, Oct 19, 2021 at 3:12 AM Elijah Stone <[email protected]> wrote:

> Ah--that is much clearer!
>
> I am not sure of a good iterative solution, but there is a fairly simple
> analytic solution.
>
> Say we would like to find a solution with a floor of 64; that is, where 64
> = <.x.
>
> Then we have:
>
> 4002 = x * 64 * (x - 64)
> = (64*x*x) + (_4096*x)
>
> which means that:
>
> 0 = (64*x*x) + (_4096*x) + 4002
>
> Which is a quadratic equation.  We may attack it as normal, deriving a
> solution as:
>
>     ] x=.(2*64) %~ 4096 + %: (_4096^2) - 4*64*_4002
> 64.9626
>     x * (<.x) * (x - <.x)
> 4002
>
> However, I think you asked for a rational answer; this solution is not
> rational because the determinant is not an integer square.
>
> The solution with a floor of k has a determinant of (k^4) + 4*k.  Are
> there any values for k in range such that that value is a perfect square?
>
>     1 e. (= <.) %: (^&4 + 4&*) >:i.150
> 0
>
> It appears not :/
>
>   -E
>
> On Tue, 19 Oct 2021, Skip Cave wrote:
>
> > I made a mistake in the equation in my first post..
> >
> > The three terms that are multiplied are
> > 1. x
> > 2. floor of x  = (<.x)
> > 3. fractional part of x = (x - <.x) This is what I got wrong in my first
> > post.
> >
> > I can get close by manual trial & error:
> >
> > *x=.64.962573478*
> >
> > Floor of x = <.x = 64
> >
> > Fractional part of x = (x -<.x ) = 0.962573478
> >
> > * x: x * (<.x) * (x - <.x)*
> >
> > *213746821r53410*
> >
> >
> > Close, but no cigar.
> >
> >
> > * 4002 = x * (<.x) * (x - <.x)*
> >
> > *0*
> >
> > A closer look - as a decimal fraction:
> >
> > * x * (<.x) * (x-<.x)*
> >
> > *4002.0000187231198652*
> >
> >
> > Yep. Not close enough.
> >
> >
> > How to design an iterative solution? There should be multiple solutions
> > with (<.x) = 63, 64, 65. 66 ... with the fraction
> >
> > *(x-<.x) *getting smaller & smaller.
> >
> > Skip Cave
> > Cave Consulting LLC
> >
> >
> > On Mon, Oct 18, 2021 at 6:25 PM Skip Cave <[email protected]>
> wrote:
> >
> >> How to solve this problem?
> >>
> >> 4002x = n * (<.n) * (>.n)
> >>
> >>
> >> What is n, where n is a rational fraction greater than 1, and the answer
> >> is a rational fraction? There are likely many answers, so find some
> answers
> >> near 64. The result in J should be a 1:
> >>
> >> 4002x = n * (<.n) * (>.n)
> >> 1
> >>
> >>
> >> Skip
> >>
> >> Skip Cave
> >> Cave Consulting LLC
> >>
> > ----------------------------------------------------------------------
> > For information about J forums see http://www.jsoftware.com/forums.htm
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
>
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to