

I ran the code:
x=linspace(0, 5); y = 1./(1 + 1.2*x.^(1.8)) + randn(1,100)*0.03;
function y = ffun(x, p)
y = 1./(1+p(1)*x.^p(2));
endfunction
p = [0.5 0.0];
[yfit pfit cvg iter] = leasqr(x, y, p, "ffun");
cvg, iter, pfit
leasqr(x,y,pin,F,{stol,niter,wt,dp,dFdp,options})
And have got the error message:
error: Invalid call to options. Correct usage is:
 Function File: OPT = options ("KEY1", VALUE1, "KEY2", VALUE2, ...)
error: called from:
error: /usr/share/octave/3.6.2/m/help/print_usage.m at line 87, column 5
error: /usr/share/octave/packages/control2.3.52/options.m at line 68, column
5
error: evaluating argument list element number 1
error: /usr/share/octave/packages/optim1.2.0/leasqr.m at line 577, column 5
>>>error: /home/boris/Documents/Octave/Compartmentmodels/Calcs/leasqr/lasqr_
simple.m at line 6, column 26
I read post at leasqr question (again) and did changes in my leasqr.m as it was mentioned in the post. But in my case the error is at line 577. Could you help me?


On Wed, Nov 14, 2012 at 1:48 PM, SBoris < [hidden email]> wrote:
> I ran the code
> < http://my.safaribooksonline.com/book//9781849513326/moreexamplesdataanalysis/ch07lvl1sec06>
> :
>
> x=linspace(0, 5); y = 1./(1 + 1.2*x.^(1.8)) + randn(1,100)*0.03;
> function y = ffun(x, p)
> y = 1./(1+p(1)*x.^p(2));
> endfunction
> p = [0.5 0.0];
> [yfit pfit cvg iter] = leasqr(x, y, p, "ffun");
> cvg, iter, pfit
> leasqr(x,y,pin,F,{stol,niter,wt,dp,dFdp,options})
>
> And have got the error message:
> error: Invalid call to options. Correct usage is:
>
>  Function File: OPT = options ("KEY1", VALUE1, "KEY2", VALUE2, ...)
>
> error: called from:
> error: /usr/share/octave/3.6.2/m/help/print_usage.m at line 87, column 5
> error: /usr/share/octave/packages/control2.3.52/options.m at line 68,
> column
> 5
> error: evaluating argument list element number 1
> error: /usr/share/octave/packages/optim1.2.0/leasqr.m at line 577, column
> 5
>>>>error:
> /home/boris/Documents/Octave/Compartmentmodels/Calcs/leasqr/lasqr_
> simple.m at line 6, column 26
>
> I read post at leasqr question (again)
> < http://octave.1599824.n4.nabble.com/leasqrquestionagaintd4644120.html>
> and did changes in my leasqr.m as it was mentioned in the post. But in my
> case the error is at line 577. Could you help me?
>
>
>
> 
> View this message in context: http://octave.1599824.n4.nabble.com/leasqrerrortp4646648.html> Sent from the Octave  General mailing list archive at Nabble.com.
> _______________________________________________
> Helpoctave mailing list
> [hidden email]
> https://mailman.cae.wisc.edu/listinfo/helpoctaveThe cell you pass to leasqr is undefined
> {stol,niter,wt,dp,dFdp,options}
What are all these things?
The error says that "options" is being parsed as a function.
_______________________________________________
Helpoctave mailing list
[hidden email]
https://mailman.cae.wisc.edu/listinfo/helpoctave

Administrator

On Nov 14, 2012, at 7:52 AM, Juan Pablo Carbajal wrote:
> On Wed, Nov 14, 2012 at 1:48 PM, SBoris < [hidden email]> wrote:
>> I ran the code
>> < http://my.safaribooksonline.com/book//9781849513326/moreexamplesdataanalysis/ch07lvl1sec06>
>> :
>>
>> x=linspace(0, 5); y = 1./(1 + 1.2*x.^(1.8)) + randn(1,100)*0.03;
>> function y = ffun(x, p)
>> y = 1./(1+p(1)*x.^p(2));
>> endfunction
>> p = [0.5 0.0];
>> [yfit pfit cvg iter] = leasqr(x, y, p, "ffun");
>> cvg, iter, pfit
>> leasqr(x,y,pin,F,{stol,niter,wt,dp,dFdp,options})
>>
>> And have got the error message:
>> error: Invalid call to options. Correct usage is:
>>
>>  Function File: OPT = options ("KEY1", VALUE1, "KEY2", VALUE2, ...)
>>
>> error: called from:
>> error: /usr/share/octave/3.6.2/m/help/print_usage.m at line 87, column 5
>> error: /usr/share/octave/packages/control2.3.52/options.m at line 68,
>> column
>> 5
>> error: evaluating argument list element number 1
>> error: /usr/share/octave/packages/optim1.2.0/leasqr.m at line 577, column
>> 5
>>>>> error:
>> /home/boris/Documents/Octave/Compartmentmodels/Calcs/leasqr/lasqr_
>> simple.m at line 6, column 26
>>
>> I read post at leasqr question (again)
>> < http://octave.1599824.n4.nabble.com/leasqrquestionagaintd4644120.html>
>> and did changes in my leasqr.m as it was mentioned in the post. But in my
>> case the error is at line 577. Could you help me?
>>
>
> The cell you pass to leasqr is undefined
>> {stol,niter,wt,dp,dFdp,options}
> What are all these things?
>
> The error says that "options" is being parsed as a function.
The error is from line ...
leasqr(x,y,pin,F,{stol,niter,wt,dp,dFdp,options})
Which is *not* part of the example at the link you provided. You have not defined many of the variables in this call to leasqr. In particular "options" has not been defined.
Ben
_______________________________________________
Helpoctave mailing list
[hidden email]
https://mailman.cae.wisc.edu/listinfo/helpoctave


I can see that problem when I (as your error message indicates) load the
control package and the optim package, it does not happen when I only do a
pkg load optim
and do not load control in parallel, this looks as if they contain
conflicting options functions.
octave:1> pkg load optim
octave:2> x=linspace(0, 5);
octave:3> y = 1./(1 + 1.2*x.^(1.8)) + randn(1,100)*0.03;
octave:4> function y = ffun(x, p)
> y = 1./(1+p(1)*x.^p(2));
> endfunction
octave:5> p = [0.5 0.0];
octave:6> [yfit pfit cvg iter] = leasqr(x, y, p, "ffun");
octave:7> cvg, iter, pfit
cvg = 1
iter = 6
pfit =
1.1887
1.8186
if your control package is set to autoload explicitly unload it and try
again.
pkg unload control
pkg load optim
x=linspace(0, 5);
y = 1./(1 + 1.2*x.^(1.8)) + randn(1,100)*0.03;
function y = ffun(x, p)
y = 1./(1+p(1)*x.^p(2));
endfunction
p = [0.5 0.0];
[yfit pfit cvg iter] = leasqr(x, y, p, "ffun");
cvg, iter, pfit
_______________________________________________
Helpoctave mailing list
[hidden email]
https://mailman.cae.wisc.edu/listinfo/helpoctave


Yes, it works: unload and reload package. Thank all of you for your quick replies. Cheers.


On 14.11.2012, at 14:05, Martin Helm < [hidden email]> wrote:
> I can see that problem when I (as your error message indicates) load the
> control package and the optim package, it does not happen when I only do a
>
> pkg load optim
>
> and do not load control in parallel, this looks as if they contain
> conflicting options functions.
On 14.11.2012, at 14:00, Ben Abbott < [hidden email]> wrote:
>>> The cell you pass to leasqr is undefined
>>>> {stol,niter,wt,dp,dFdp,options}
>>> What are all these things?
>>>
>>> The error says that "options" is being parsed as a function.
>>
>> The error is from line ...
>>
>> leasqr(x,y,pin,F,{stol,niter,wt,dp,dFdp,options})
>>
>> Which is *not* part of the example at the link you provided. You have not defined many of the variables in this call to leasqr. In particular "options" has not been defined.
>>
>> Ben
The control package has a function called "options". Use another name for your options argument in leasqr, e.g. "opts", or use "pkg unload control".
But this should be no problem at all if you defined options beforehand, because variable "options" would shadow function "options". I think there is another problem:
AFAIK the curly brackets in
leasqr(x,y,pin,F,{stol,niter,wt,dp,dFdp,options})
state that these arguments are optional. It should be sufficient to use
leasqr(x,y,pin,F)
Even if you want to specify all arguments, you must not write the curly brackets:
leasqr(x,y,pin,F,stol,niter,wt,dp,dFdp,options)
Lukas
_______________________________________________
Helpoctave mailing list
[hidden email]
https://mailman.cae.wisc.edu/listinfo/helpoctave


Am 14.11.2012 14:31, schrieb Lukas Reichlin:
> It should be sufficient to use leasqr(x,y,pin,F)
It is exactly this function call which causes the error not the later one.
It seems that "options" is used in leasqr in a way which conflicts with
the situation when a function named options is defined.
_______________________________________________
Helpoctave mailing list
[hidden email]
https://mailman.cae.wisc.edu/listinfo/helpoctave


On Wed, Nov 14, 2012 at 02:52:05PM +0100, Martin Helm wrote:
> Am 14.11.2012 14:31, schrieb Lukas Reichlin:
> > It should be sufficient to use leasqr(x,y,pin,F)
>
> It is exactly this function call which causes the error not the later one.
>
> It seems that "options" is used in leasqr in a way which conflicts with
> the situation when a function named options is defined.
This should be fixed in the latest optim package. (But the OP had a
different problem.)
Olaf

public key id EAFE0591, e.g. on xhkp://pool.skskeyservers.net
_______________________________________________
Helpoctave mailing list
[hidden email]
https://mailman.cae.wisc.edu/listinfo/helpoctave


Am 14.11.2012 16:15, schrieb Olaf Till:
> This should be fixed in the latest optim package. (But the OP had a
> different problem.) Olaf
No he had no different problem, look at the versions of optim and
control he has 2.3.52 and 1.2.0 the load both and execute his code (not
the last line which was anyway not correct)
octave:2> pkg load control
octave:3> pkg load optim
octave:4> x=linspace(0, 5);
octave:5> y = 1./(1 + 1.2*x.^(1.8)) + randn(1,100)*0.03;
octave:6> function y = ffun(x, p)
> y = 1./(1+p(1)*x.^p(2));
> endfunction
octave:7> p = [0.5 0.0];
octave:8> [yfit pfit cvg iter] = leasqr(x, y, p, "ffun");
error: Invalid call to options. Correct usage is:
 Function File: OPT = options ("KEY1", VALUE1, "KEY2", VALUE2, ...)
error: called from:
error: /usr/share/octave/3.6.3/m/help/print_usage.m at line 87, column 5
error: /usr/share/octave/packages/control2.3.52/options.m at line 68,
column 5
error: evaluating argument list element number 1
error: /usr/share/octave/packages/optim1.2.0/leasqr.m at line 574,
column 5
same code without a pkg load control works and that is absolutely
exactly the error he got, but he just misplaced at which line it was thrown.
_______________________________________________
Helpoctave mailing list
[hidden email]
https://mailman.cae.wisc.edu/listinfo/helpoctave


Olaf Till2 wrote
(But the OP had a different problem.)
There was no other problems in this and other similar codes which I tried to run.

