(,+/ @(_2&{.))^:15(1)1 1 2 3 5 8 13 21 34 55 89 144 233 377 610 987
Den 22:29 søndag den 26. februar 2017 skrev Louis de Forcrand
:
Perhaps use the recursive definition; slower but possibly easiest to
understand (you can sneak in an M. if you don't talk about computation speed).
f
Perhaps use the recursive definition; slower but possibly easiest to understand
(you can sneak in an M. if you don't talk about computation speed).
fib=: 3 : 0 M. NB. 0-indexed
if. y <: 1 do. y
else. (fib y-1) + fib y-2
end.
)
Louis
> On 26 Feb 2017, at 20:37, Raul Miller wrote:
>
> Then
Then perhaps something like this:
fib=:verb define
series=. 0 1
needed=. >./, y
while. needed >: #series do.
series=. series, +/_1 _2 { series
end.
y { series return.
)
Thanks,
--
Raul
On Sun, Feb 26, 2017 at 1:42 PM, Linda A Alvord wrote:
> I only know the one in my example.
Here are a couple approaches:
First, make a list, then take the last thing in it.
fib_list=:3 : 0
z=.0 1
for. i.y-1 do.
z=.z,+/_2{. z
end.
if. y>0 do. z else. 0 end. NB. this only used to make fib_list 0 correct
)
fib_list 10
0 1 1 2 3 5 8 13 21 34 55
fib=:{:@fib_list
fib 10
55
I only know the one in my example. 1, 1, 2, 3, 5 ...
Next tern us tge sum of the previous two or in this case 8. It an infinite
series.
Linda
-Original Message-
From: Programming [mailto:programming-boun...@forums.jsoftware.com] On Behalf
Of Raul Miller
Sent: Sunday, February 26, 2017
Which english definition of fibonacci's series are you working with?
Thanks,
--
Raul
On Sun, Feb 26, 2017 at 12:48 PM, Linda A Alvord
wrote:
> I have been working on finding an explicit definition for the Fibonacci
> series. (without tie)
>
>
>
> fib 14
>
> 5!:4 <'fib'
>
> load 'debug'
>
> di
I have been working on finding an explicit definition for the Fibonacci
series. (without tie)
fib 14
5!:4 <'fib'
load 'debug'
dissect'fib 14'
To see the dissection, place cursor on fib and click right mouse.
I want a definition which will work for the youngest children.
Thanks
John Baker's recent experience with reporting a bug is summarized in his
comments:
Boy talk about responsive support. I don't think any of us are
expecting mostly volunteer J developers to leave parties to
address bugs.
Perhaps a good time to think about pressing the J donate button!
John,
Henry has fixed the bug and the fix has been pushed to the 806 beta source.
I have built a windows 64 806 beta-1 j.dll binary and have put it at the
web site download/jengine page.
If possible, please confirm that that binary does indeed fix the bug you
reported.
We have not yet decided h
Brian Schott noticed there is no z ! I "simplified" and removed it so use:
Plot t;sin t instead of (plot t;z)
Since it found a z in plot, there was no error message.
Thanks for being more awake than I was. Linda
-Original Message-
From: Programming [mailto:programming-boun.
What is z, please?
M
On 26/02/2017 08:57, Linda A Alvord wrote:
Here's a little demo to show you that there are really two circles in the
final plot.
The second plot erases the previous plot, so look at the code line by line.
load 'plot'
do=: 13 :'({.y)+(i.{:>:y)*(--/}:y)%{:y'
t
Fix is in for the next release. I used your script to produce a shorter
testcase.
The error was that
name =. , name NB. or =:
would do assignment-in-place even if the value in (name) was in use
somewhere else, like in another name, or a mapped file, or a boxed value.
Workaround: replace
Here's a little demo to show you that there are really two circles in the
final plot.
The second plot erases the previous plot, so look at the code line by line.
load 'plot'
do=: 13 :'({.y)+(i.{:>:y)*(--/}:y)%{:y'
t=:do 0,(o.4),1000
sin=:1&o.
plot t;z
cos=:2&o.
plot sin t
plot cos t
13 matches
Mail list logo