The Grey Labyrinth is a collection of puzzles, riddles, mind games, paradoxes and other intellectually challenging diversions. Related topics: puzzle games, logic puzzles, lateral thinking puzzles, philosophy, mind benders, brain teasers, word problems, conundrums, 3d puzzles, spatial reasoning, intelligence tests, mathematical diversions, paradoxes, physics problems, reasoning, math, science.

   
The Grey Labyrinth Forum Index
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups    RegisterRegister  
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Samadhi's school help thread
Goto page Previous  1, 2, 3 ... 10, 11, 12, 13  Next
 
Reply to topic    The Grey Labyrinth Forum Index -> Science, Art, and Culture
View previous topic :: View next topic  
Author Message
MatthewV
Daedalian Member :_



PostPosted: Tue Aug 28, 2007 6:12 am    Post subject: 401 Reply with quote

I suppose it could be the Multiplicative Identity and the definition of division.

given: a =b, c/c = 1

a = a * c/c = b so... a * c = b * c

beautifully sloppy
Back to top
View user's profile Send private message Send e-mail AIM Address
Samadhi
+1



PostPosted: Tue Aug 28, 2007 6:18 am    Post subject: 402 Reply with quote

Good point. Since the "standard" properties are sufficient, it shouldn't be its own property.

Instead, I guess it would be a theorem.
_________________
And he lived happily ever after. Except for the dieing at the end and the heartbreak in between.
Back to top
View user's profile Send private message Send e-mail MSN Messenger
Antrax
ESL Student



PostPosted: Tue Aug 28, 2007 6:22 am    Post subject: 403 Reply with quote

One of the properties a set with two binary operations need to hold to be a field is the following: a(b+c) = ab+ac. Using this, you can easily prove what you were interested in.
_________________
After years of disappointment with get rich quick schemes, I know I'm gonna get rich with this scheme. And quick!
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Samadhi
+1



PostPosted: Tue Aug 28, 2007 6:38 am    Post subject: 404 Reply with quote

Yeah, distributive. Highly useful in some proofs that seem to only involve multiplicative properties. I think mattv's approach takes less steps though in this case.

To clarify, I'm not trying to prove this. I'm just curious. My professor did a hand wave when he had to do a = c --> ab = cb.
This is for Advanced Calculus: "Completeness of the real numbers and its consequences, sequences of real numbers, continuity, differentiability and integrability of functions of one real variable."

I'm looking forward to this class.
_________________
And he lived happily ever after. Except for the dieing at the end and the heartbreak in between.
Back to top
View user's profile Send private message Send e-mail MSN Messenger
Samadhi
+1



PostPosted: Tue Aug 28, 2007 7:12 am    Post subject: 405 Reply with quote

I'm not worried about any classes this semester except "Systems Programming":
Design and implementation of system software. Relationship between software design and machine architecture. Topics from assemblers, loaders and linkers, macro processors, compilers, debuggers, editors. Introduction to software engineering and review of programming fundamentals and object oriented concepts. Large project in object oriented programming is required.

Allegedly there are two prerequisites both of which I got ~95%. The prereqs were assembly (like butter) and data structures (all in java). This professor likes C though. I'd rather write in assembly than in C. Sure it'd take me x10 to x1000 lines, but I'd be 100% certain what is happening.
_________________
And he lived happily ever after. Except for the dieing at the end and the heartbreak in between.
Back to top
View user's profile Send private message Send e-mail MSN Messenger
CzarJ
Hot babe



PostPosted: Tue Aug 28, 2007 7:16 am    Post subject: 406 Reply with quote

Samadhi wrote:
This is for Advanced Calculus: "Completeness of the real numbers and its consequences, sequences of real numbers, continuity, differentiability and integrability of functions of one real variable."


I took that same class, only we at OU call it "Analysis I." I like our way, because that's 45 more syllables of math you can fit in.
Back to top
View user's profile Send private message Send e-mail AIM Address
Antrax
ESL Student



PostPosted: Tue Aug 28, 2007 7:51 am    Post subject: 407 Reply with quote

I don't understand what relation there is between compilers/preprocessors/linkers/loaders and software engineering. They're on the exact opposite ends of the scale.
In any case, if there's a connection between these two halves of the course, you won't be able to use Java, as you don't really get access to the hardware when working with it, at least to the best of my knowledge. C is much more bare-bones this way.
And even if I'm wrong, learn C already. It's really, really useful.
_________________
After years of disappointment with get rich quick schemes, I know I'm gonna get rich with this scheme. And quick!
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Samadhi
+1



PostPosted: Tue Aug 28, 2007 8:11 am    Post subject: 408 Reply with quote

Any of my descriptions were straight from the manual. Perhaps I should have disclaimed (IE I don't know the relationships either...I haven't taken the classes yet).

I've wanted to take a course that teaches C (it's in the manual), but they never seem to offer it (well not for 3 semesters, maybe some time soon). This is quite odd since many classes require "intimate" knowledge of C. I've ordered a book on "how to C", I hope that will help.
_________________
And he lived happily ever after. Except for the dieing at the end and the heartbreak in between.
Back to top
View user's profile Send private message Send e-mail MSN Messenger
Antrax
ESL Student



PostPosted: Tue Aug 28, 2007 8:45 am    Post subject: 409 Reply with quote

"A Book on C" is considered very good.
_________________
After years of disappointment with get rich quick schemes, I know I'm gonna get rich with this scheme. And quick!
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Samadhi
+1



PostPosted: Tue Sep 04, 2007 5:56 am    Post subject: 410 Reply with quote

I wrote a poker program in C (this is school independent, but important). I had trouble doing multiple calls. Such as, I pass two arrays to a function and then it returns the result from passing those two arrays to another function.

Was it because I declared them constant? I left some old code commented in the f1 function for critique.

I would have enjoyed using the results to call an array of dereferenced functions, but that's maybe for next time. Well, next to next. Next is programming the draw. Felicitous

I'm sure there are many ways to stream line this (and probably some pitfalls I missed). I would really, really enjoy criticism. It's long, but I tried to make the comments and most of the variable/function names friendly.

The file

Code:
#include <stdio.h>
#include <stdlib.h>
#include <time.h>

/*prototypes*/
void shuffle( int wDeck[]);
void deal (const int wHand[], const char *wFace[], const char *wSuit[]);
void handRank (const int wResult, const char *wRank[]);
void bubble (int work[], int const size);
int rank (const int hand[]);
void swap ( int *element1ptr, int *element2ptr); /*not inside bubble because
                                                 shuffle uses it too*/
int f1 (int const faceArray[]); /*check all matches*/
int f2 (int const suitArray[]); /*check flush*/
int f3 (int const faceArray[]); /*check straight*/
int f4 (int const faceArray[]); /*check straight flush*/

int main(){
   /*initialize the suit array*/
   const char *suit[4] = {"Clubs", "Diamonds", "Hearts", "Spades"};
   
   /*initialize the face array*/
   const char *face[13] = {"Ace", "Deuce", "Three", "Four",
      "Five", "Six", "Seven", "Eight", "Nine", "Ten", "Jack",
      "Queen", "King"};
   
   /*initialize the ranking array, lowest to highest*/
   const char *ranking[10] =
      {"Junk", "a pair", "two pairs", "three of a kind",
      "a straight", "a flush", "a full house", "four of a kind",
      "a straight flush", "a royal straight flush"};
   
   int count;
   int deck[52]; /*I avoid the complexity of a double
                 index by using some math*/
   int hand[5];
   
   /*initialize the deck*/
   for (count = 0; count < 52; count ++) {
      deck[count] = count;
      }
   
   /*initialize the "random" number generator*/
   srand( time(0));
   
   /*randomize the deck*/
   shuffle(deck);
   
   /*give the player 5 cards*/
   for (count = 0; count < 5; count++){
      hand[count] = deck[count];
   }
   
   /*sort the hand, lowest to highest*/
   bubble (hand, 5);
   
   /*print out the hand in real world values*/
   deal (hand, face, suit);
   
   /*evaluate the hands ranking*/
   handRank (rank(hand), ranking);
   
   return 0; /*successful completion*/
}

/*I use a swap shuffle for randomization which avoids indefinite repetition*/
void shuffle (int wDeck[]){
   int i;
   for (i = 0; i<52; i++)
   {
      swap ( &wDeck[i], &wDeck[rand()%52]);
   }
}

/*This simply prints out the cards to the screen*/
void deal (const int wHand[], const char *wFace[], const char *wSuit[]){
   
   int card;
   int tempSuit;
   int tempFace;
   
   printf ("Your hand.\n");
   for (card = 0; card < 5; card++){
      tempFace = (wHand[card] )/4;
      tempSuit = (wHand[card] )%4;
      printf( "%5s of %-8s\n", wFace[tempFace], wSuit[tempSuit]);
   }
}

/*this swaps two array elements using pointers and a hold variable*/
void swap (int *element1ptr, int *element2ptr){
   int hold;
   
   hold = *element1ptr;
   *element1ptr = *element2ptr;
   *element2ptr = hold;
}

/*I use bubble because it is simple and the array will
always be size 5*/
void bubble (int work[], const int size){
   int pass;
   int count;
   
   for ( pass = 1; pass < size; pass++){
      for ( count = 0; count < size - pass; count ++){
         if ( work[count] > work[count + 1]){
       swap (&work[count], &work[count + 1]);
    }
      }
   }
}

/*this function will return the relative strength of the hand (0-9)
by calling on other ranking functions*/
int rank (const int hand[]){
   
   int wSuit[4] = {0};
   int wFace[13] = {0};
   int count;
   int result;
   
   
   for (count = 0; count <5; count++){
      wSuit[(hand[count]-1)%4]++;
      wFace[(hand[count]-1)/4]++;
   }
   
   /*here's where I had my problem.  I wanted to make this one call
   then have f1 do more calls depending on what happens there.
   I ended up just returning state dependent values.*/
   result = f1(wFace);
   if (result == -1) {
      result = f2 (wSuit);
   }
   if (result == -1) {
      result = f3 (wFace);
   }
   
   if (result == -2) {
      result = f4 (wFace);
   }
   
   return result;
}

/*this function determines if there are any pairs, triplets,
or quads.  If and only if there are none, should we check
for flushes and/or straights*/
int f1 (int const faceArray[]){
   int i = 0;
   int pairCount = 0;
   int threeCount = 0;
   int fourCount = 0;
   
   
   while (i < 13){
      if (faceArray[i] == 2) pairCount++;
      if (faceArray[i] == 3) threeCount++;
      if (faceArray[i] == 4) fourCount++;
      i++;
   }
   
   /*one pair, checks for full house*/
   if (pairCount ==1){
      if (threeCount == 1) return 6;
      return 1;
   }
   
   if (pairCount == 2) {return 2;} /*two pair*/
   if (threeCount == 1) {return 3;} /*three of a kind*/
   if (fourCount == 1) {return 7;} /*four of a kind*/
   /*return f2(suitArray[], faceArray[]);  this is an example of what I
   originally wanted to do.  It gave me an error on or before the '['
   Note:  I originally passed both arrays with each call*/
   
   return -1; /*signals rank() to check for flushes/straights*/
}

/*this function checks for flushes*/
int f2 (int const suitArray[]){
   int i, j;
   int flushCount = 0;
   
   for (i = 0; i < 4; i++) {
      if (suitArray[i] == 5) flushCount++;
   }
     
   if (flushCount == 0) return -1; /*signals to check for straights*/
   return -2; /*signals to check for straight flushes.  I should probably merge
              these two funcions*/
}

/*checks for straights.  The setup implies that this is not a flush*/
int f3 (int const faceArray[]){
   int i, j;
   int begin;
   int trapped = 0;
   
   /*this code is identical to the code in f4.  Perhaps if I made
   a new array equal to the passed array and then checked that.*/
   
   /*this finds the lowest card in the hand*/
   for (i = 0; i < 13; i++) {
      if (faceArray[i] !=0  && trapped != 1) {
         begin = i;
    trapped = 1;
      }
   }
   
   /*0 = junk*/
   for (i = begin; i < begin + 4; i++){
      if (faceArray[i + 1] == 0) { /*this checks to see if the cards are
                                   sequential ascending*/
         if (begin != 0) return 0; /*If the beginning is not an ace it can't
                              be a straight, failfast*/
    for (j = 9; j < 13; j++) { /*If low is an ace, then check 9-12*/
       if (faceArray[j] != 1) return 0;
    }
    return 4; /*end nested for, return value = straight*/
      }
   }
   return 4; /*end for, straight*/
}

/*this checks for straight flushes (and royals)*/
int f4 (int const faceArray[]){
   int i, j;
   int begin;
   int trapped = 0;
   
   
   /*this is all identical to f3 with the exception for the RF check
   see notes there*/
   for (i = 0; i < 13; i++) {
      if (faceArray[i] !=0  && trapped != 1) {
         begin = i;
    trapped = 1;
      }
   }
   
   for (i = begin; i < begin + 4; i++){
      if (faceArray[i + 1] == 0) {
         if (begin != 0) return 5; /*has to be a flush to be here*/
    for (j = 9; j < 13; j++) {
       if (faceArray[j] != 1) return 5; /*ditto*/
    }
      }
   }
     
   if (faceArray[9]==1 && faceArray[0]==1) {
      return 9; /*it's a SF, so checking the outer bound is sufficient*/
   }
   return 8; /*"only" a SF*/
}

/*prints out the value of the hand*/
void handRank (const int wResult, const char *wRank[]){
   printf ("You have %s\n", wRank[wResult]);
}

_________________
And he lived happily ever after. Except for the dieing at the end and the heartbreak in between.
Back to top
View user's profile Send private message Send e-mail MSN Messenger
Antrax
ESL Student



PostPosted: Tue Sep 04, 2007 6:31 am    Post subject: 411 Reply with quote

First of all, a challenge to you: write a more efficient shuffling algorithm. The one you come up with should run at O(n) time, where n is the size of the array, and guarantee a uniform distribution.
(This is not only something you sometimes need to use in real life, it's also a common work interview question. Plus, it's fun).
Secondly, if all you want is to deal cards and then evaluate the hand, it seems you're doing too much work. Just choose five random unique ints from 0 to 51 and you're set.
Thirdly, sorting seems odd. It simplifies finding pairs, but doesn't help anything else.
Haven't read everything yet, though.
_________________
After years of disappointment with get rich quick schemes, I know I'm gonna get rich with this scheme. And quick!
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Antrax
ESL Student



PostPosted: Tue Sep 04, 2007 7:12 am    Post subject: 412 Reply with quote

Oh, and after reading your commented out code, it's just a syntax issue. Your functions take "int const []" parameters, which are in fact constant pointers to integers. So, to pass them around, say from f1 to f2, you shouldn't do (f2(arr[])) which is a syntax error I think, but rather (f2(arr)), as arr is the pointer, and not arr[].
_________________
After years of disappointment with get rich quick schemes, I know I'm gonna get rich with this scheme. And quick!
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Samadhi
+1



PostPosted: Tue Sep 04, 2007 7:12 am    Post subject: 413 Reply with quote

I thought my shuffling algorithm was O(n)?

In re: second. I'm prepping to scale up to a program that deals multiple hands and allows for redraws. To me, this seems to require the overhead of a shuffled array.
But, if I only needed to choose 5 randomly selected numbers from 0 to 51:
Code:

int deck[52] = {0};
int hand[5];
int draw;
srand ( time(0));
for (i=0; i < 5; i++) {
   draw = rand()%52;
   while (deck[draw] !=0) {
      if (draw == 51) draw = 0;
      else draw++;
   }
   hand[i] = draw;
   deck[draw] = 1;
}


In re: Sorting.
For matching I just use a counting algorithm. The sorting helps with straights only. As per my notes I used the bubble because it's just about the simplest algorithm, and with a hand size of 5, who cares if it's O(n 2 )?

Here are my pseudo steps for rank:
1. Count each of the faces (0-12).
1.1 If no face count is > 1, go to 2. (any match precludes straights or flushes)
1.2 If only 1 pair
1.2.1 If there is a three result is a full house.
1.2.2 Else there is only a pair.
1.3 If two pair result is two pair.
1.4 If three of a kind result is three of a kind.
1.5 If four of a kind result is four of a kind.
1.6 Go to 2

2. Count each of the suits (0-3).
2.1 If not all suited go to 3.
2.2 If all suited go to 4.

3. Determine if all of the cards are a straight.
3.1 Not a straight, result is junk.
3.2 A straight, result is a straight.

4. Determine if all the cards are a straight.
4.1 Not a straight, result is a flush.
4.2 Check for bounds = { 10, ace }
4.2.1 Not bounds, result is a straight flush.
4.2.2 Bounds, result is a royal straight flush.
_________________
And he lived happily ever after. Except for the dieing at the end and the heartbreak in between.
Back to top
View user's profile Send private message Send e-mail MSN Messenger
Samadhi
+1



PostPosted: Tue Sep 04, 2007 7:13 am    Post subject: 414 Reply with quote

I thought my shuffling algorithm was O(n)?

In re: second. I'm prepping to scale up to a program that deals multiple hands and allows for redraws. To me, this seems to require the overhead of a shuffled array.
But, if I only needed to choose 5 randomly selected numbers from 0 to 51:
Code:

int deck[52] = {0};
int hand[5];
int draw;
srand ( time(0));
for (i=0; i < 5; i++) {
   draw = rand()%52;
   while (deck[draw] !=0) {
      if (draw == 51) draw = 0;
      else draw++;
   }
   hand[i] = draw;
   deck[draw] = 1;
}


In re: Sorting.
For matching I just use a counting algorithm. The sorting helps with straights. As per my notes I used the bubble because it's just about the simplest algorithm, and with a hand size of 5, who cares if it's O(n 2 )?

Here are my pseudo steps for rank:
Code:

1.  Count each of the faces (0-12).
   1.1  If no face count is > 1, go to 2.  (any match precludes straights or flushes)
   1.2  If only 1 pair
        1.2.1  If there is a three result is a full house.
        1.2.2  Else there is only a pair.
   1.3  If two pair result is two pair.
   1.4  If three of a kind result is three of a kind.
   1.5  If four of a kind result is four of a kind.

2.  Count each of the suits (0-3).
   2.1  If not all suited go to 3.
   2.2  If all suited go to 4.

3.  Determine if all of the cards are a straight.
   3.1  Not a straight, result is junk.
   3.2  A straight, result is a straight.

4.  Determine if all the cards are a straight.
   4.1  Not a straight, result is a flush.
   4.2  Check for bounds = { 10, ace }
         4.2.1  Not bounds, result is a straight flush.
         4.2.2  Bounds, result is a royal straight flush.

_________________
And he lived happily ever after. Except for the dieing at the end and the heartbreak in between.
Back to top
View user's profile Send private message Send e-mail MSN Messenger
Antrax
ESL Student



PostPosted: Tue Sep 04, 2007 8:09 am    Post subject: 415 Reply with quote

Quote:
I thought my shuffling algorithm was O(n)?
Oh, it is. But it sucks at shuffling, both empirically and mathematically. I dare you to prove anything on its output distribution.
_________________
After years of disappointment with get rich quick schemes, I know I'm gonna get rich with this scheme. And quick!
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Samadhi
+1



PostPosted: Tue Sep 04, 2007 8:34 am    Post subject: 416 Reply with quote

It was easy, sue me. Felicitous

Quote:
But it sucks at shuffling, both empirically and mathematically.
I'm quite interested in the mathematical reasons. I can't think of why this shouldn't work, and a proof would be pleasant to absorb.

Quote:
I dare you to prove anything on its output distribution.
I will pass on that dare. Hmmm, well for now. I assume the proof has been tried before so I'm barking up a tree that Fermat couldn't get up?
I'll still toy with it.
_________________
And he lived happily ever after. Except for the dieing at the end and the heartbreak in between.
Back to top
View user's profile Send private message Send e-mail MSN Messenger
Antrax
ESL Student



PostPosted: Tue Sep 04, 2007 8:48 am    Post subject: 417 Reply with quote

I think you can actually prove the output isn't uniform. Not sure. There's a more elegant way, in any case.
_________________
After years of disappointment with get rich quick schemes, I know I'm gonna get rich with this scheme. And quick!
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Samadhi
+1



PostPosted: Tue Sep 04, 2007 9:47 am    Post subject: 418 Reply with quote

...and it is?
_________________
And he lived happily ever after. Except for the dieing at the end and the heartbreak in between.
Back to top
View user's profile Send private message Send e-mail MSN Messenger
Samadhi
+1



PostPosted: Tue Sep 04, 2007 10:53 am    Post subject: 419 Reply with quote

The counter proof is almost trivial. Consider n = 3. There are 3! possibilities with equal probability. For the swap algorithm to work in this case all iterated possibilities must be equal. If we don't ignore self swapping, the number of branches for this algorithm is 27, which is not divisible by 6. If we ignore self swapping, the branches for this algorithm is 8, also not divisible by 6.
_________________
And he lived happily ever after. Except for the dieing at the end and the heartbreak in between.
Back to top
View user's profile Send private message Send e-mail MSN Messenger
Antrax
ESL Student



PostPosted: Tue Sep 04, 2007 11:17 am    Post subject: 420 Reply with quote

Below is the random permutation code I use in one of my crypto projects. get_rand(int max) return a random integer in [0, max) (you can use rand() % max, I had to use something else)

Code:

#define N 16

void rand_permute(unsigned int perm[N])
{
  unsigned int i    = 0;
  unsigned int size = N;
  unsigned int temp[N];
  memcpy(temp, perm, sizeof(unsigned int) * N);
  while(size)
  {
    unsigned int index = get_rand(size);
    perm[i++]          = temp[index];
    temp[index]        = temp[--size];
  }
}

_________________
After years of disappointment with get rich quick schemes, I know I'm gonna get rich with this scheme. And quick!
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Samadhi
+1



PostPosted: Wed Sep 05, 2007 5:49 am    Post subject: 421 Reply with quote

That seems to randomize well but it seriously screws up my hand analyzing algorithms and gives me random segmentation faults. I'm not entirely clear what yours does, so I don't think I'll use it. Felicitous

I went with this instead:
Code:
void shuffle (int wDeck[]){
   unsigned int i = 0;
   unsigned int size = 52;
   unsigned int temp [52] = {0};
   unsigned int index;
   
   while(size){
      index = rand()%52;
      while (temp[index]){
         index++;
         if (index>51) index -= 52;
      }
      temp[index] = 1;
      wDeck[i++] = index;
      size--;
   }
}


My rank algorithm seems to be malfunctioning now though.
_________________
And he lived happily ever after. Except for the dieing at the end and the heartbreak in between.
Back to top
View user's profile Send private message Send e-mail MSN Messenger
Bicho the Inhaler
Daedalian Member



PostPosted: Wed Sep 05, 2007 7:28 am    Post subject: 422 Reply with quote

That still isn't uniform, Samadhi.

Here's a more natural way to express Antrax's algorithm (which is the random permutation algorithm as far as I'm concerned):
Code:
void random_permute(int *p, int n)
{
    int k;
    for (k = 0; k < n; ++k)
    {
        int t = p[k];
        int index = get_rand(n - k);
        p[k] = p[index];
        p[index] = t;
    }
}
Antrax's temp array set up effectively moves the "int t = p[k];" out of each iteration of the inner loop and does them all in a single memcpy. The extra array effects a modest increase in the space used, but it probably makes it run a bit faster.
Back to top
View user's profile Send private message
Samadhi
+1



PostPosted: Wed Sep 05, 2007 7:47 am    Post subject: 423 Reply with quote

I'm strained to understand why that's not uniform, but I'll take your word for it. At least until I dis/prove it. *nudge*
_________________
And he lived happily ever after. Except for the dieing at the end and the heartbreak in between.
Back to top
View user's profile Send private message Send e-mail MSN Messenger
Samadhi
+1



PostPosted: Wed Sep 05, 2007 10:15 pm    Post subject: 424 Reply with quote

Ugh.

Prove that any nonzero integer may be uniquely represented in the form
n = c s 3 s +...+c 0 3 0 . Where c i is either -1, 0, or 1.

This should be similar to the proof for bases but that -1 is screwing me up.

For existence I'm thinking of using:
If n > 0 then it can be written as a s k s +...+a 0 k 0 where k = 3 and 0 <= a < k. (bases theorem). And each a can be written as either 0, 1 or 3 -1. But that gets hairy.

I suppose I could try to use the fact that if 1*3 s +...+1*3 0 + 1 = 1*3 s+1 + -1*3 s +...+ -1*3 0 (provable by induction)
then show that f(n) [the number of representations of n] equals 1 for all n.

Am I on the right track at least?
_________________
And he lived happily ever after. Except for the dieing at the end and the heartbreak in between.
Back to top
View user's profile Send private message Send e-mail MSN Messenger
Bicho the Inhaler
Daedalian Member



PostPosted: Wed Sep 05, 2007 11:03 pm    Post subject: 425 Reply with quote

Samadhi wrote:
I'm strained to understand why that's not uniform, but I'll take your word for it. At least until I dis/prove it. *nudge*
Given that wDeck[0] = 0, wDeck[1] should be uniform on 1, ..., 51. In your function, if you choose 0 for wDeck[0], then temp[0] = 1, temp[1] = 0, ..., temp[51] = 0. The probability of wDeck[1] being 2 is 1/52, since the random number generator has to give you exactly 2. The probability of wDeck[1] being 1 is 2/52, since the random number generator can give you either 0 or 1. This isn't a uniform distribution.
Back to top
View user's profile Send private message
Samadhi
+1



PostPosted: Wed Sep 05, 2007 11:10 pm    Post subject: 426 Reply with quote

Thanks, that's what I thought of this morning.
_________________
And he lived happily ever after. Except for the dieing at the end and the heartbreak in between.
Back to top
View user's profile Send private message Send e-mail MSN Messenger
Bicho the Inhaler
Daedalian Member



PostPosted: Wed Sep 05, 2007 11:15 pm    Post subject: 427 Reply with quote

For your new problem: this is actually much easier than you're making it out to be. How would you compute c 0 , ..., c s ? If you do it the right way (the easy way), it will follow immediately that each digit is uniquely determined. The hardest part may be showing that the computation terminates, but that isn't hard.
Back to top
View user's profile Send private message
Samadhi
+1



PostPosted: Wed Sep 05, 2007 11:55 pm    Post subject: 428 Reply with quote

3 divides either n, n-1, or n+1. If 3|n, then c 0 = 0. If 3|n-1, then c 0 = 1. If 3|n+1, then c 0 = -1.

For c 1 do the same but use n/3, (n+1)/3, or (n-1)/3 as appropriate.

So, existence: *hand wave* Felicitous (I'm not sure how to clearly state this)
Uniqueness: Assume that n can be written as a set of a's and a set of b's where at least one of the elements differ. But this implies that at some point during the set up the number and one more than or one less than the number would be divisible by 3, which is impossible. So the set a must equal the set b. (I'm not sure how rigorous that is)

Thanks for the hint. Felicitous
_________________
And he lived happily ever after. Except for the dieing at the end and the heartbreak in between.
Back to top
View user's profile Send private message Send e-mail MSN Messenger
Sam*
Guest



PostPosted: Fri Sep 07, 2007 1:16 am    Post subject: 429 Reply with quote

Q. A nonempty set of integers J that fulfills the following two conditions is called an integral ideal:
(a) If n, m are in J, then n + m and n - m are in J; and
(b) If n is in J and r is any integer, then rn is in J.

Further, for any integer m let J m = {mk : k ∈Z}, the set of all integer multiples of m. You may assume that J m is an integral ideal.

Prove that every integral ideal J is, in fact, equal to J m for some m ∈Z

I went with this:
Let m > n. --> since m - n ∈J, J contains positive integers. From the least positive integer theorem (or something like that) there exists a smallest positive integer. Call this value m.
By property b, rm (r ∈Z) ∈J.
Thus J = J m

Is that sufficient? It kind of felt like a hand wave there at the end. Should I have proved they're subsets of each other?
Back to top
Sam*
Guest



PostPosted: Fri Sep 07, 2007 1:35 am    Post subject: 430 Reply with quote

Here's one that a friend is working on for his Algorithms class:

How can you rearrange the following pair of equations so that you only need to perform three total multiplications?
x = ab + bc + cd - cc
y = ab + cc + cd
Back to top
kevinatilusa
Daedalian Member



PostPosted: Fri Sep 07, 2007 11:03 am    Post subject: 431 Reply with quote

Sam,

In your integral ideal question, you right that you need to show that they're subsets of each other.

What you've done is exhibit some m for which you think J=J_m, then show that any element in J_m is also in J. You still need to show that if something is in J, then it's also in your J_m.

One other little catch to watch out for...you began by assuming that J contained two elements such that m>n. Are you completely sure that J has to contain two different integers like that? You should be able to come up with at least one ideal that doesn't...
Back to top
View user's profile Send private message
Samadhi
+1



PostPosted: Fri Sep 07, 2007 11:57 am    Post subject: 432 Reply with quote

k:
Quote:

In your integral ideal question, you right that you need to show that they're subsets of each other.
The weird thing is that I only thought of this because of Abstract Algebra (rings, ideals, etc) class last semester. That method hasn't come up at all in this class so there should be a way to prove it without.
Quote:
you began by assuming that J contained two elements such that m>n. Are you completely sure that J has to contain two different integers like that?
Fine, there is the trivial solution. Razz
_________________
And he lived happily ever after. Except for the dieing at the end and the heartbreak in between.
Back to top
View user's profile Send private message Send e-mail MSN Messenger
kevinatilusa
Daedalian Member



PostPosted: Sun Sep 09, 2007 8:55 am    Post subject: 433 Reply with quote

The "showing isn't things are equal by showing each is a subset of the other" isn't really a method so much as it is a definition. Most ways of showing two groups/rings/etc. are equal (e.g. working with generators) comes down in some way to showing that they contain the same elements.

In many of my classes it was just assumed beforehand that we knew this. Even though we never explicitly went over the method in class, we still were expected to use it in homework.
Back to top
View user's profile Send private message
Antrax
ESL Student



PostPosted: Sun Sep 09, 2007 9:01 am    Post subject: 434 Reply with quote

What kevinailusa said. Showing inclusion both ways is almost the only way used to prove sets are equal.
_________________
After years of disappointment with get rich quick schemes, I know I'm gonna get rich with this scheme. And quick!
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Samadhi
+1



PostPosted: Sun Sep 09, 2007 9:08 am    Post subject: 435 Reply with quote

I will keep that in mind. It's weird that I only heard of this recently.

I figured out my friends problem:

x= ab + c (b + d - c)
y= ab + c (c + d)
_________________
And he lived happily ever after. Except for the dieing at the end and the heartbreak in between.
Back to top
View user's profile Send private message Send e-mail MSN Messenger
Samadhi
+1



PostPosted: Tue Sep 11, 2007 5:12 am    Post subject: 436 Reply with quote

For the ideal problem:

Trivial case: J = {0} = J 0
(1)
J ∈J 0 . ∀m, n ∈J --> m - n ∈J. Every m or n is 0, so every m - n is 0 ∈ J 0 (0k)
(2)
J 0 ∈ J. From the definition J 0 = {0k : k ∈Z}. Which for every k = 0. And from b, J contains 0 and 0 times any Z = zero.
Since the two are subsets of each other they are equal.

Non trivial: J = J m where m ≠ 0.
(1) [J ∈J m ]From (b) there are infinitely many members of this set and they are well ordered (integers). Therefore ∃ o, n ∈J | o-n > 0. This implies that J contains positive integers. Since the integers are well ordered there must be a smallest positive integer in J. Let this be called m. Since (b) is identical to the definition for J m and we have defined it as m, J ∈J m
(2) [J m ∈J] Since (b) and the definition for J m are identical it would be left to show (a)
Let m 1 = k 1 m, m 2 = k 2 m for some k 1 , k 2 ∈Z. Therefore m 1 - m 2 = m (k 1 -k 2 ). Since k 1, 2 ∈Z and Z is closed is a field --> m (k 1 -k 2 ) = mk 3 with k 3 ∈Z --> [J m ∈J] from (b)

I think I might have engaged in overkill.
[Edit: this was for last week's quiz and it took 95% of my time (the other questions were easy IMO). I just want to hone my skills.]
_________________
And he lived happily ever after. Except for the dieing at the end and the heartbreak in between.
Back to top
View user's profile Send private message Send e-mail MSN Messenger
Samadhi
+1



PostPosted: Wed Sep 12, 2007 12:21 pm    Post subject: 437 Reply with quote

Merde. I transcribed the earlier algorithm problem incorrectly.
It should be:
x = ab + bc + ad - cc (vice cd)
y = ab + cc + cd

Allegedly this can be done but the only detail I recall is adding x and y together....but that's a hornet's nest and I don't see how that could simplify things. It's not for school, maybe I should post it in VSP.
_________________
And he lived happily ever after. Except for the dieing at the end and the heartbreak in between.
Back to top
View user's profile Send private message Send e-mail MSN Messenger
Samadhi
+1



PostPosted: Wed Sep 12, 2007 10:59 pm    Post subject: 438 Reply with quote

Could someone take me through the steps to solve for the general solution of the following?

x' = x (1 - x) - h. For all h > 0
_________________
And he lived happily ever after. Except for the dieing at the end and the heartbreak in between.
Back to top
View user's profile Send private message Send e-mail MSN Messenger
Samadhi
+1



PostPosted: Wed Sep 12, 2007 11:17 pm    Post subject: 439 Reply with quote

Nevermind. I found a good site that step by steps it. Refresher = good. Felicitous
_________________
And he lived happily ever after. Except for the dieing at the end and the heartbreak in between.
Back to top
View user's profile Send private message Send e-mail MSN Messenger
Samadhi
+1



PostPosted: Thu Sep 13, 2007 10:42 am    Post subject: 440 Reply with quote

I know I've seen this problem before and that's annoying. But it's for next week's homework so it goes here.

Find three real number x, y, z such that
-2 < (x 2 + y 2 + z 2 )/(xy + xz + yz) < 1

Or prove no such numbers exist.

I hope my computer model wasn't badly designed because I believe no such numbers exist. Following that lead...

Obvious:
At least one variable needs to have a different value than the other two.
We can focus on each variable being on or around +-1, since anything else can be factored out.
We can set x = 1 and let the others be relative.

Proof by cases: (surely there's something better?)
_________________
And he lived happily ever after. Except for the dieing at the end and the heartbreak in between.
Back to top
View user's profile Send private message Send e-mail MSN Messenger
Display posts from previous: by   
Reply to topic    The Grey Labyrinth Forum Index -> Science, Art, and Culture All times are GMT
Goto page Previous  1, 2, 3 ... 10, 11, 12, 13  Next
Page 11 of 13

 
Jump to:  
You cannot post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group
Site Design by Wx3