If you run the script I sent earlier and then
leysa _6{. testy
5
7 9.2 14.1 21.2 30.3 105.1 293.2 292.318
This works fine
leysa _7{. testy
1
8 6.1 9.2 14.1 21.2 30.3 105.1 293.2 103.612
This does not
If I remove the try and catch
leysa _6{. testy
5
1
7 9.2 14.1 21.2 30.3 105.1 293.2 124.472
Still ok
leysa _7{. testy
|domain error: leysa
| y-alpha*(u y) %.(u D.1 y)
Get domain error
In J601 this works and I get
leysa _6{. testy
5
1
7 9.2 14.1 21.2 30.3 105.1 293.2 124.472
leysa _7{. testy
5
1
8 6.1 9.2 14.1 21.2 30.3 105.1 293.2 103.612
Removing the last line gives me
leysa _7{. testy
5
8 6.1 9.2 14.1 21.2 30.3 105.1 293.2 292.364
So the number 292.364 is what I get from method 2 from the fit in J601 and
is what I expect in J602
In J602 I get a domain error
2007/12/2, Chris Burke <[EMAIL PROTECTED]>:
>
> What exactly is the problem? Can you boil it down to a simple:
>
> I ran expression X
> I got result Y
> I expected result Z
>
> Thanks.
>
> Björn Helgason wrote:
> > 9!:12''
> > 6
> > 9!:14''
> > j601/2006-11-17/17:05
> >
> > load 'c:\users\bjorn\jsoftware\j602\user\projects\leastsquare3.ijs'
> > 5
> >
> > leysa testy
> > 5
> > 8 6.1 9.2 14.1 21.2 30.3 105.1 293.2 292.364
> > ---------------- j602
> >
> > 9!:12''
> > 6
> > 9!:14''
> > j602/beta/2007-09-19/23:00
> >
> > load 'c:\users\bjorn\jsoftware\j602\user\projects\leastsquare3.ijs'
> > 1
> >
> > leysa testy
> > 1
> > 8 6.1 9.2 14.1 21.2 30.3 105.1 293.2 103.612
> >
> > -------------------- leastsquare3
> > log =: ^. NB. Give the natural log function the name log
> > e =: ^ 1 NB. e = exp(1) is Euler's number
> > alpha =: 0.2
> >
> > f2 =: verb define
> > 'a k' =. y
> > yp =. a*vx^k
> > +/(yp-vy)^2
> > )
> >
> > Nwtn3 =: adverb def 'y - alpha*(u y)%.(u D.1 y)'
> > FindRoot3 =: adverb def 'u Nwtn3 ^: _'
> >
> >
> > NB. leysa
> >
> > leysa=: verb define
> > ny=.#y
> > vx=:1+ i. ny
> > vy=:y
> > xlg=.log vx
> > ylg=.log vy
> > n=.#vx
> > num=.(+/xlg*ylg)-(+/xlg)*(+/ylg)%n
> > den=.(+/xlg*xlg)-((+/xlg)^2)%n
> > k1=.num%den
> > b1=.((+/ylg)-k1*(+/xlg))%n
> > a1=.e^b1
> > try.
> > 'a5 k5' =: f2 D.1 FindRoot3 a1,k1
> > smoutput 5
> > (1+ny),y,(a5*ny^k5)
> > catch.
> > smoutput 1
> > (1+ny),y,a1*ny^k1
> > end.
> > )
> >
> > NB. testx =: 1 2 3 4 5 10 20
> > testy =: 6.1 9.2 14.1 21.2 30.3 105.1 293.2
> > leysa testy
> > load'plot'
> > plot testy,292.364
> > NB. plot a5*(i.21)^k5
>
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
>
--
Björn Helgason, Verkfræðingur
Fugl&Fiskur ehf, Þerneyjarsund 23, Box 127
801 Grímsnes ,t-póst: [EMAIL PROTECTED]
Skype: gosiminn, gsm: +3546985532
Landslags og skrúðgarðagerð, gröfuþjónusta
http://groups.google.com/group/J-Programming
Tæknikunnátta höndlar hið flókna, sköpunargáfa er meistari einfaldleikans
góður kennari getur stigið á tær án þess að glansinn fari af skónum
/|_ .-----------------------------------.
,' .\ / | Með léttri lund verður |
,--' _,' | Dagurinn í dag |
/ / | Enn betri en gærdagurinn |
( -. | `-----------------------------------'
| ) | (\_ _/)
(`-. '--.) (='.'=)
`. )----' (")_(")
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm