Convert PDA to CFG – Language of Palindromes over $\{a,b\}^+$

I tried to convert the following PDA $ M$

to a CFG and got the following results. However I’m not quite sure if I did the algorithm the right way. I feel like I maybe misunderstood some the algorithm when it comes to the $ A_{p,q} \to xA_{r,s}y$ part. Could you help me to clear things up?

$ G = (V,\Sigma,P,S)$ with \begin{align*} V = \{&A_{0,0},A_{0,1},A_{0,2},A_{0,3},A_{0,4},A_{1,0},A_{1,1},A_{1,2},A_{1,3},A_{1,4},A_{2,0},A_{2,1},A_{2,2},A_{2,3},A_{2,4},\ &A_{3,0},A_{3,1},A_{3,2},A_{3,3},A_{3,4},A_{4,0},A_{4,1},A_{4,2},A_{4,3},A_{4,4},S\}, \end{align*} $ \Sigma = \{a,b\}$ , $ S = A_{0,4}$ and the following productions: \begin{align*} S &\to A_{0,4}\ A_{0,0} &\to \epsilon\ A_{1,1} &\to \epsilon\ A_{2,2} &\to \epsilon\ A_{3,3} &\to \epsilon\ A_{4,4} &\to \epsilon\ A_{0,0} &\to A_{0,0}A_{0,0} \vert A_{0,1} A_{1,0} \vert A_{0,2}A_{2,0} \vert A_{0,3}A_{3,0} \vert A_{0,4}A_{4,0}\ A_{0,1} &\to A_{0,0}A_{0,1} \vert A_{0,1} A_{1,1} \vert A_{0,2}A_{2,1} \vert A_{0,3}A_{3,1} \vert A_{0,4}A_{4,1}\ A_{0,2} &\to A_{0,0}A_{0,2} \vert A_{0,1} A_{1,2} \vert A_{0,2}A_{2,2} \vert A_{0,3}A_{3,2} \vert A_{0,4}A_{4,2}\ &\vdots\ A_{4,4} &\to A_{4,0}A_{0,4} \vert A_{4,1} A_{1,4} \vert A_{4,2}A_{2,4} \vert A_{4,3}A_{3,4} \vert A_{4,4}A_{4,4}\ A_{0,4} &\to A_{1,3}\ A_{1,3} &\to aA_{1,3}a\ A_{1,3} &\to bA_{1,3}b\ A_{1,3} &\to aA_{1,1}\ A_{1,3} &\to bA_{1,1} \end{align*}

Convert php into shortcode

Kindly someone convert this php code into shortocode. I am unable to do this. Thanks in advance!

<?php if ( $  type == 'credit' ) { <p><?php _e( "Thank you for using your nedvil wallet.", 'woo-wallet' ); ?> <?php echo wc_price( $  amount, woo_wallet_wc_price_args($  user->ID) ); ?> <?php _e( 'has been credited to your wallet.', 'woo-wallet' ); ?> <?php _e( 'Current wallet balance is', 'woo-wallet' ); ?> <?php echo woo_wallet()->wallet->get_wallet_balance( $  user->ID ); ?></p> <?php } ?> <?php if ( $  type == 'debit' ) { ?>     <p><?php _e( "Thank you for using your wallet.", 'woo-wallet' ); ?> <?php echo wc_price( $  amount, woo_wallet_wc_price_args($  user->ID) ); ?> <?php _e( 'has been debited from your wallet.', 'woo-wallet' ); ?> <?php _e( 'Current wallet balance is', 'woo-wallet' ); ?> <?php echo woo_wallet()->wallet->get_wallet_balance( $  user->ID ); ?></p> <?php } <?php 

Why does SQL Server say it can’t convert varchar to numeric?

I have the following schema/data in MSSQL Server 2019 (SQLFiddle):

CREATE TABLE products(     idn NUMERIC(9) PRIMARY KEY );  CREATE TABLE sales(     idn NUMERIC(9) PRIMARY KEY,     pid VARCHAR(50) NOT NULL,     type VARCHAR(10) NOT NULL );  INSERT INTO products (idn) VALUES (1); INSERT INTO sales (idn, pid, type) VALUES (1, 1, 'number'); INSERT INTO sales (idn, pid, type) VALUES (2, 'Colgate', 'word'); 

sales has mixed data i.e VARCHAR and NUMERIC. The transaction filter takes care of JOINing correctly.

Why does the following SELECT fail?

SELECT      *  FROM      products      INNER JOIN sales ON products.idn =      AND sales.type = N'number'  WHERE      products.idn in (1);  

I don’t see why casting NVARCHAR to NUMERIC is an issue:


If I modify the query slightly it works:

SELECT      *  FROM      products      INNER JOIN sales ON products.idn =      AND sales.type = N 'number'  WHERE     -- Selecting the same data from `sales`. in (1);  SELECT      *  FROM      products      INNER JOIN sales ON products.idn =     -- Dropping the `N` prefix.     AND sales.type = 'number'  WHERE      products.idn in (1);  

How to convert this if-clause condition to a linear programming optimization problem

Let’s consider the following conditional constraint. w is a set of input data. x,y(1:3),d(1:3) are the decision variables.

x= 3.9         % optimization variable (one can iterate over it 0<x<5 ) for i=1:3     if w[i]-x <=0          d[i]=x-w[i];         y[i]= w[i]     else         d[i]=0         y[i]=w[i]     end end 

The linear expression of the above constraint can be expressed as follows:

Max $ 40𝑥+15𝑦_1−30𝑑_1+15𝑦_2−30𝑑_2+15𝑦_3−30𝑑_3$

$ x_i – y_i <= d_i, i=1:3$

$ y_i = w_i , i=1:3$

$ 0 <= x <= 5$

$ y,d_i>= 0, i=1:3$

However, I want to change the conditional constraint as follows:

for i=1:3         if w[i]-x <=0              d[i]=x-w[i];             y[i]= w[i]         else             d[i]=0             y[i]=x    % The change         end end 

How can I modify the linear optimization problem to satisfy the new condition?!

convert RE to NFA

The Regular Expression i am having trouble with is the following a(b|bcc*)*c. My main concern is what do i do with the c*? I can lay the rest of the diagram correctly (i think) but that part is beyond me. Any help would be great, thank you. What i have: enter image description here

How to convert NPDA to PDA?

I have been given this Nondeterministic pushdown automata and I need to convert it to deterministic pushdown automata, I have been stuck with this for a while now, I know that there cant be transitions where the pda doesnt read anything from the stack but i dont know how to solve this. NPDA

Thanks in advance!

How can I best convert an Oath of the Ancients paladin from D&D 5e to 3.5e?

I’m working on starting a D&D 3.5e campaign with a group of players with whom I’ve previously played a 5e campaign. One of these players plays a 5th-level Paladin with the Oath of the Ancients in our 5e campaign, and would like to play a similar style of character in the 3.5e campaign. My question is how to best convert the character over from 5e to 3.5e while preserving the character’s essence in play.

For context, this player plays the paladin as a lightly armored half-elf with a longsword and shield, emphasizing the ability to smite for lots of damage fast. The character has also made some use of the lay on hands ability, but otherwise has made fairly negligible use of spells due to everyone else in the party also having some spellcasting ability.

My first thought on how to convert the character was to use a Duskblade, since the arcane channeling ability provides a similar strong strike style effect as the Paladin’s smite ability in 5e. I preferred Duskblade channeling over Paladin smites because the smite in 3.5e is quite lackluster and nowhere near as repeatedly usable, especially at low levels. However, the Duskblade would not provide any healing ability, and lacks the divine flavor of the paladin. These aren’t insurmountable problems, but I am hoping for a better fit.

Is there an option that better fits the playstyle of a Good, lightly armored, sword-and-shield character with fast and highly damaging attacks and the ability to heal at 5th level?

How to convert a range of 0 – 1023 to 0 – 255? [closed]

Hi smart community,

I am stuck with a problem where I get an input somewhere between the range of 0 to 1023 and I want to give an output ranging between 0 to 255 as per the input value. How should I do it? Quick note that I don’t want to use any libraries only for my own satisfaction.

I do find kind of similar questions already answered but I would rather welcome an explained derivation to the formula you provide. Thanks very much 🙂

How can I convert a Classic Slideshow to an ordinary notebook?

I have several Classic Slideshow presentations originally created 3 or 4 years ago. I would like to convert these to ordinary Mathematica notebooks, removing all the slideshow-related paraphernalia including page breaks, etc.

If I simply select Format > Stylesheet > Default, the separate slides are still there, labelled “Slide 1 of 34” etc.. Is it then just a matter of manually removing all the page breaks, or is there more to it?

Related to this, (though it’s not what I want to do at present), what is the best way to convert from a classic slideshow to the newer Presentation style? Will Format > Stylesheet > PresenterTools do the job correctly?