1 / 26

Problem Session 1

Problem Session 1. CS 302. Topics. LaTeX Questions from Class Extra problems. LaTeX. Typesetting software for math Used by scientific community Why should you learn it?. How to get LaTeX (windows). Download MikTeX ( www.miktex.org )

chelsi
Download Presentation

Problem Session 1

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Problem Session 1 CS 302

  2. Topics • LaTeX • Questions from Class • Extra problems

  3. LaTeX • Typesetting software for math • Used by scientific community • Why should you learn it?

  4. How to get LaTeX (windows) • Download MikTeX (www.miktex.org) • Download TeXnicCenter (or other IDE) (www.toolscenter.org)

  5. Starting a document • \documentclass[12pt]{article} • \pagestyle{plain} • \usepackage{anysize} • \marginsize{2.5cm}{2.5cm}{1.5cm}{1.5cm} • \begin{document} • … • \end{document}

  6. Math Mode • $ - begins math mode • ^ - superscript • _ - subscript • \mbox – enter text in math mode • \ - begins a command or escapes a character

  7. Using the Preamble • LaTeX allows you to create your own environments • \begin{proof} • Blah blah blah • \end{proof} • There are lots provided in the preamble

  8. Lists • \begin{enumerate}, \begin{itemize} • \item creates a new item • \begin{enumerate*} omits numbering

  9. Formatting • \newpage • \vspace{10mm}, \hspace{10mm} • newlines

  10. Including Images • \usepackage{graphicx} • \begin{figure}[!htbp] • \includegraphics[scale=.75]{hw1-9a.jpg} • \end{figure} • It probably won’t put things where you want. • Supports jpg, ps, but not gif

  11. Tutorials • Links on course webpage • Lots of links on wikipedia • Search for what you want!

  12. Questions From Class?

  13. Example of Conceptual Power of Non-determinism • Let L be regular • Let ½(L)={x : y |x|=|y| and xy  L} • i.e., ½(L) = first halves of strings in L • Is ½(L) regular?

  14. ½(L) is regular • Let M be a DFA for L • Construct M’ for ½(L) • M’ uses the “finger method” • Place left finger on q0 in M • Middle finger on qj, nondeterministic guess as to where x will lead • Right finger on qj

  15. Transition Function • As characters of x are read • M’ moves left finger along transitions dictated by characters read • And simultaneously moves right finger along a non-deterministically chosen edge • which may be labeled with any character, not necessarily the one of x being read

  16. Acceptance • M’ accepts x iff at the end • Left finger is on qj • Right finger is on accept state • Thus, M’ accepts x iff |x| |y| q0 qj

  17. Formal Implementation • Given M=(Q,,,q0,F) • Construct M’=(Q’,,’,q0’,F) • Q’ = Q x Q x Q  {s} • Q x Q x Q = (left,middle,right) • s = new start state

  18. Formal Implementation • Guess the state qj that input x will lead to • ’(s,) = {<q0,qj,qj> : qj in Q} • ’(<qi,qj,qk>, a) = • { <ql,qj,qm> : ’(qi,a)=ql and there is b in  such that (qk,b)=qm} • Note that the middle finger does not change after initial guess. • F’={ <qj,qj,qk> : qj in Q, qk in F}.

  19. Extra Problems • True or false: if T is countable, then the set {S|S a subset of T, S is finite} is also countable.

  20. True • Use the Subset Sum technique • T = { a1, a2, a3,…} • Add up the subscripts of each set of S • Order by sum of subscripts, then lexicographically (i.e. a set with a1 comes before a set with a2)

  21. Extra Problems • Is there a bijection between the interval (0,1) on the real line and all the real numbers?

  22. Yes • Tan(x-½ π)/π/2 • Project (0,1) to semi circle centered at (½, ½). Draw the ray passing through (½, ½) and intersecting the x-axis.

  23. Extra Problems • Show that if we add a single 32-bit register to a DFA and that each state can store some value in it then every language this machine accepts can be accepted by a regular DFA.

  24. The register adds a finite number of states to each state • Add states to the machine representing all the possible values the register could have at that state

  25. Extra Problems • Create a DFA the recognizes the set of strings in which the number of 0s is divisible by 2 and the number of 1s is divisible by 3.

More Related