Deank1905

15 Reputation

3 Badges

7 years, 81 days

MaplePrimes Activity


These are replies submitted by Deank1905

@tomleslie 

Thanks for the reply. I attached the worksheet so you wouldn't have to guess any variables. All done now as a previous comment has worked.

@Carl Love 

Thank you got it working!

@Carl Love 

Sorry I don't quite understand. 

for i from 1 to 10 do
   realchoose := rand(0.0..1.0);
   o := realchoose();
   print(o);
      for q from 1 to 2^t do
      if cumprob(q)>=o then
      printf("measurement = %d\n", q-1); break;
      end if;
      end do;
   if q-1=0 then q:=2^t; end if;
      p := ContinuedFraction((q-1)/2^t);
      cf := Term(p, 1..10);
      if cf=0 then cf:=1; end if;
      print(cf);
      cfmax := max[index](cf);
      cfmax1 := max(cf);
      if cfmax1<10 then cfmax:=5; end if;
      R := Convergent( p, cfmax-1);
      r := denom(R);
      print(r);

       end do;

this is the section from the procedure. The issue is that I can't get all of the values of r out of the loop so that I can calculate the lowest common multiple of them. Is the technique you provided applicable to that?

Thanks
 

@Kitonum Hi, sorry I didn't mention but I have included this package. I have specified the parameters as it is part of a whole procedure, but haven't included them in the section I've shared. Would you need to see the whole procedure?

Page 1 of 1