From: Alan Weiss on
I ask again: If you perturb the resulting solution x by executing
x+eps(x) and x-eps(x), do you get better answers?

On 6/23/2010 1:46 PM, Yu Li wrote:
> Hi,
> Thank you for your repaly. I did try fzero. The results are not
> satifactory because the terms in the function are pretty small, in the
> order of e-13. When I check the function values, some of them is only
> e-14. The smallest one is e-17. I feel a zero should be at least in the
> order of e-17. Thanks again.
>
> Yu
>
> Alan Weiss <aweiss(a)mathworks.com> wrote in message
> <hvtgc6$ji$1(a)fred.mathworks.com>...
>>
>> Have you tried using fzero on your problem?
>> If not, please do, and see if the results are satisfactory.
>> If so, in what way were the results unsatisfactory? If you perturb the
>> resulting solution x by executing x+eps(x) and x-eps(x), do you get
>> better answers?
>>
>> You could also try scaling your problem so the terms are not so small.
>>
>> Alan Weiss
>> MATLAB mathematical toolbox documentation

From: Steven Lord on

"someone" <someone(a)somewhere.net> wrote in message
news:hvueav$b39$1(a)fred.mathworks.com...
> "Yu Li" <yuliyy(a)gmail.com> wrote in message
> <hvtcn4$17s$1(a)fred.mathworks.com>...
>> Hi,
>>
>> I need to solve an equation. each term is rather small, say, about
>> 1e-13. I want the fzero solver to stop till the value of the function is
>> smaller than 1e-19. I figure fzero don't take TolFun. Is there anything
>> else I can do? Or I have to use another solver? Thank you very much.
>>
>> Best
>> Yu
>
> Are you sure about fzero not taking the TolFun?
> According to the documentation, fzero uses the optmiset structure which
> uses TolFun.

That's correct, FZERO can _accept_ an options structure returned from
OPTIMSET that includes the TolFun parameter. That doesn't mean that FZERO
_uses_ that option from the options structure.

> Or. look at the TolX parameter in the options for fzero.

http://www.mathworks.com/access/helpdesk/help/techdoc/ref/fzero.html

There's a table listing the five options that FZERO uses from the options
structure: Display, FunValCheck, OutputFcn, PlotFcns, and TolX. TolFun is
not listed in that table.

--
Steve Lord
slord(a)mathworks.com
comp.soft-sys.matlab (CSSM) FAQ: http://matlabwiki.mathworks.com/MATLAB_FAQ
To contact Technical Support use the Contact Us link on
http://www.mathworks.com


From: Yu Li on
Hi,

I checked. I got the same answer for x, x+eps(x) and x-eps(x). what does it mean then? Thanks a lot.

Best
Yu

Alan Weiss <aweiss(a)mathworks.com> wrote in message <hvvi8g$l8n$2(a)fred.mathworks.com>...
> I ask again: If you perturb the resulting solution x by executing
> x+eps(x) and x-eps(x), do you get better answers?
>
> On 6/23/2010 1:46 PM, Yu Li wrote:
> > Hi,
> > Thank you for your repaly. I did try fzero. The results are not
> > satifactory because the terms in the function are pretty small, in the
> > order of e-13. When I check the function values, some of them is only
> > e-14. The smallest one is e-17. I feel a zero should be at least in the
> > order of e-17. Thanks again.
> >
> > Yu
> >
> > Alan Weiss <aweiss(a)mathworks.com> wrote in message
> > <hvtgc6$ji$1(a)fred.mathworks.com>...
> >>
> >> Have you tried using fzero on your problem?
> >> If not, please do, and see if the results are satisfactory.
> >> If so, in what way were the results unsatisfactory? If you perturb the
> >> resulting solution x by executing x+eps(x) and x-eps(x), do you get
> >> better answers?
> >>
> >> You could also try scaling your problem so the terms are not so small.
> >>
> >> Alan Weiss
> >> MATLAB mathematical toolbox documentation
From: Alan Weiss on
fzero looks for a change of sign. You cannot always find a true zero
because of various issues involved in floating-point arithmetic.

If your initial solution x = fzero(yourFunction,x0) is not sufficiently
accurate, you can
1. Create an option structure with a smaller value of TolX:
opts = optimset('TolX',2*eps(x));
2. Solve the problem again using the options structure
x2 = fzero(yourFunction,x,opts);

I think you would do better to scale your problem so the parameters are
not so small, but the procedure I just described might work. You might
be running into issues of round-off error or other numerical problems
with your unscaled problem.

Alan Weiss
MATLAB mathematical toolbox documentation

On 6/24/2010 12:52 PM, Yu Li wrote:
> Hi,
>
> I checked. I got the same answer for x, x+eps(x) and x-eps(x). what does
> it mean then? Thanks a lot.
>
> Best
> Yu
>
> Alan Weiss <aweiss(a)mathworks.com> wrote in message
> <hvvi8g$l8n$2(a)fred.mathworks.com>...
>> I ask again: If you perturb the resulting solution x by executing
>> x+eps(x) and x-eps(x), do you get better answers?
>>
>> On 6/23/2010 1:46 PM, Yu Li wrote:
>> > Hi,
>> > Thank you for your repaly. I did try fzero. The results are not
>> > satifactory because the terms in the function are pretty small, in the
>> > order of e-13. When I check the function values, some of them is only
>> > e-14. The smallest one is e-17. I feel a zero should be at least in the
>> > order of e-17. Thanks again.
>> >
>> > Yu
>> >
>> > Alan Weiss <aweiss(a)mathworks.com> wrote in message
>> > <hvtgc6$ji$1(a)fred.mathworks.com>...
>> >>
>> >> Have you tried using fzero on your problem?
>> >> If not, please do, and see if the results are satisfactory.
>> >> If so, in what way were the results unsatisfactory? If you perturb the
>> >> resulting solution x by executing x+eps(x) and x-eps(x), do you get
>> >> better answers?
>> >>
>> >> You could also try scaling your problem so the terms are not so small.
>> >>
>> >> Alan Weiss
>> >> MATLAB mathematical toolbox documentation

From: Yu Li on
Hi,

Thank you very much for explaining this. What you said is really helpful. I will try what you suggested. If you have time, giving some suggestions about how to scale the problem will be terrific. I have no idea how to do that. Thanks again.

Best
Yu

Alan Weiss <aweiss(a)mathworks.com> wrote in message <i02brb$do2$1(a)fred.mathworks.com>...
> fzero looks for a change of sign. You cannot always find a true zero
> because of various issues involved in floating-point arithmetic.
>
> If your initial solution x = fzero(yourFunction,x0) is not sufficiently
> accurate, you can
> 1. Create an option structure with a smaller value of TolX:
> opts = optimset('TolX',2*eps(x));
> 2. Solve the problem again using the options structure
> x2 = fzero(yourFunction,x,opts);
>
> I think you would do better to scale your problem so the parameters are
> not so small, but the procedure I just described might work. You might
> be running into issues of round-off error or other numerical problems
> with your unscaled problem.
>
> Alan Weiss
> MATLAB mathematical toolbox documentation
>
> On 6/24/2010 12:52 PM, Yu Li wrote:
> > Hi,
> >
> > I checked. I got the same answer for x, x+eps(x) and x-eps(x). what does
> > it mean then? Thanks a lot.
> >
> > Best
> > Yu
> >
> > Alan Weiss <aweiss(a)mathworks.com> wrote in message
> > <hvvi8g$l8n$2(a)fred.mathworks.com>...
> >> I ask again: If you perturb the resulting solution x by executing
> >> x+eps(x) and x-eps(x), do you get better answers?
> >>
> >> On 6/23/2010 1:46 PM, Yu Li wrote:
> >> > Hi,
> >> > Thank you for your repaly. I did try fzero. The results are not
> >> > satifactory because the terms in the function are pretty small, in the
> >> > order of e-13. When I check the function values, some of them is only
> >> > e-14. The smallest one is e-17. I feel a zero should be at least in the
> >> > order of e-17. Thanks again.
> >> >
> >> > Yu
> >> >
> >> > Alan Weiss <aweiss(a)mathworks.com> wrote in message
> >> > <hvtgc6$ji$1(a)fred.mathworks.com>...
> >> >>
> >> >> Have you tried using fzero on your problem?
> >> >> If not, please do, and see if the results are satisfactory.
> >> >> If so, in what way were the results unsatisfactory? If you perturb the
> >> >> resulting solution x by executing x+eps(x) and x-eps(x), do you get
> >> >> better answers?
> >> >>
> >> >> You could also try scaling your problem so the terms are not so small.
> >> >>
> >> >> Alan Weiss
> >> >> MATLAB mathematical toolbox documentation