# Question:Stopping a for-loop - Urgent.

## Question:Stopping a for-loop - Urgent.

Maple

Hi,

I wondered if you would be able to help.  I've set up a for-loop that substitutes values of b into a given function (dependent only on b).

When substituting the values of b into the function f the values of f decrease to a point and then the values of f begin to increase.  I want to establish the interval in which this change occurs, i.e. the minimum of the function.

Below I have included a code similar to our situation:

>f[b]:=(z[1]-4)^4+(z[2]-3)^2+4*(z[3]+5)^4;
>    for beta from 0 to 0.003 by 0.0001 do
>          f2[b]:=subs(b=beta,f[b]);
>    end do;

Here is the code I have tried to get the loop to stop and thereby give me the interval in which the values of f change.

>f[b]:=(z[1]-4)^4+(z[2]-3)^2+4*(z[3]+5)^4;
>    for beta from 0 to 0.003 by 0.0001 do
>          f2[b]:=subs(b=beta,f[b]);
>      if (f2[b] >= f2[b-0.0001]) then
>         rhs_interval:=fb[b];
>      end if;
>    end do;

The error I received is something along of lines of Maple not being able to verify if it's true or false, so I added in an initial value before the for-loop and then altered the loop to start from 0.0001 rather than 0, but still received the error, I don't know what else to do.

All help is greatly appreciated.

Thanks.

p.s. I have a similar problem with stopping an algorthim where I want to stop a for-loop when a function z (which is calculated by the algorithm) within the for-loop equals zero (to prevent division by zero) - any ideas??

﻿