OK, this looks like Roger's area, so I'll ask him to take a look.
But it would really help us if you simplified such reports as indicated,
i.e. give a simple expression and tell us what you get and what you expect.
Any time you tell us to run your own script with some complex
definitions, we have to spend time figuring out what your script is
supposed to do. It is much easier for you to zero in on the real problem
in the form of a simple expression.
Björn Helgason wrote:
> 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