## How to plot a set of complex numbers with given argument and absoulute value bounds

I want to plot the following complex numbers $$z \in \text{(complex numbers)}:\pi/4 < \arg (z) \leq 5 \pi/4,\ 1 \leq |z| < 2$$

I don’t know how to graph it so that it would look like 2D without any unecessary details. The closest I found how I want it to look is, when I looked at how graphing of parametric function looks. I tried to use contour plot to graph it, but I just can’t seem to do it…

ContourPlot[ Im[F[z[x, y]]], {3 pi/4 < arg (z) <= 5 pi/4, 1 <= abs (z) < 2}, {x, -.2, .2}, {y, -.2, .2}, PlotRange -> All, Contours -> Range[-5, 5, .5], ContourLabels -> True]

Does anybody know how to graph my set?

## PHP Warning: Invalid argument supplied for foreach() in /home/padtvro/public_html/wp-content/themes/claudia/content.php on line 30

I have a problem, it is generated in woprdpree in cpanel error log this error: PHP Warning: Invalid argument supplied for foreach () in /home/padtvro/public_html/wp-content/themes/claudia/content.php on line 30 If I delete it, it appears again in 6-7 hours. What’s the problem?

<section id="contents" class="clearfix"><div class="row main_content"><div class="container content_wraper"><?php the_breadcrumb(); ?><div class="grid_8" id="content"><div class="widget_container content_page"><?php require_once dirname(__FILE__) . '/include/cat.php'; ?>  </div></div><div class="grid_4 p7ehc-a" id="sidebar"> <?php $ge_sidebar = ''; if (is_search()) {$  ge_sidebar = of_get_option('se_sidebar','');                     }else if(is_category() ) {                          $category = get_the_category();$  cn_sidebar ='';                         foreach($category as$  ca_id) {                             if(empty($cn_sidebar)) {$  cn_sidebar = of_get_option('cat_'.$ca_id->term_id);} } if(empty($  cn_sidebar)) {                             $ge_sidebar = of_get_option('cat_sidebar',''); } else {$  ge_sidebar = $cn_sidebar; } } else if(is_author() ) {$  ge_sidebar = of_get_option('au_sidebar','');                      }else if(is_tag() ) {                          $tags = get_the_tags();$  cn_sidebar ='';                         foreach($tags as$  tg_id) {                             if(empty($cn_sidebar)) {$  cn_sidebar = of_get_option('tag_'.$tg_id->term_id);} } if(empty($  cn_sidebar)) {                             $ge_sidebar = of_get_option('tag_sidebar',''); } else {$  ge_sidebar = $cn_sidebar; } }$  dyn_sidebar ='';                 if(!empty($ge_sidebar)) {$  dyn_sidebar = $ge_sidebar; }; foreach ($  GLOBALS['wp_registered_sidebars'] as $sidebar ) { if($  sidebar['name'] == $dyn_sidebar) {$  dyn_sidebar = $sidebar['id']; } } if(!empty($  dyn_sidebar)) {                     if (is_active_sidebar($dyn_sidebar)) : dynamic_sidebar($  dyn_sidebar);                     endif;                   } else{                     if (is_active_sidebar('center-sidebar')) : dynamic_sidebar('center-sidebar');                     endif;                 }      ?></div><div class="clear"></div></div></div></section>  

## Help with finding a flaw in argument simulating large Turing machines with smaller ones

I have an argument which, if it goes through, just about proves that either:

• Programming languages are more powerful than Turing machines
• The busy beaver function ($$BB()$$) on Turing machines is computable

Now, I understand that it’s vastly more likely that my argument has some flaw that I can’t find. But it’s more interesting to me how I’m wrong, rather than whether I’m wrong.

# Argument

Throughout, I use $$\mathbb{S}(x)$$ to mean either the number of states that Turing machine $$x$$ has or the number of states required by a Turing machine to write $$x$$ to the tape.

Construct a Turing machine $$M_1$$ as which takes as arguments (on the tape) $$n, k$$, simulates all Turing machines with $$n$$ states until $$k$$ of them halt, and then halts itself. This is easy to write in a programming language, as demonstrated by the following Python snippet:

def M1(n, k):     all_machines = generate_turing_machines(n)     is_halted = [0] * len(generate_turing_machines)     while sum(is_halted) < k:         for (i, machine) in enumerate(all_machines):             machine.step()             if machine.is_halted():                 is_halted[i] = 1 

Now, let $$\mathbb{S}(M_1) = m_1$$ be the number of states required by $$M_1$$. Fix $$n$$ much greater than $$m_1$$. Let $$k_1$$ be the largest number such that $$M_1(n, k_1)$$ halts and $$k_0$$ be the smallest number such that when $$M_1(n, k_0)$$ halts, $$k_1$$ simulated Turing machines have halted (as all equivalent machines will halt on the same step). Choose $$k$$ with $$k_0\leq k\leq k_1$$. This means that $$M_1(n,k)$$ halts in about $$BB(n)$$ steps.

Construct $$M_2$$ which is the same as $$M_1$$ except the first thing it does is write $$n$$ and $$k$$ to the tape. Let $$\mathbb{S}(M_2)=m_2$$. Then $$m_1+\mathbb{S}(n)+\mathbb{S}(k)+C=m_2$$ for some small $$C$$ (which is probably constant and likely $$0$$).

Now, $$\mathbb{S}(n)$$ is at most $$O(log(n))$$. $$k$$ is about $$n^n$$, so $$\mathbb{S}(k)$$ is at most $$O(n)$$. That puts $$m_2$$ just slightly larger than $$n$$. But here we have a problem: if $$k$$ is even slightly easier to write to the tape, then $$m_2$$ would be slightly smaller than $$n$$. That would mean $$BB(m_2)>BB(n)$$ and $$m_2, a clear contradiction.

In my mind, these are the possible resolutions:

• $$M_1$$ is impossible to create as a Turing machine, meaning that Python is more powerful than Turing machines are.
• There is some transfinite extension to Turing machines which is not much more powerful than Turing machines in general, and $$M_1$$ can be written in this extension. In other words, $$M_1$$ is the limit of a set of machines $$M_{1,N}$$, each of which can handle any $$n. This would probably entail the busy beaver function being computable.
• There is a large set of numbers which cannot be written by a Turing machine in much fewer than $$log(k)=n$$ states (we need $$\mathbb{S}(k)). It seems impossible to me that no candidate for $$(n, k)$$ could be sufficiently compressed.

Where is the error in this logic?

## Argument in proving that function is not polynomial time in bit length of input seems faulty

I am currently solving a question that asks which of the following functions can be calculated in polynomial time:

$$n!, \binom{n}{5}, \binom{2n}{n}, n^{\lfloor \lg n \rfloor}, \lfloor \sqrt{n} \rfloor, \text{the smallest prime factor of } n, \text{the number of prime factors less than }n.$$

In proving the first one, I thought $$n! \geq n$$ and the input size is $$\log_2 n$$ so the output cannot even be written in polynomial time. So then clearly the calculation cannot be done in polynomial time.

But then I thought I must have some misunderstanding, since by that logic even just calculating $$n$$ from the input (that is, the identity function) should not be polynomial time. But that’s clearly not possible.

What is the problem in my thinking, and instead how should I be thinking about these?

## How to Quiet[] only the first argument of Check[]?

I have a Check of the form

Check[expr,failexpr, {NIntegrate::slwcon}] 

I would like to redo the calculation with higher precision if I get the NIntegrate error, but if there is still a problem even with higher precision (while evaluating failexpr), I would like the error message to show. I do not want the error message which was already handled (while evaluating expr) to show.

There seems to be no solution to this using just Quiet[]:

If I try Quiet[expr, {NIntegrate::slocon}] the check never activates and it never evaluates failexpr.

But if I put Quiet around the whole Check, then if the failexpr still fails, I get no error message so I never know about it.

This seems like an option which would be very natural to add to check. But it’s just not there. Is there a simple solution?

## Passing a non-mutable argument by value or by reference?

A function can generally be defined to receive parameters by value or by reference. If we want to mutate an object inside the function and have those changes reflected outside the function, then it must be passed by reference.

If we don’t want to mutate the object then we can choose between passing by value or by reference. The choice, in my experience, is based on whether or not it’s expensive to copy the object. If it’s cheaper to copy than to deal with the reference’s indirection – pass by value, else – pass by reference.

1) Are there any other considerations that should be taken into account?

2) Wouldn’t a compiler be better suited to make this choice instead of the programmer? Why, or why not?

To illustrate question 2, the programmer could simply indicate whether they intend to mutate an argument or not. If an argument will be mutated then it must be passed by reference. If it won’t be mutated, then the compiler can choose between passing by value or by reference – whichever is faster.

3) Do you see any pitfalls in this approach to language/compiler design?

## Invalid Argument foreach

Is this because of WordPress, PHP, or the Theme? (or some combination)

A client of mine has a WordPress site that’s been working just fine for years, but recently started getting the following errors pulling up in it’s sidebars:

Warning: Invalid argument supplied for foreach() in /wp-content/themes/epsilon/page-threecolumn.php on line 29

Been thinking it may have to do with upgrades to both WordPress and PHP. Theme is no longer supported. Here is what the code looks like in that area:

                <div class="col-234">                     <div class="sidebar left-sidebar">                             <?php                             $leftsidebar = simple_fields_get_post_group_values($  post->ID, "Left Sidebar", false, 2);                             foreach ($leftsidebar as$  value) {                              ?>                             <aside>                                 <h2> <?php echo $value[1]; ?></h2> <div> <?php if($  value[2]):                                         if (function_exists('cforms_insert')){                                              echo cforms_insert(do_shortcode($value[2])); } else { echo do_shortcode($  value[2]);                                          }                                      endif;                                 ?>                                 </div>                             </aside>                             <?php } ?>                     </div>                 </div> 

I did not build the site. And while I am proficient in pure HTML, I know little about PHP. Is this just a syntax issue that can be resolved with some quick fixes? Or do I need to go out and install a completely new theme (which scares the heck out of me)?

## Recursive Call Inside Argument List (C++)

So, my professor asked me to implement recursion in different ways to compute $$a^n$$ (a and n being integers) and rank them according to their space efficiency. Now, here is one of the methods I came up with:

  int Power (int a, int n)  { if ( n == 0 )   return 1;    if ( n % 2 == 0)   return Power(Power(a, n/2), 2);    else return Power(Power(a, n/2), 2)*a;   } 

The code compiles well, but leads to a segmentation fault. On debugging, I came to the conclusion that recursive call within the argument list is not acceptable. That is, something like

  return Power(Power(a, n/2), 2) 

or

  int m = Power(a, n/2);   return Power(m, 2); 

is not allowed but

  int m = Power(a, n/2);   return m*m; 

is allowed. Why is this the case? Is this true only in C++, or is it a general phenomenon?

## Understanding why NIntegrate requires explicit substitution of variables in argument

The problem that leads me here begins with a quantity I have previously defined, let’s call it test, that has many other quantities in its definition. When evaluated, test is an expression that includes two variables, let’s call them k and x. A MWE would be

test = kx; 

I wish to create a function of k that includes a NIntegration of test over x with limits that involve k. An example would be

testint[k_] := NIntegrate[test, {x, k, 2k}]; 

Evaluating this for some k , say k = .1, returns an error:

>>testint[.1]  NIntegrate::inumr: The integrand k x has evaluated to non-numerical values for all sampling points in the region with boundaries {{0.1,0.2}}.  NIntegrate[k x, {x, 0.1, 0.2}] 

However, if I define testint using a temporary variable and perform a replacement in the argument of NIntegrate , then it computes fine:

>>testint[k1_] := NIntegrate[test/.k->k1, {x, k1, 2k1}]; >>testint[.1] 0.0015 

I found this answer, which led me to try the explicit substitution: Replace variable with value prior to evaluating NIntegrate
Another answer addresses the order of NIntegrate with the help of the ?NumericQ pattern check: How do I prevent NIntegrate::inumr errors within other functions?

My question is Why does NIntegrate require this explicit substitution in order to compute?

As a test, I even tried removing NIntegrates HoldAll attribute thinking that would force the evaluation of test before the integration. It did, but not soon enough to help.

>>test = k x; >>ClearAttributes[NIntegrate, HoldAll] >>testint[k_] := NIntegrate[testin, {x, k, 2 k}]; >>testint[.1]//Trace  NIntegrate::inumr: The integrand k x has evaluated to non-numerical values for all sampling points in the region with boundaries {{0.1,0.2}}.  {testint[0.1], NIntegrate[test, {x, 0.1, 2 0.1}], {test, k x}, {{2 0.1, 0.2}, {x, 0.1, 0.2}}, NIntegrate[k x, {x, 0.1, 0.2}], {{x} =., {x =.}, {x =., Null}, {Null}}, {x =., Null}, ...