1. Limited time only! Sign up for a free 30min personal tutor trial with Chegg Tutors
    Dismiss Notice
Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Homework Help: Help me with a LOGIC function

  1. Mar 1, 2013 #1
    In an airplane there are 16 seats, 4 for the airplane crew (pilots) and 12 for travelers. I must write a logic function which is always one when the airplane crew is on their seats(4), how many people are in the airplane it doesnt matte (0-12)r.
    My 1st idea is:
    For each seat i define a variable a,b,c,d,...., a,b,c,d for the airplane crew. Then i make all the posible combinations when a,b,c,d ==1 and the rest is 0 and 1 in a logic table and then i find the function.
    Is this correct???
    My 2nd idea is:
    If we care only about a,b,c,d isnt the function f=a*b*c*d which is 1 only when a,b,c,d is 1 :D ???
  2. jcsd
  3. Mar 1, 2013 #2

    Simon Bridge

    User Avatar
    Science Advisor
    Homework Helper

    That's sort of the idea ... you have a 16 bit number for the airline seats.
    bits 0,1,2, and 3 are crew seats. So [anything]1111 = 1 in your truth table - where [anything] is any 12-bit binary number.

    the function takes a 16 bit number input and returns a single bit that depends only on the four lowest order bits. So you need a way to remove the other 12 from contention.

    Note: this is assuming designated seating for the crew.
  4. Mar 2, 2013 #3
    Thanks for these details.
    I made my function like:
    My teacher teached us to make the logic table then we construct the function( he didnt specify anything for this one) but if i take all the cases when 0,1,2,3 are 1 and the rest of bits can have 2^12 combinations if i am not wrong and this will take me years to do :D. I think that function is corect and it contains all the bits. If any of the crew bits is 0, the function is 0 and if all the crew bits are 1 its 1.

    Also, if you have any other suggestion on the following question on the same problem.
    it, the first one really helped me.
    So, the problem says each seat has a seat belt and i have to make a function which is one when all the seat belts are belted up. My problem is that i dont know what to do if there is no traveler on the seat. Might be imposible to solve this one if we dont consider every seat occupied???
    Or i have to use the first function( all seats are occupied).
    Like if f2 is the second function f2=f*( function for the seat belts)??? And it would be false if the seats are not occupied.
    Also if i will use the first function for f2 i must changed it in f=(0*1*2*3)+(0*1*2*3*4*...*15).
    Lets say a,b,c,...p are the 16 biits of the seat belts, then f2=((0*1*2*3)+(0*1*2*3*...*15))*(a*b*c*d....*p).
    Last edited: Mar 2, 2013
  5. Mar 2, 2013 #4

    Simon Bridge

    User Avatar
    Science Advisor
    Homework Helper

    Basically there are 2^12 combinations which would output a 1, and 2^16-2^12 combinations which output a zero. Don't know what you are using for a function that it would take years to check the first four bits.

    Would it help you if you could make an efficient operation? I don't know what you are expected to produce for an answer.

    For the second problem, you are probably correct to assume they don't just want:
    if X=0xFFFF then f(X)=1 else f(X)=0

    If you already have a seat-occupation number, X, 16 bits wide, where a 1 indicates that a seat is occupied. You now introduce a second number for the seatbelt-status, Y, - also 16 bits wide, with "fastened"=1. You need to compare X and Y.

    Hint: The condition that makes a 1 is whatever does not make a 0.
  6. Mar 3, 2013 #5
    Ohh great, i undertood :D. Thanks a lot for suggestions.
    For the second function i made in 2 ways, the one you suggested and this one.
    I considered a 32 bits binary number, each pair of bits monitors if the seat is ocupied and if the seat belt is belted up.
    And i made the folowing function B`+A*B, where A is the bit of seat belt and B is the bit of the seat and its one when the seat is ocupied, belted up, seat is not ocupied, belted up, seat is not ucipied, not belted up and zero when the seat is ocupied and belt is not belted up and i use OR for each pair and the result is my function :D.
    Last edited: Mar 3, 2013
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook

Have something to add?
Draft saved Draft deleted