errors while picking random numbers under constraint and in loop also
- To: mathgroup at smc.vnet.net
- Subject: [mg44133] errors while picking random numbers under constraint and in loop also
- From: sean kim <sean_incali at yahoo.com>
- Date: Fri, 24 Oct 2003 04:24:03 -0400 (EDT)
- Reply-to: sean_incali01 at yahoo.com
- Sender: owner-wri-mathgroup at wolfram.com
hello group.
I'm design a routine to pick random numbers for two
coefficients such that when first is less than the
second coefficient, then accept, if not pick new
random numbers. I'm also trying to put that routine in
a loop.
but I get the following errors. this always seems to
happen when the test yields False.
In[248]:=
Label[here];
{k7 -> Random[Real,10^{-5, -3}],k8 ->
Random[Real,10^{-5, -3}]};
k7n= %[[1, 2]];
k8n= %%[[2, 2]];
test = TrueQ[k7n<k8n];
If[test,{k7 -> k7n ,k8 ->
k8n},Remove[{k7n,k8n}];Goto[here]]
Remove::ssym: {k7n, k8n} is not a symbol
Goto::nolabel: Label here not found.
Out[253]= Hold[Goto[here]]
now, if I try to flank the above with the For loop, i
get the following.
In[181]:=
For[ii=0, ii<10,
Label[here];
{k7-> Random[Real,10^{-5, -3}],k8 ->
Random[Real,10^{-5, -3}]};
k7n= %[[ 1, 2]];
k8n= %%[[ 2, 2]];
test = TrueQ[k7n<k8n];
If[test,Remove[{k7n,k8n}];Goto[here],{k7-> k7n ,k8->
k8n}],
ii++]
Part::partw: Part 2 of Goto[here] does not exist.
Part::partd: Part specification True[[2, 2]] is longer
than depth of object.
above two error messages continues. until it gets
supressed.
what am I doing wrong here?
any and all thoughts are thoroughly appreciated.
thanks in advance.
sean
__________________________________
Do you Yahoo!?
The New Yahoo! Shopping - with improved product search
http://shopping.yahoo.com
- Follow-Ups:
- Re: errors while picking random numbers under constraint and in loop also
- From: "Peter Pein" <nospam@spam.no>
- Re: errors while picking random numbers under constraint and in loop also