[ADMB Users] Question about R2admb
dave fournier
davef at otter-rsch.com
Mon Mar 31 15:09:34 PDT 2014
On 14-03-31 02:10 PM, John Sibert wrote:
Well it may not matter much if you just switch in one direction. but
suppose you want a function like
0 if x<1
f(x) = 1 if 1<=x<=2
0 if x>2
You can do that with.
main()
{
double e = 0.1;
interpret_spline sp1(0,1,1,e);
interpret_spline sp2(1,0,2,e);
for (double x=0.0;x<=3.0;x+=.01)
{
if (x<1.5)
cout << x << " " << sp1(x) << endl;
else
cout << x << " " << sp2(x) << endl;
}
}
> This seems like a really good idea to me. It is a much better way to
> implement a step function or threshold functional relation than trying
> to fart around with various types of sigmoid approximations that may
> be hard to estimated.
>
> John Sibert
> Emeritus Researcher, SOEST
> University of Hawaii at Manoa
> Honolulu HI (GMT-10)
> 808-294-3842
>
> Visit the ADMB project http://admb-project.org/
>
> On 03/30/2014 08:06 AM, dave fournier wrote:
>> I'm not sure exaclty what is wanted, but it does suggest that one
>> may want something like the following function
>> which I suppose could get added to ADMB in some form.
>>
>> It should be
>>
>> a if x<=c-e
>> f(x) =
>> b if x>=c+e
>>
>> f'(x-e)=0
>> f'(x+e)=0
>>
>> f is nice for c-e<x<c+e
>>
>> this can be done with a cubic spline. A nice way is to
>> declare a class to hold the necessary information and a function
>> object or functor
>> to evaluate the function . It could be extended to deal with more
>> general boundary
>> conditions
>>
>> f'(x-e)=u
>> f'(x+e)=v
>>
>> with a bit of care.
>>
>>
>>
>>
>> _______________________________________________
>> Users mailing list
>> Users at admb-project.org
>> http://lists.admb-project.org/mailman/listinfo/users
>
>
More information about the Users
mailing list