How to find out the series of configuration that a Turing machine enters when started on the string 10#10? - turing-machines

The language is given by:
B = {w#w | w is an element of {0,1}*}.
and the state diagram:
http://oi57.tinypic.com/iqlzdy.jpg
So far, this is what I've got:
(q1)10#10; x(q3)0#10; x0(q3)#10; x0#(q5)10
I'm a bit confused with which state it's supposed to enter next.

Related

What does the “n copies of type type” mean by OpenGL core profile

I'm looking at OpenGL 4.6 core profile. In chapter 23 table 23.12 it writes
Get value | Type | Get Command | Initial value |
TEXTURE_BINDING_BUFFER | 80* x Z^+ | GetIntegerv | 0 |
and table 23.1 explain type code
Z^+ is Non-negative integer or enumerated value
n × type is n copies of type type (n∗ indicates n is minimum)
But OpenGL 4 Reference Pages writes glGetIntegerv will return a single value for this enumerator. It seems like that type 80 x Z^+ or Z^+ makes no difference. So I think I do not quite understand the table 23.1's explanation about "n x type", can anyone explain this for me? Thanks.
The state vector for this get enumerator consists of 80* values. However, an individual glGetIntegerv for this enumerator only returns one of those values. Specifically, the one for the currently active texture unit, as defined by a call to glActiveTexture.
The specification defines how this works in section 22.5. You can also use glGetIntegeri_v to select from a specific texture unit, as also specified in 22.5.
Basically, you can't just use the state table to know how a particular get call works.

Selenium ide: already logged in or not?

I'm working with Selenium Ide 2.9.1.
The problem is to check if, beginning the automatic process, the user has already logged in.
So, on the first page of www.pageexample.com I need to check if id=welcome is JOHN SMITH.
If yes, the user has already logged in and then it's possible to go on with the following instruction (clickandwait | id=button10).
If not (I mean id=welcome is not present in the page), the login is needed (and in this case I've already built the instuctions).
I've installed Selenium IDE: flow control.
I need to check if id=welcome is JOHN SMITH.
If this is the problem, then the storeText command is the solution.
storeText | id=welcome | var
Then you check if var = "JOHN SMITH" with gotoIf from the flow control addon.
Taking a cue from the suggestion, I've elaborate the following code that seems to work:
storeElementPresent | id=loginbutton | x
storeElementPresent | id=sitename | y
gotoIf | x=y | z
....... operations of log in .......
label | z |
loginbutton is present only if the users has not logged in, sitename is always present (therefore always true): so, comparing the two values, in case of correspondence Selenium proceeds with the operation of log in, otherwise jumps to label z.
I know, it's an escamotage that can surely be improuved.

After you input a string that contains a single * character, how can I replace that character with the second string I create in my code?

I'm taking AP Computer Science in my high school and this week's assignment was to create a program that will work like:
>>Enter the first String:
<<D*g
>>Enter the replacement String:
<<in
>>Ding
However, our teacher hasn't really taught us anything helpful and almost every single person in my class is confused except for the Teacher Aid and teacher himself.
Could anybody help me out with this ?
Looks like AP stands for assembly language programming.
Assembly Language :
Assume you have the replacement string.
Algorithm :
1. count the number of characters in the second string
2. shift all the letters in the first string starting from * by n spaces to right.
3. point si to the * character in the first string and di to the second character in the second string.
4. go on copying character by character till the end.
Java :
if you are using java. You can use the replace function in the string class or substring function to work your solution.
AP Computer Science classes almost always give students a general understanding in Java. So, I'm going to assume you're using Java. So, in Java, the String class supplies you with a number of replacing methods, one of which being the replaceFirst method. Using this method in your situation would look like this:
Scanner get = new Scanner(System.in);
String manipulation = get.nextLine();
String replace = get.nextLine();
return(manipulation.replaceFirst("*",replace);

How to replace PID controller with fuzzy controller so that it can work exactly the same as PID

I have a model in simulink as shown
The model has PID controller with Kp=36 Kd=54 Ki=6. Pid controller is minimizing the error given as its input to zero. Now I want to replace it with fuzzy controller so that it exactly works the same as PID. What to do?
Its very simple ....
In Matlab workspace type fuzzy . Fuzzy toolbox will open. You are required to assign the Inputs and Outputs there. Make Error e and Change in error de as inputs nad Kp , Ki, and Kd as Outputs. Then decide the range for each of of the membership functions of these inputs and outputs. [Refer some research paper for details]
Save the model as Model.fis and export this model to workspace.
Open the Simulink and like as the figure you have posted replace it with Fuzzy Logic Controller Block and call the Model.fis in block. and run the simulation. :)

State machine, set of strings?

I am working on a homework assignment that deals with state machines. I understand how they operate, but there are a couple aspects of this particular question that I am not understanding.
Let L be the set of strings over {a,b} ending with the substring abba.
a. Build a DFA that accepts L.
b. Build an NFA with 6 transitions that accepts L.
How can I incorporate L into a state machine?
I am completely lost with part b, but I feel that once I understand part a, b shouldn't be too difficult.
Let's back up a bit. By convention, "L" is used to define a "language" - in this context a set (possibly infinite) of strings that meet some definition. When playing with finite automata, you're concerned with what strings are "accepted" by the machine and which ones are "rejected" & generally you want to accept all the strings in a given language & reject those that are not in it (another way of looking at the problem is that you can define a language as the set of all strings accepted by a machine - they're equivalent).
The first question is an exercise in building a DFA that accepts L - that is that, given any string that ends in "aaba", it accepts & given strings that don't end in "abba" it rejects. Your confusion seems to come from thinking that L somehow is "part of" your machine; at best you encode a description of L into your machine.
The second question is asking you to do the same thing with a NFA, with the additional restriction that it only has 6 transitions.
Let me try this:
Node 0:
a -> node 1 <-- This means, "if the next character is a, then go to node 1"
b -> node 0
END -> error
Node 1:
a -> node 1
b -> node 2
END -> error
Node 2:
a -> node 1
b -> node 3
END -> error
Node 3:
a -> node 4
b -> node 0
END -> error
Node 4:
END -> Success!
a -> node 1
b -> node 0
I believe that should do it. Each node has 3 possible arrows out of it, for an a, b, or end of string (END). Each input that's part of "abbaEND" leads to the next node and finally success, and each input that isn't part of "abbaEND" takes you back to the node appropriate. Basically, if it's an a, it treats it as the start of another "abba" block, and if it's a b, it assumes "abba" is coming next. An early END is a failure. That should be your DFA map.
So, using any string of a's and b's as input... this DFA should only end in Success! if the string ends in "abba", and should end in error for any other string.

Resources