Is this language L = {w $\in$ {a,b}$^*$ : ($\exists n \in \mathbb{N} $)[$w|_b = 5^n$]} regular?

Let’s say we have the language L = {w $ \in$ {a,b}$ ^*$ : ($ \exists n \in \mathbb{N} $ )[$ w|_b = 5^n$ ]}. I want to know if this is a regular language or not. How do I go about doing this? I’m familiar with the Myhill-Nerode theorem but I don’t know how to apply it.

Given the Equivalence relation R = { x, y $\in$ $\Bbb{Z}$ : (x+y) mod 2 = 0}, what are equivalence classes 1 and 2?

Given the Equivalence relation R = { x, y $ \in$ $ \Bbb{Z}$ : (x+y) mod 2 = 0}, what are equivalence classes of 1 and 2?

I can’t really see the equivalence classes of infinite sets. Only by having a drawing of all elements can I distinguish the answers, wich is not the case in the above mentioned example.

What would be the best way to tackle such problems?


How to show that every quadratic, asymptotically nonnegative function $\in \Theta(n^2)$

In the book CLRS the authors say that every quadratic, asymptotically nonnegative function $ f(n) = an^2 + bn + c$ is an element of $ \Theta(n^2)$ . Using the following definition

\begin{align*} \Theta(n^2) = \{h(n) \,|\, \exists c_1 > 0, c_2 > 0, n_0 > 0 \,\forall n \geq n_0: 0 \leq c_1n^2 \leq h(n) \leq c_2n^2\} \end{align*}

the authors write that $ n_0 = 2*\max(|b|/a, \sqrt{|c|/a})$ .

I have difficulties proving that the value of $ n_0$ is indeed that value.

We know that $ a \ge 0$ because otherwise $ f$ would not be asymptotically nonnegative. Calculating the roots of $ f$ gives us:

\begin{align*} n_{1/2} &= \frac{-b \, \pm \, \sqrt{b^2 – 4ac} }{2a} \ &\leq \frac{|b| + \sqrt{b^2 – 4ac} }{a} \end{align*}

The case $ c \ge 0$ gives us:

\begin{align*} \frac{|b| + \sqrt{b^2 – 4ac} }{2a} \leq \frac{|b| + \sqrt{b^2} }{a} = 2\frac{|b|}{a} \end{align*}

which is two times the first argument of the $ \max$ function.

But what about the case $ c < 0$ ? How can we find an upper bound for that? Where does the value $ \sqrt{|c|/a}$ actually come from?

Fatal Error: Call to undefined function is_loaded() in… em Codeigniter (Objetivo: PayPal Payouts)

Estou com o seguinte erro:

Fatal error: Uncaught Error: Call to undefined function is_loaded() in C:\xampp\htdocs\englishup\paypal\codeigniter\system\core\Controller.php:73 Stack trace: #0 C:\xampp\htdocs\englishup\paypal_test.php(7): CI_Controller->__construct() #1 {main} thrown in C:\xampp\htdocs\englishup\paypal\codeigniter\system\core\Controller.php on line 73

Sou novato em php e estou usando a framework do Codeigniter e meu objetivo é “printar” os dados (HTTP_HEADERS) em forma de URI, ou qualquer outra coisa que eu consiga visualizar para ver se o teste em Payouts (forma de pagamento em massa do PayPal) foi executado com sucesso e está funcionando. Seguem abaixo os códigos completos, mas a pasta completa vocês podem encontrar em: ou vocês podem estar baixando por aqui, que é o código mais completo ainda:

paypal_test.php (está na pasta raiz /www)

<?php $  system_path =  "paypal/codeigniter/system"; define('BASEPATH', str_replace("\", "/", $  system_path));      //SE EU DESABILITAR ESTA LINHA APARECE A MENSAGEM DE ERRO "No direct script access allowed" include "paypal/codeigniter/system/core/Controller.php";      //SE EU DESABILITAR ESTA LINHA APARECE O ERRO "Fatal error: Class 'CI_Controller' not found in C:\xampp\htdocs\englishup\paypal\codeigniter\application\controllers\paypal\templates\Payouts.php on line 13" include "paypal/codeigniter/application/controllers/paypal/templates/Payouts.php"; $  bd = new Payouts(); $  print =  $  bd->paypal_payout(); var_dump($  print); ?> 

Payouts.php (Este é o arquivo principal onde quero que apareçam os dados do teste. Está em /www/paypal/codeigniter/application/controllers/paypal/templates/)

<?php  /** * paypal payouts example for php * if it makes things easier for you can buy me a coffee @ paypal > * * @package            PHP * @subpackage        Libraries * @category        Libraries * @author            AbdAllah Khashaba * @link   */ //include "../../../../system/core/Controller.php";    //This is the CI_Controller class class Payouts extends CI_Controller {     public function paypal_payout(){         /// PayPal Data         $  mode = "sandbox";  // change to "live" or "sandbox"         $  paypal_app = array(             "mode" => "sandbox",             "sandbox"=> array(                 "client_id"=>"AQZynIyzCG4ypt_0WXAptzkpDrKAJJ2QxqnGdvatCLV0tdy0ZfkX9RQzBUhVAMJnSVfcWTHxeuwuujGx", // change                 "secret"=>"EKaeJASyyiC67xm6D-iPk06-J0HxfzgrU1BvFGUunP4hFRdzSd72PgqiWQhDyCHJulxqZxk-26A9L_iQ",  // change                 "endpoints"=>array(                     "oauth2" => "",                     "payout" => "",                 )             ),             "live"=> array(                 "client_id"=>"xx",  // change                 "secret"=>"yy",  // change                 "endpoints"=>array(                     "oauth2" => "",                     "payout" => "",                 )             )                     );         $  client_id = $  paypal_app[$  mode]["client_id"];         $  secret = $  paypal_app[$  mode]["secret"];         $  endpoints = $  paypal_app[$  mode]["endpoints"];         ////// PayOut data                         $  PO_id = mt_rand(100000000000000,999999999999999);  //time();  change         $  PO_amount = 8.00; // change         $  batch = array(             "sender_batch_header" => array(                 "sender_batch_id" => $  PO_id,                 "email_subject" => "You have a payout!",                 "email_message" => "You have received a payout! Thanks for using our service!",             ),             "items" => array(                 0 => array(                     "recipient_type" => "EMAIL",                     "amount" => array(                         "value" => $  PO_amount,                         "currency" => "BRL",                     ),                     "note"=> "Thanks for your patronage!",                     "sender_item_id"=> "201403140001",                     "receiver"=> "",                 )             )         );         $  batch_data = json_encode($  batch);                 /// Starting OAuth          $  this->load->library("curl");                 $  endpoint = $  endpoints["oauth2"];         $  this->curl->create($  endpoint);         $  this->curl->ssl(FALSE);                 $  this->curl->post("grant_type=client_credentials");         $  this->curl->http_header("Accept","application/json");         $  this->curl->http_header("Accept-Language","en_US");         $  this->curl->http_login($  client_id,$  secret,"client_credentials");         $  returned = $  this->curl->execute();                 //$  this->curl->debug();                 unset($  this->curl);         $  result = json_decode($  returned);          ///// getting Access Token                       $  nonce = $  result->nonce;         $  access_token = $  result->access_token;         $  token_type = $  result->token_type;         $  app_id = $  result->app_id;         $  expires_in = $  result->expires_in;         ///// PayOut Processing         $  this->load->library("curl");                 $  endpoint = $  endpoints["payout"];                 $  this->curl->create($  endpoint);         $  this->curl->ssl(FALSE);                 $  this->curl->http_header("Content-Type","application/json");         $  this->curl->http_header("Authorization","Bearer $  access_token");                 $  this->curl->post($  batch_data);         $  this->curl->http_login($  client_id,$  secret,"client_credentials");         $  returned = $  this->curl->execute();                 //$  this->curl->debug();                 unset($  this->curl);         $  result = json_decode($  returned);         if($  result && $  result->batch_header->batch_status == "PENDING" ){             $  links = $  result->links;             $  link = $  links[0];             $  endpoint = $  link->href;             $  this->load->library("curl");                     $  this->curl->create($  endpoint);             $  this->curl->ssl(FALSE);                     $  this->curl->http_header("Content-Type","application/json");             $  this->curl->http_header("Authorization","Bearer $  access_token");                                 $  returned = $  this->curl->execute();                                 $  result = json_decode($  returned);         }         echo "<pre>";                 print_r($  result);         echo "</pre>";         $  index1 = $  this->index();             } } ?> 

Controller.php (está em /www/paypal/codeigniter/system/core/)

<?php /**  * CodeIgniter  *  * An open source application development framework for PHP  *  * This content is released under the MIT License (MIT)  *  * Copyright (c) 2014 - 2019, British Columbia Institute of Technology  *  * Permission is hereby granted, free of charge, to any person obtaining a copy  * of this software and associated documentation files (the "Software"), to deal  * in the Software without restriction, including without limitation the rights  * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell  * copies of the Software, and to permit persons to whom the Software is  * furnished to do so, subject to the following conditions:  *  * The above copyright notice and this permission notice shall be included in  * all copies or substantial portions of the Software.  *  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN  * THE SOFTWARE.  *  * @package CodeIgniter  * @author  EllisLab Dev Team  * @copyright   Copyright (c) 2008 - 2014, EllisLab, Inc. (  * @copyright   Copyright (c) 2014 - 2019, British Columbia Institute of Technology (  * @license MIT License  * @link  * @since   Version 1.0.0  * @filesource  */ defined('BASEPATH') OR exit('No direct script access allowed');  /**  * Application Controller Class  *  * This class object is the super class that every library in  * CodeIgniter will be assigned to.  *  * @package     CodeIgniter  * @subpackage  Libraries  * @category    Libraries  * @author      EllisLab Dev Team  * @link  */ class CI_Controller {      /**      * Reference to the CI singleton      *      * @var object      */     private static $  instance;      /**      * Class constructor      *      * @return  void      */     public function __construct()     {         self::$  instance =& $  this;          // Assign all the class objects that were instantiated by the         // bootstrap file (CodeIgniter.php) to local class variables         // so that CI can run as one big super object.         foreach (is_loaded() as $  var => $  class)    //O ERRO TÁ AQUI MEUS CAROS, LINHA 73 (is_loaded() não está definida realmente)         {             $  this->$  var =& load_class($  class);         }          $  this->load =& load_class('Loader', 'core');         $  this->load->initialize();         log_message('info', 'Controller Class Initialized');     }      // --------------------------------------------------------------------      /**      * Get the CI singleton      *      * @static      * @return  object      */     public static function &get_instance()     {         return self::$  instance;     }  } ?> 

Fiz uma busca extensiva de cabo a rabo no Google e pelo que vejo, tem muita gente se queixando dos mesmos erros por mim aqui apresentados. Bom, não sei se é pelo fato de eu ser “newbie” em PHP orientado a objetos… Mas como eliminar o erro inicialmente supracitado e fazer a coisa funcionar? Ou será porque o arquivo principal (paypal_test.php) está fora da pasta (/www/paypal/codeigniter/…)? O que vocês acham? Bom já vos disponibilizei todas as ferramentas…

Should a custom dimension for “Logged In” be a “Session” or “User” dimension?

If I define a dimension to set into GA to segment by “Guest” versus “Logged In” should that dimension be a “Session” or a “User” dimension?

More subtly, I’m interested in the transition at the point at which the user signs up, at which point we would change that dimension for that user/cookie.

From the perspective of the GA user who’s using the segments, what happens to the activity, flow, goals etc of the end-user if the dimension is changed.

It seems to me that “User” is correct – but I don’t understand what happens when the user moves into a new dimension.

What does %in% operator do in R?

What does %in% operator do in R?

For example, I have this code from stackoverflow

sp <- combn(c("sp1", "sp2", "sp3", "sp4"), 2) d <- data.frame(t(sp), "freq" = sample(0:100, 6))  x1 <- as.factor(c("sp1", "sp2")) x2 <- as.factor(c("sp3", "sp4"))  sub <- d[d$  X1 %in% x1 & d$  X2 %in% x2, ] 

If we use d$ X1 == x1 instead, I get an error, so what exactly does %in% do?

Let $X$ a set, $R$ a ring of set of $X$ and $C$ the class of subset $E$ of $X$ such that $E$ o $E^c$ $\in R$ then C is a algebra of set

Let $ X$ a set, $ R$ a ring of set of $ X$ and $ C$ the class of subset $ E$ of $ X$ such that $ E$ o $ E^c$ $ \in R$ then C is a algebra of set and $ C=a(R)$ (generated algebra of $ R$ )

My attempt:

As $ R$ is a ring we know satisfy this:

i)$ \emptyset\in R$
ii) $ A,B \in R \implies A\cup B \in R$
iii)$ A,B \in R \implies A\cap B \in R$
iv)$ A,B\in R \implies A-B\in R$

Let $ C=\{E\subset X : E\in R \text{ or } E^c\in R\}$

We need prove $ C$ is a algebra.

Note, $ C$ is an algebra if:

i)$ \emptyset\in C$
ii) $ A,B \in C \implies A\cup B \in C$
iii)$ A,B \in C \implies A\cap B \in C$
iv)$ A\in C \implies A^c\in C$

By definition of $ C$ the properties $ i),ii),iii)$ are trivial.

Let see if $ A\in C \implies A^c\in C$

Let $ A\in C\implies (A^c)^c=A\in C$ but here i’m a little stuck.

Moreover, as $ C$ is an algebra then by definicion $ C \subset a(R) $

I need see $ a(R) \subset C$ . Here i’m stuck, can someone help me?

Would this salvage the $\in|=$ exchange naive set theory?

This is a possible salvage for the failed attempt in this posting.

The salvage here is to require that every subformula $ \psi(y)$ of $ \phi$ having no parameter other than those in $ \phi$ , must satsify the antecdent of comprehension. To write this formally, it is:

Comprehension: If $ \phi$ is a formula in the first order language of set theory (i.e.;$ \sf FOL(=,∈))$ , in which the symbol $ “x”$ doesn’t occur free, and if $ \psi_1(y),..,\psi_n(y)$ are all subformulas of $ \phi$ in which $ y$ is free, and having no parameter that is not a parameter of $ \phi$ ; then: $ $ [\bigwedge_{i=1}^n \big{(}\exists y ((\psi_i(y))^=) \wedge \exists y ((\neg \psi_i(y))^=) \big{)} \to \exists x \forall y (y \in x \iff \phi)] $ $ ; is an axiom.

Axiom of Multiplicity: $ \forall x,y \ \exists z (z \neq x \land z \neq y)$


I personally think this is complex a little bit, I highly doubt its consistency though. Yet if there is a chance that this is consistent, then it would actually prove all axioms of $ \sf NF$ , since full Extensionality is assumed here.