Mathematica 9 is now available
Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2003
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2003

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: errors while picking random numbers under constraint and in loop also

  • To: mathgroup at smc.vnet.net
  • Subject: [mg44170] Re: errors while picking random numbers under constraint and in loop also
  • From: Jens-Peer Kuska <kuska at informatik.uni-leipzig.de>
  • Date: Sat, 25 Oct 2003 06:26:20 -0400 (EDT)
  • Organization: Universitaet Leipzig
  • References: <bnansj$4df$1@smc.vnet.net>
  • Reply-to: kuska at informatik.uni-leipzig.de
  • Sender: owner-wri-mathgroup at wolfram.com

Hi,


%, and %% are assigned to Out[]  but in your compound expression there
is no In[]/Out[] that can be assigned.

BTW *Avoid* % an %% if you are working with notbooks ..

Regards
  Jens

sean kim wrote:
> 
> 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


  • Prev by Date: Re: Re: How do I make Combinatorica graphs of publishable quality?
  • Next by Date: Re: Integrating over area of intersection
  • Previous by thread: Re: errors while picking random numbers under constraint and in loop also
  • Next by thread: Re: errors while picking random numbers under constraint and in loop also