On Mon, Sep 30, 2019 at 10:05 PM <[email protected]> wrote:
> From:   Raul Miller <[email protected]>
> Date:   Mon, 30 Sep 2019 13:03:59 -0400
> > Temperature = T = kT*(1-k/kmax) for the rosettacode task.
>
> Cancelling T and solving for k gives
> k = (kmax/2) + ((kmax/2)^2 - kmax)^0.5

kT is a single word whose value is 1. It's not k times T.

But this is the programming forum, and I have been remiss - I have
been failing to use J in this discussion.

So:

T=: verb define
  kT=: 1
  kmax=: 100000
  k=: y
  kT*(1-k%kmax)
)

Now, if we say:
   k=: 100000*(i.11)%10

Then we can compute:

   T k
1 0.9 0.8 0.7 0.6 0.5 0.4 0.3 0.2 0.1 0

And, for that matter:
   kT=: 1
   kT=k*T k
0 0 0 0 0 0 0 0 0 0 0

(Note that some of these steps were redundant, because of my use of
'global' values. However, I've also been careful so that my global
values remained consistent for this narrative.)

Does this make sense?

Thanks,

-- 
Raul
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to