text:
# Hipster Dynamics ¶

This notebook originally appeared as a post on the blog Pythonic Perambulations . The content is BSD licensed. It has been adapted to use HoloViews by Philipp Rudiger .

This week I started seeing references all over the internet to this paper : The Hipster Effect: When Anticonformists All Look The Same . It essentially describes a simple mathematical model which models conformity and non-conformity among a mutually interacting population, and finds some interesting results: namely, conformity among a population of self-conscious non-conformists is similar to a phase transition in a time-delayed thermodynamic system . In other words, with enough hipsters around responding to delayed fashion trends, a plethora of facial hair and fixed gear bikes is a natural result.

Also naturally, upon reading the paper I wanted to try to reproduce the work. The paper solves the problem analytically for a continuous system and shows the precise values of certain phase transitions within the long-term limit of the postulated system. Though such theoretical derivations are useful, I often find it more intuitive to simulate systems like this in a more approximate manner to gain hands-on understanding.

## Mathematically Modeling Hipsters ¶

We'll start by defining the problem, and going through the notation suggested in the paper. We'll consider a group of $N$ people, and define the following quantities:

• $\epsilon_i$ : this value is either $+1$ or $-1$. $+1$ means person $i$ is a hipster, while $-1$ means they're a conformist.
• $s_i(t)$ : this is also either $+1$ or $-1$. This indicates person $i$'s choice of style at time $t$. For example, $+1$ might indicated a bushy beard, while $-1$ indicates clean-shaven.
• $J_{ij}$ : The influence matrix. This is a value greater than zero which indicates how much person $j$ influences person $i$.
• $\tau_{ij}$ : The delay matrix. This is an integer telling us the length of delay for the style of person $j$ to affect the style of person $i$.

The idea of the model is this: on any given day, person $i$ looks at the world around him or her, and sees some previous day's version of everyone else. This information is $s_j(t - \tau_{ij})$.

The amount that person $j$ influences person $i$ is given by the influence matrix, $J_{ij}$, and after putting all the information together, we see that person $i$'s mean impression of the world's style is

$$m_i(t) = \frac{1}{N} \sum_j J_{ij} \cdot s_j(t - \tau_{ij})$$

Given the problem setup, we can quickly check whether this impression matches their own current style:

• if $m_i(t) \cdot s_i(t) > 0$, then person $i$ matches those around them
• if $m_i(t) \cdot s_i(t) A hipster who notices that their style matches that of the world around them will risk giving up all their hipster cred if they don't change quickly; a conformist will have the opposite reaction. Because$\epsilon_i$=$+1$for a hipster and$-1$for a conformist, we can encode this observation in a single value which tells us what which way the person will lean that day: $$x_i(t) = -\epsilon_i m_i(t) s_i(t)$$ Simple! If$x_i(t) > 0$, then person$i$will more likely switch their style that day, and if$x_i(t)

But the world is a noisy place. Each person might have other things going on that day, so instead of using this value directly, we can turn it in to a probabilistic statement. Consider the function

$$\phi(x;\beta) = \frac{1 + \tanh(\beta \cdot x)}{2}$$

We can plot this function quickly:

In [1]:
import numpy as np
import holoviews as hv
hv.extension('bokeh', 'matplotlib', width=90)


text:
# Confusion regarding gravity not being a force

In high school, it was taught that formula for describing circular orbital velocity around a central body is derived by equating Newton's law of gravity with the centripetal force formula (under the logic that the inwards centeipetal force required is provided by the gravitational "force").

It was only recently that I discovered that gravity isn't actually a force but is actually a distortion of space time. (I came across this while wondering why light bends around large masses). Does the fact that gravity is not a force make the above derivation of orbital velocity any less valid? Because the above derivation assumes that gravity is a force.

• Related: physics.stackexchange.com/questions/33875/…. I would like to point out the comment by Lubos Motl on the linked question. Sep 14 '17 at 16:22
• Sep 15 '17 at 11:18

You cannot longer use Newton's formalism $F = m a = -GMm/r^2$ if you introduce the fact that the geometry of space time is changed by the presence of the central body $M$.

It is true that the test mass $m$ still moves around $M$ because of gravity, but you should think of gravity not as a force any more, but as an emergent property of the curvature of space-time. Fortunately there's a whole body of mathematical tools that allow you solve this problem in particular.

Actually, it is one the most well known problems you can analytically solved using general relativity: the two body problem

• Thank you for the link to the two body problem, this has confirmed to me that the reasoning (equating centeipetal and gravitational force formula) as I described in my question is flawed. I'll upvote and tick this answer
– user166520
Sep 14 '17 at 14:38

## TL:DR

Newton's law of gravity (used to describe velocity, and not force) is not wrong, it is just imprecise and has a limited scope for which it is accurate (I would not equate less widely applicable with less valid).

No, the fact that gravity is not a force, as Newton described it, does not mean that his calculations for describing circular orbital velocity are incorrect. Given that his formulae were derived based upon measurements of the same world as Einstein's formulae were, they are both designed to (and do a good job) describe the motion of large masses under the influence of gravity.

Newton's laws are, as you would expect given the time difference between Newton and Einstein, less precise than Einstein's, and they fail under particular circumstances, but overall, they do a pretty good job at describing a large chunk of gravitational effects at the precision that is necessary for a vast majority of application.

gravity isn't actually a force but is actually a distortion of space time.

Some basics at the beginning. If you are sitting in a rotating carousel did you feel a centrifugal force? And could you imagine that an astronaut does not feel such a force despite his revolution around the earth?

So what is the difference between these two circular motions? Under the influence of masses any body (as well as light) follows a geodesic paths.

Some excursus: The curvature of this paths depends - for small masses in relation to the earth or other massiv bodies - only from the velocity with which the body moves. Since light moves in vacuum exclusively with the velocity c the local curvature of the space can be described unambiguitly on the basis of the speed of light. Than less the velocity of a body than more it's path is curved near a massive body. The straightest possible path one achieve with light.

Independent from the velocity with which you moves in space and even in the presence of massive bodies which makes your path a curve you don't feel any force. That is one reason why gravitation is not a force.

Does the fact that gravity is not a force make the above derivation of orbital velocity (Newton's law of gravity with the centripetal force formula) any less valid?

Considering the above said the equation $F = m a = -GMm/r^2$ is still the right equation

• for bodies with slow motion and
• of tiny mass in relation to the central body.

It is true that (true) gravity arises out of the curvature of spacetime but that doesn't mean that the gravitational effect is not a force. All the aspects that are expected of a force are certainly possessed by gravitational effects. Sure, it is special in the sense that charge that causes gravitation is the same as the inertial mass, but that doesn't make the effects of the gravitation on a particle disappear. It just makes us realize what is the cause of this effect called the gravitational effect. Understanding the mechanism or reason behind the existence of the gravitational effect doesn't make it less of a force.

Understanding the mechanism of how the gravitational effect arises makes us realize that the gravitational effect is not generically described by Newtonian laws of gravity but Newtonian laws are true only in some limit (low speeds, low mass-energy-momentum density) of the generically true theory of gravity - Einstein's Theory of General Relativity. Thus, the calculations done using Newtonian gravity to make predictions about satellites going around the Earth are pretty much safe as long as the velocities of these satellites are small enough. But for some involved calculations (e.g. those of the synchronization of the GPS satellites), one inevitably needs to use Einstein's Theory of General Relativity.

• You invest your time and effort to give a better answer, but it doesn't get picked, because "correct" answers are picked by those who ask questions and therefore don't know what the answer is, much less what the correct answer is. So you don't get any up-votes and if you dare to get creative, you are down-voted without a comment. Gotta love this forum! Sep 15 '17 at 8:04

format: plain


text:
# Posts tagged as “island”

You are given two m x n binary matrices grid1 and grid2 containing only 0‘s (representing water) and 1‘s (representing land). An island is a group of 1‘s connected 4-directionally (horizontal or vertical). Any cells outside of the grid are considered water cells.

An island in grid2 is considered a sub-island if there is an island in grid1 that contains all the cells that make up this island in grid2.

Return the number of islands in grid2 that are considered sub-islands.

Example 1:

Input: grid1 = [[1,1,1,0,0],[0,1,1,1,1],[0,0,0,0,0],[1,0,0,0,0],[1,1,0,1,1]], grid2 = [[1,1,1,0,0],[0,0,1,1,1],[0,1,0,0,0],[1,0,1,1,0],[0,1,0,1,0]]
Output: 3
Explanation: In the picture above, the grid on the left is grid1 and the grid on the right is grid2.
The 1s colored red in grid2 are those considered to be part of a sub-island. There are three sub-islands.

Example 2:

Input: grid1 = [[1,0,1,0,1],[1,1,1,1,1],[0,0,0,0,0],[1,1,1,1,1],[1,0,1,0,1]], grid2 = [[0,0,0,0,0],[1,1,1,1,1],[0,1,0,1,0],[0,1,0,1,0],[1,0,0,0,1]]
Output: 2
Explanation: In the picture above, the grid on the left is grid1 and the grid on the right is grid2.
The 1s colored red in grid2 are those considered to be part of a sub-island. There are two sub-islands.

Constraints:

• m == grid1.length == grid2.length
• n == grid1[i].length == grid2[i].length
• 1 <= m, n <= 500
• grid1[i][j] and grid2[i][j] are either 0 or 1.

## Solution: Coloring

Give each island in grid1 a different color. Whiling using the same method to find island and coloring it in grid2, we also check whether the same cell in grid1 always has the same color.

Time complexity: O(mn)
Space complexity: O(1) modify in place or O(mn)

## C++

Given a 2D grid consists of 0s (land) and 1s (water).  An island is a maximal 4-directionally connected group of 0s and a closed island is an island totally (all left, top, right, bottom) surrounded by 1s.

Return the number of closed islands.

Example 1:

Input: grid = [[1,1,1,1,1,1,1,0],[1,0,0,0,0,1,1,0],[1,0,1,0,1,1,1,0],[1,0,0,0,0,1,0,1],[1,1,1,1,1,1,1,0]]
Output: 2
Explanation:
Islands in gray are closed because they are completely surrounded by water (group of 1s).

Example 2:

Input: grid = [[0,0,1,0,0],[0,1,0,1,0],[0,1,1,1,0]]
Output: 1

Example 3:

Input: grid = [[1,1,1,1,1,1,1],
[1,0,0,0,0,0,1],
[1,0,1,1,1,0,1],
[1,0,1,0,1,0,1],
[1,0,1,1,1,0,1],
[1,0,0,0,0,0,1],
[1,1,1,1,1,1,1]]
Output: 2

Constraints:

• 1 <= grid.length, grid[0].length <= 100
• 0 <= grid[i][j] <=1

## Solution: DFS/Backtracking

For each connected component, if it can reach the boundary then it’s not a closed island.

Time complexity: O(n*m)
Space complexity: O(n*m)

# Problem

On a 2D plane, we place stones at some integer coordinate points.  Each coordinate point may have at most one stone.

Now, a move consists of removing a stone that shares a column or row with another stone on the grid.

What is the largest possible number of moves we can make?

Example 1:

Input: stones = [[0,0],[0,1],[1,0],[1,2],[2,1],[2,2]]
Output: 5

Example 2:

Input: stones = [[0,0],[0,2],[1,1],[2,0],[2,2]]
Output: 3

Example 3:

Input: stones = [[0,0]]
Output: 0

Note:

1. 1 <= stones.length <= 1000
2. 0 <= stones[i][j] < 10000

# Solution 2: Union Find

Find all connected components (islands)

Ans = # of stones – # of islands

# Related Problems

Problem:

Given a 2d grid map of '1's (land) and '0's (water), count the number of islands. An island is surrounded by water and is formed by connecting adjacent lands horizontally or vertically. You may assume all four edges of the grid are all surrounded by water.

Example 1:

Example 2:

# Idea: DFS

Use DFS to find a connected component (an island) and mark all the nodes to 0.

Time complexity: O(mn)

Space complexity: O(mn)


text:
### Computer Networking?

What is computer networking? First of all let me give you an easiest example of a network before telling you about the computer network. When two or more people are connected (can talk any time,share information) to each other makes a network. Therefore computer network is,  when two or more computers are connected to each other makes a computer network …

Go top


text:
## 题目要求

Given a stack which can keep M numbers at most. Push N numbers in the order of 1, 2, 3, ..., N and pop randomly. You are supposed to tell if a given sequence of numbers is a possible pop sequence of the stack. For example, if M is 5 and N is 7, we can obtain 1, 2, 3, 4, 5, 6, 7 from the stack, but not 3, 2, 1, 7, 5, 6, 4.

#### Input Specification:

Each input file contains one test case. For each case, the first line contains 3 numbers (all no more than 1000): M (the maximum capacity of the stack), N (the length of push sequence), and K (the number of pop sequences to be checked). Then K lines follow, each contains a pop sequence of N numbers. All the numbers in a line are separated by a space.

#### Output Specification:

For each pop sequence, print in one line "YES" if it is indeed a possible pop sequence of the stack, or "NO" if not.

#### Sample Input:

5 7 5
1 2 3 4 5 6 7
3 2 1 7 5 6 4
7 6 5 4 3 2 1
5 6 4 3 7 2 1
1 7 6 5 4 3 2

#### Sample Output:

YES
NO
NO
YES
NO

## 解题思路

1. 如果要输出的元素正好是当前栈顶的元素，则栈顶出栈
2. 如果要输出的元素大于等于cur，则将[cur, 要输出元素]这一区间内的元素全部入栈，然后出栈一次。出栈前判断栈是否溢出，如果溢出，则直接输出NO
3. 如果要输出的元素小于cur，并且栈顶不是该元素（出栈得到的不是目的元素），则直接输出NO

## 代码

#include <cstdio>
#include <cstdlib>
#include <stack>

using namespace std;

int main()
{
int num;
int m, n, k;
scanf("%d%d%d", &m, &n, &k);
bool ok = true;
for (int i = 0; i < k; i++)
{
stack<int> s;
int cur = 1;
ok = true;
for (int j = 0; j < n; j++)
{
scanf("%d", &num);
if (!ok)
{
continue;
}
if (!s.empty() && num == s.top())
{
s.pop();
}
else if (num < cur && num != s.top())
{
printf("NO\n");
ok = false;
}
else
{
while (cur <= num)
{
s.push(cur);
cur++;
}
if (s.size() > m)
{
printf("NO\n");
ok = false;
}
s.pop();
}
}
if (ok)
{
printf("YES\n");
}
}

system("pause");
return 0;
}


text:
# Reset counter \section in \part*

I'm a rookie with LaTeX, I'm using LyX, but I think this is a LaTeX problem.

Im using this LaTeX preamble for reset counter after parts

\usepackage{chngcntr}
\counterwithin*{section}{part}

But it only works with \part and no with \part*... I need to have no-numbered parts. What can I do? I don't find anything on the net and my attempts don't work (counterwith, part*...).

• Welcome to TeX.SX! You can have a look at our starter guide to familiarize yourself further with our format. – Reinstate Monica - M. Schröder Oct 4 '15 at 15:17
• you're right, since \part* doesn't step the part counter. we need more informations about class used. – touhami Oct 4 '15 at 15:19
• Here's some questions which address similar issues, numbering one counter within starred and unstarred versions of another: 1 2 3 – Arun Debray Oct 4 '15 at 15:21
• Do you always use unnumbered parts? – Werner Oct 4 '15 at 15:26
• Thanks all, but Christian answer works like a charm :D. – analca3 Oct 4 '15 at 15:34

## 1 Answer

This works for article.cls \parts since there are no \chapters which must be reset too. It's regardless whether \part or \part* is used, the \setcounter{section}{0} just before \part does no harm and is done automatically here.

\documentclass{article}

%\usepackage{chngcntr}
%\counterwithin*{section}{part}

\usepackage{xpatch}

\xpretocmd{\part}{\setcounter{section}{0}}{}{}

\begin{document}

\part*{A part}

\section{A section in part}
\section{Another section in part}

\part*{Another part}

\section{A section in another part}

\section{Another section in another part}

\end{document}

• @analca3: It works even without LyX (;-) – user31729 Oct 4 '15 at 15:36
• \setcounter{section}{-1}\stepcounter{section} is better – touhami Oct 4 '15 at 15:36
• @touhami: Why? I don't suppose that somebody will need a \label to the section just before \part starts. – user31729 Oct 4 '15 at 15:40
• just in case some one start the part with subsection this help to reset all counters. (by the way for crossreference one need \refstepcounter, but you know that) – touhami Oct 4 '15 at 15:43
• @touhami: Yes, \refstepcounter -- I was confused for a moment. But since the format updates the underlying counters (subsection) are reset even with setcounter. – user31729 Oct 4 '15 at 15:48


text:
Ever dropped a comment on a site and wished you could go back and fix that typo, or maybe the next morning you regret the use of the 'bollocks', either way what you want is editable comments, which Bulu, the software that runs this site, now supports.

Here's the basic description of how it work. Once you post a comment, that comment gets a unique ID. I take that ID and concatenate it with a secret string secret that only I know, then get an MD5 hash of the string ID+secret. The cgi script that accepts your initial comment returns to you a URL that's of the form:

http://bitworking.org/news/comments/1-3/e0fd9772343dde302f7d709a45856fa8b

Where '1-3' is the ID of the comment and 'e0fd9772343dde302f7d709a45856fa8b' is the md5 hash. When you visit that URL Bulu gets an md5 hash of the ID+secret, and if that calculated md5 matches the one in the URL then you are allowed to edit the comment. Now you can bookmark this URL, and use this URL to edit the comment, and as long as you keep the URL a secret, no one else can edit your comment.

It's actually pretty simple once you give up on the idea of registration. You see, registration is really asking for more information than is necessary. All I want to know is that if you try to edit a comment, you were the person that created that comment to begin with. With registration, the server knows all the comments you have ever left.

How secure is it? Well, the URL is travelling over the web in plaintext, and all you need is the URL to edit any comment, so I wouldn't use this to secure the commenting system on anything real important. However, this is just a weblog, so I believe that the level of security provided is appropriate for the context.

Once I have this tested for a few more days I will make another release of Bulu.

IMHO, there's a better way... Have you every thought about how SSH works? You have a public key that you distribute and a private key that you retain... Suppose you could sign every post. And your public key could be in a foaf profile so that it could be verified. You would never need to register. You would not need to retain comment identifiers. You could modify your own comments from any machine where you had access to your key.

Posted by Sam Ruby on 2003-05-11

do you show the edit history? As a reader, that reassures me.

Posted by Anita Rowland on 2003-05-11

Sam, I don't think there is anything that precludes both types of systems from being deployed. From the pragmatic sense, I was looking for a low pain solution. 'Registering' with a site is at a much lower pain threshhold than deploying a FOAF file and managing a pair of keys. If you have a proposal, I will implement it. Phil, I am being real conserative for now on what is on the edit page, for security reason. If I had a 'preview' then you could click on that link and end up dropping your 'secret' URL into someone elses referrer logs. Anita, right now I do not keep the edit history, though it sounds like a good enhancement to the system.

Posted by Joe on 2003-05-11


text:
### The batting average for 40 innings of a cricket player is 50 runs. His highest score exceeds his lowest score by 172 runs. If these two innings are excluded, the average of the remaining 38 innings is 48 runs. The highest score of the player is –

A. 165 B. 170 C. 172 D. 174 Answer: Option D
Show Answer

### Solution(By Apex Team)

$\begin{array}{l}\text{Max – Min = 172…..(i)}\\ \text{Max + Min = 50 × 40 – 48 × 38}\\ \text{Max + Min = 2000 – 1824}\\ \text{Max + Min = 176…..(ii)}\\ \text{From equation (i) and (ii)}\\ \text{Max = 174}\end{array}$

[oceanwp_library id=”3669″]


text:
# Closure properties of linear context-free languages

Under what operations are linear context-free languages closed? Suppose $L_1, L_2$ are two linear context free languages. Are there any guarantees about $L_1 \cup L_2$, $L_1 \cap L_2$, $\overline{L_1}$, $L_1 . L_2$, etc.?

For our readers. Linear grammars are close to regular grammars, a single nonterminal at the time, but they may generate letters at both sides $A \to aBb$ with $A,B$ nonterminal, and $a,b$ terminal (or empty). $REG \subset LIN \subset CF$, strict. Some closure proofs may benefit from another way to define linear languages: as single turn pushdown languages.

Linear languages are closed under union, construction as for context-free grammars $S\to S_1, S\to S_2$. Likewise they are closed under intersection with regular languages.

They are not closed under intersection: $\{ a^n b^n c^m \mid m,n \ge 0 \} \cap \{ a^n b^m c^m \mid m,n \ge 0 \}$.

Hence they cannot be closed under complement, but I would be nice to have a concrete example.

Neither are they closed under concatenation, intuitively because $S\to S_1S_2$ is not a linear structure. Same for Kleene star.

Linear languages have a pumping property which is similar to that of the context-free languages, except that the composition $z = uvwxy$ may additionally be required to have $|uvxy|\le m$, where $m$ is the pumping constant. This is similar to the requirement for regular languages, where pumping may be assumed to be at the beginning. Linear languages also have a linear structure (like finite state computations) but the symbols that are generated first are at both ends of the string. WIth this property it can be easily shown that $K =\{a^nb^n \mid n\ge 1\}^2$ is not linear.

Both regular and context-free are closed under rotation, but linear languages are not: $K$ is the rotation of linear $\{ b^m a^n b^n a^m \mid m,n\ge 1 \}$ (and a suitable regular intersection).

Regular languages are closed under quotient, but linear (and context-free) languages are not. In fact the operation is very powerful: the RE languages are quotients of two linear languages.

On the other hand, they are closed under quotient with regular languages. That follows as they form a full trio (i.e., they are closed under homomorphisms, and inverse morphisms and intersection with regular languages). Consequently/equivalently they are closed under finite state transductions.

Of course, they are closed under reversal.

• I am unable to bring about connection between deterministic context free grammar and linear context free grammar, which one is subset of which? – Maha Jan 21 '16 at 12:44
• @Mahesha999 The families are incomparable: neither is included in the other. – Hendrik Jan Jan 21 '16 at 15:25


text:
Google Appengine environment variables stored in Cloud Datastore (and/or system environment variables)

# gae_env

Console-visible environment variables for Google Appengine projects

## Overview

By default, GAE environment variables may be configured in the app.yaml file or uploaded via a secrets.json.

But, for sensitive data, you should not store it in source code as it will be checked into source control. Even if you dont, the wrong people (inside your organization) may find it there.

Also, your development environment probably uses different config values from your production environment. If these values are stored in code, you will have to run different code in development and production, which is not just messy but also bad practice.

gae_env reads environment variables from Cloud Datastore (and/or system environment variables). This way, it becomes more convenient to edit variables in the Developer's Console

## Usage

# coding: utf-8
import gae_env
from gae_env import ValueNotSetError, NOT_SET_VALUE

key_foo = 'foo'

# get the value stored at key 'key_foo'
value_bar = gae_env.get(key_foo)

# By default, values are of type str

# get value as int
value_bar = gae_env.get(key_foo, converter_class=int)

# get value as float
value_bar = gae_env.get(key_foo, converter_class=float)

# ******************************************************************************
# If there is a value for a key in the system environment variables or datastore,
# it will be returned.
# Else, a place holder record will be created and ValueNotSetError exception will be raised.
# The exception will remind you to go to the Developers Console
# and update the placeholder record.
# ******************************************************************************

# The default error raising behaviour can be turned off with a param
# get value without raising any ValueNotSetError
value_bar = gae_env.get(key_foo, raise_value_not_set_error=False)

# If no value has been set for a key and raise_value_not_set_error=False,
# it will return NOT_SET_VALUE.
# To return None instead, pass return_none_for_not_set_value=True
value_bar = gae_env.get(
key_foo, raise_value_not_set_error=False, return_none_for_not_set_value=True
)

# There's a convenience method for setting the value of a key at runtime
# NB: This sets the value in Cloud Datastore (not system environment variables)
value_bar = 'bar'
gae_env.set_value(name=key_foo, value=value_bar)

How to set Datastore values in the App Engine console:

1. Go to the console.

2. Select your project at the top of the page if it's not already selected.

3. In the Kind dropdown box, select GaeEnvSettings.

4. Your keys will show up. For those where an exception was raised, they will all have the value __NOT_SET__. Click each one and set its value.

What if I am in development?

• Using the local admin server. This is usually started on the url http://localhost:8000

1. In the admin server page, go to the Datastore Viewer
2. In the EntityKind dropdown box, select GaeEnvSettings.
3. Your keys will show up. For those where an exception was raised, they will all have the value __NOT_SET__. Click each one and set its value.
• Alternatively, you can pass environment variables as arguments to dev_appserver.py.

• The argument --env_var=... can be used to specify the environment variables to use when running the local development server. Each env_var argument is in the format of key=value, and you can define multiple envrionment variables. For example: --env_var=KEY_1=val1 --env_var=KEY_2=val2

## Dependencies

gae_env uses the ndb library which uses MemCache and Cloud Datastore under the hood, so it's fast.

But this also means it requires the context of a Google Appengine runtime in order to work, and can be used in Google Appengine projects only

## Testing

This project uses nose, nosegae and coverage for testing.

You must have these installed:

pip install -r test_requirements.txt

In addition, you must have gcloud sdk installed, with google appengine enabled.

Run:

export GAE_LIB_ROOT=/path/to/local/google-cloud-sdk/platform/google_appengine/
python setup.py nosetests --gae-lib-root=\$GAE_LIB_ROOT

## Contributing

1. Fork it (https://github.com/Odame/gae-env/fork)
2. Create your feature branch (git checkout -b feature/fooBar)
3. Commit your changes (git commit -am 'Add some fooBar')
4. Push to the branch (git push origin feature/fooBar)
5. Create a new Pull Request

## Project details

Uploaded source


text:
# Re: [tlaplus] Division in action expression

On 05.10.2018 14:58, Nipun sehrawat wrote:
> Hello,
>
> I am learning TLA+ and trying to write a spec for the weight-throwing
> algorithm described in: https://ieeexplore.ieee.org/document/37933.
>
> I wrote this simple spec for checking if TLC allows division in an
> action expression:
>
> ----------------------------- MODULE WeightThrowing
> ----------------------------
>
> EXTENDS Reals
>
> VARIABLES count
> VARIABLES num
>
> Init == /\ num = 1
>         /\ count = 0
>
> Next == /\ num' = num / 2
>         /\ count' = count + 1
>
> ================================================================================
>
> As expected, TLC didn't like this spec (perhaps because TLC doesn't
> support arbitrary precision arithmetic?). Here is the error I get:
>
> TLC threw an unexpected exception.
> This was probably caused by an error in the spec or model.
> See the User Output or TLC Console for clues to what happened.
> The exception was a java.lang.RuntimeException
> : Attempted to compute the value of an expression of
> form CHOOSE x \in S: P, but S was not enumerable.
> line 16, col 10 to line 16, col 38 of module Reals
> The error occurred when TLC was evaluating the nested
> expressions at the following positions:
> 0. Line 11, column 9 to line 12, column 29 in WeightThrowing
> 1. Line 11, column 12 to line 11, column 25 in WeightThrowing
> 2. Line 11, column 19 to line 11, column 25 in WeightThrowing
> 3. Line 16, column 10 to line 16, column 38 in Reals
>
> Any suggestions around how to express a weight throwing algorithm in
> TLA+?  I basically want the ability to split a weight, W, into two
> parts, W1 and W2, such that W1+W2=W.  The splitting will happen multiple
> times as the system state evolves.  Additionally, the initial value of W
> should be 1.
>
> Thank you,
> Nipun
Hi Nipun,

since you want to learn TLA+, the pragmatic approach is to move on and
select an algorithm that does not require Reals. For termination
detection, you could look at EWD840 for which there exist a TLA+
specification [1] to even compare your spec with.

If you want to stick to this particular algorithm, you can obviously
model floating point arithmetic for arbitrary exponent and mantissa
sizes explicitly and model check it for small numbers of bits. This is
likely beyond what you are interested in.

Lastly, you can use a module override [2] to hack division into TLC.
This concept is not well suited for beginners.

Thanks
Markus

[1]
https://github.com/tlaplus/Examples/blob/master/specifications/ewd840/EWD840.tla


text:
# Which Microcontroller for a begginer with my needs?

#### takao21203

Joined Apr 28, 2012
3,682
Get some 16F5x chips. The datasheet is only 50 pages, no pheripherals at all. You can use better chips later.

Or start directly with 18F, 24F, PIC32.

Depends what you want to do with the controllers.

#### tshuck

Joined Oct 18, 2012
3,527
If the OP wants to be able to use interrupts, then the 16F5X family is out the window.

If you really want to learn about microprocessors, then you should start here. Microcontrollers are much easier to learn then a microprocessor is off the bat.

If all you want is to learn about the controller and how to control it, here is a link that gives you a nice little dev board. If you want to learn about how to connect it also, you should just get a breadboard and some wire, and wire it up yourself.

*Note: you'll need a programmer like the Pickit 2, or Pickit 3...

#### takao21203

Joined Apr 28, 2012
3,682
The 16f1503 (linear memory), 18F14k50 (USB), and 18f24j10 (Large 16K FLASH) are all good recommendations for entry level.

It is possible simply to use blank chips, mount them on a $1 proto PCB, and add 2xAA battery holder as well. All of these have internal oscillator, so you don't neccessarily need a crystal. I never had crystal related problems, however. These are also low-voltage chips, so you don't even need to switch on the PIC programmer power supply. Normally you'd also add a battery switch. OP could get some starter components from eBay: switches, LEDs, pushbuttons, proto boards, battery holders... Atmel chips can be used with Arduino, but normally it is programmed in C, you don't have so much assembler access as for PICs. The chips I mentioned are so cheap you could buy 5 to 10pcs. of each. Get some 16F5x as well, as they are so easy to configure. The price is so low you can simply bury them in a circuit, and don't ever have to pull them out from breadboards. When you have learned how to use PICs, you also can use more expensive chips. I have all these components here by the way, never counted my PICs but there are many which I don't use now, some mounted on adapters, some removed from old circuits, some brand new. For some people evalution boards are good, but I don't like the fact so much I can only use them for a single circuit. If I want to build something else, I can't use the circuit I built anymore. For this reason, I never used such boards, built all my PIC stuff from blank chips. Never had serious trouble, except with the PICKIT2 some years ago, and I also used non-standard ICSP. It's as simple as to solder a 6-pin row header, connect to the chip, and connect to the PICKIT programmer. The Arduino for instance has a USB bootloader. I also have one here! But it is far more expensive than circuits built from single components, as well includes a lot of stuff which simply is not needed. #### t06afre Joined May 11, 2009 5,936 Ok, Right now i dont care so much about how much pins the uC has. Could you suggest me any nice and tested good kit to start out with a very good guide or tutorial how i can start step by step? **i want to add that: i dont start uC because i want to be professional and i dont search about the uC which i could make more money. I just start because it will help me to undestand how a pc works.How the cpu co-opperates with the peripherals,what each one of the peripherals do,how the communicate,what is an interupt and how we handle and program it.So i want it for education reasons. And then to make same simple projects and if i want more i will have the experience to choose a new uC if i want. If you can afford it. The PICKIT 3 debug express will be just fine. Then you have worn the demoboard out. You can still use the PICKIT 3 to debug and program most other pic (with a F in the name like PIC 16f88) A more budget friendly approach will be the MPS430 kit. Both kits are prebuilt. And will work out of the box Thread Starter #### elissaios Joined Nov 7, 2012 14 GUYS kitha pickkit3 i could be able to program 16F84A and16F628 right?? I will buy pickkit3 and 16F84A and 16F628. Also i will search for an lcd,wires,breadboard,resistor,capacitors,wires pontesiometer,transistors,diodes,leds and what other is needed? (i dont know what sizes of all these components i have to buy.For example resistor 1kΩ,2κΩ and what other sizes?the same with capasitors and go on) #### tshuck Joined Oct 18, 2012 3,527 GUYS kitha pickkit3 i could be able to program 16F84A and16F628 right?? I will buy pickkit3 and 16F84A and 16F628. Also i will search for an lcd,wires,breadboard,resistor,capacitors,wires pontesiometer,transistors,diodes,leds and what other is needed? (i dont know what sizes of all these components i have to buy.For example resistor 1kΩ,2κΩ and what other sizes?the same with capasitors and go on) To answer your question, yes, the Pickit 3 can program those devices... there is, however, much dissension about whether the Pickit 3 is any better, if not worse, than the Pickit 2, but that's personal preference. Useful Components Note: this is a list of my most used components Wire Use 22-24AWG, solid core wire Resistors 330Ω 1kΩ 1.5kΩ 10kΩ 1MΩ Potentiometers 10kΩ 1MΩ Capacitors 10μF 100μF 0.1μF Transistors 2N2222(NPN) 2N3906(PNP) 2N7000 (NMOS-Enhancement mode) LEDs 5mm LEDs Diodes 1N4001 I can't remember the other diodes at the moment.. This should be enough to get you started! Hope this helps! #### kubeek Joined Sep 20, 2005 5,599 For the easiest and cheapest developement board I would suggest you the msp430 launchpad, for$4.30 I don't think there is anything with better value for the money.
Easy to program in C or assembler, and has almmost anyhting you might want to use. see http://www.ti.com/tool/msp-exp430g2

#### ErnieM

Joined Apr 24, 2011
7,992
Could you suggest me any nice and tested good kit to start out with a very good guide or tutorial how i can start step by step?
I did. Follow the link in my previous post. PICkit 2 or 3 debug kits are very good.

tshuck's list is fine, I would add a 1N4148 to the diodes. However, I wouldn't get anything till you get the basic development board working. That's a few days/weeks of work (and fun too), and you'll have a better idea of what direction you want to go.

#### elissaios

Joined Nov 7, 2012
14
Ok now i know what to do thanks all.

#### MrChips

Joined Oct 2, 2009
19,270
So are you gonna get the MSP430 LaunchPad?

You will not regret it.

#### elissaios

Joined Nov 7, 2012
14


text:
simplex - Maple Programming Help

Home : Support : Online Help : Mathematics : Optimization : Simplex Linear Optimization : simplex/convexhull

simplex

 convexhull
 find convex hull enclosing the given points

 Calling Sequence convexhull(P) convexhull(P, output=area) convexhull(P, output=hull) convexhull(P, output=plot)

Parameters

 P - list or set of points in 2 dimensions

Description

 • The command convexhull(P) returns a list of points defining the convex hull of the points in P in counter-clockwise order.
 • Every point in P must be a list of an x and y coordinate, both of which must be numbers (of type numeric).
 • If the option output=area is specified, the area of the convex hull of the points is returned.
 • If the option output=hull is specified, the convex hull is is returned as a list of points.  This is the default return value.
 • If the option output=plot is specified, a plot of the points and the convex hull is returned.
 • Multiple outputs can be specified, for example, output=[hull,area] returns a sequence of two values.
 • An $n\mathrm{log}\left(n\right)$ algorithm computing tangents of pairs of points is used.
 • For a slightly more geometrical interpretation of the same command, see geometry[convexhull].  The points input and output are geometric points, and the output is considered to be a convex polygon.
 • The command with(simplex,convexhull) allows the use of the abbreviated form of this command.

Examples

 > $\mathrm{with}\left(\mathrm{simplex}\right):$
 > $P≔\left\{\left[0,0\right],\left[\frac{1}{2},\frac{1}{2}\right],\left[1,1\right],\left[2,0\right],\left[1,0\right],\left[1,\frac{1}{2}\right]\right\}$
 ${P}{:=}\left\{\left[{0}{,}{0}\right]{,}\left[{1}{,}{0}\right]{,}\left[{1}{,}{1}\right]{,}\left[{1}{,}\frac{{1}}{{2}}\right]{,}\left[{2}{,}{0}\right]{,}\left[\frac{{1}}{{2}}{,}\frac{{1}}{{2}}\right]\right\}$ (1)
 > $\mathrm{convexhull}\left(P\right)$
 $\left[\left[{0}{,}{0}\right]{,}\left[{2}{,}{0}\right]{,}\left[{1}{,}{1}\right]\right]$ (2)
 > $\mathrm{convexhull}\left(P,\mathrm{output}=\mathrm{area}\right)$
 ${1}$ (3)
 > $H,A≔\mathrm{convexhull}\left(P,\mathrm{output}=\left[\mathrm{hull},\mathrm{area}\right]\right)$
 ${H}{,}{A}{:=}\left[\left[{0}{,}{0}\right]{,}\left[{2}{,}{0}\right]{,}\left[{1}{,}{1}\right]\right]{,}{1}$ (4)

Execute the following to get a plot of the points and the convex hull.

 > $\mathrm{convexhull}\left(P,\mathrm{output}=\mathrm{plot}\right)$

This creates 50 points uniformly distributed at random on [0,1).

 > $R≔\mathrm{rand}\left({10}^{10}\right):$
 > U01 := proc() Float( R(), -10 ) end proc:
 > $P≔\left\{\mathrm{seq}\left(\left[\mathrm{U01}\left(\right),\mathrm{U01}\left(\right)\right],i=1..50\right)\right\}:$
 > $\mathrm{convexhull}\left(P,\mathrm{output}=\mathrm{area}\right)$
 ${0.7570693924}$ (5)

Execute the following to get a plot of the points and the convex hull.

 > $\mathrm{convexhull}\left(P,\mathrm{output}=\mathrm{plot}\right)$


text:
Resistors and Ohm's Law Video Lessons

Concept

# Problem: A battery is connected to a resistor. Based on the nature of the DC circuit or the equation in the previous question, increasing the resistance of the resistor will A. Not affect the current in the circuit. B. Increase the current in the circuit. C. Decrease the current in the circuit.

###### FREE Expert Solution

Ohm's law:

$\overline{){\mathbit{i}}{\mathbf{=}}\frac{\mathbf{V}}{\mathbf{R}}}$, where i is current, V is the voltage, and R is the resistance.

83% (195 ratings)
###### Problem Details

A battery is connected to a resistor. Based on the nature of the DC circuit or the equation in the previous question, increasing the resistance of the resistor will

A. Not affect the current in the circuit.

B. Increase the current in the circuit.

C. Decrease the current in the circuit.


text:
## 12/11/2012, Monday, 16:30–17:30

Daniel Waldram, Imperial College London
Generalised geometry and supergravity

Supergravity is an extension of Einstein gravity that appears as the low-energy description of string theory. We show how “generalised geometry”, a class of extensions of conventional differential geometry first introduced by Hitchin, gives a natural way of formulating supergravity theories. This formulation unifies the bosonic fields and symmetries and has a natural action of $O(d,d)$ or the exceptional groups $E_d$ in $d$-dimensions. By introducing the analogue of the Levi-Civita connection we find that full set of bosonic equations of motion reduce to simply the vanishing of the generalised Ricci tensor. We show that the connection also encodes the supersymmetry variations and fermionic equations of motion. This formalism gives natural extensions of complex, symplectic and other integrable structures, with implications for describing supersymmetric string theory backgrounds.


text:
help-texinfo
[Top][All Lists]

## Re: [help-texinfo] Adjusting line spacing

 From: Karl Berry Subject: Re: [help-texinfo] Adjusting line spacing Date: Thu, 10 Feb 2011 00:26:42 GMT

    How can i get more spacing between lines, so?

Sorry for the incomplete example.  Try this near the beginning of the
source file:

@tex
\globaldefs=1
\def\baselinefactor{1.5}
@end tex

However, this doesn't change the space between the paragraphs.  That
would require yet more tweaking.  Why do you need this again :)?

Best,
karl


text:
# In a spinning tube, how low can the vacuum in the center be?

If you put a gas in a tube, and spin the tube [edit: along the axis of the cylinder], you will get a centrifuge.

What's the maximum pressure differential between edge and centre?

Asked another way: how close can we get to perfect vacuum, in a human-scale cylinder, with gas in the cylinder initially at atmospheric pressure or higher, and without liquidizing the gas or moving the cylinder walls at relativistic speeds? What're the variables we need to know?

Would Bernoulli’s Equation for a Rotating Fluid be the right way to tackle a compressible gas?

Cylinder diameter, and gas molecules per inch of the cylinder seem two obvious variables. With infinite diameter and a zero gas, we end up with a fairly good vacuum, which is why I ask about the biggest pressure differential, even though getting close to perfect vacuum in the centre of the cylinder is the goal.

You can increase the friction against the walls with fins or whatever, and start with the gas injected at an angle at high speed, or whatever explicitly-declared other handwaves necessary to maximize the differential in your answer.

• Have you tried to model this yourself? It just involves a differential force balance radially in conjunction with the ideal gas law, subject to the constraint that the total mass of gas is fixed. – Chet Miller May 18 at 2:08
• @ChetMiller I fear my knowledge of fluid dynamics is below highschool level, and math not much higher, but I'm willing to learn, given such pointers. It feels like you've already made some logical leaps from your deeper understanding, leaving me several steps behind. Can we ignore the lack of drag between the cylinder and the gas, and between the gas near the outside and those molecules in the center of the near-vacuum? Can we assume equilibrium in a rotating reference frame is the same as being static with a force gradient? Does ideal gas law hold for near-vacuum? – Dewi Morgan May 18 at 4:39
• You mention: 'you can increase the friction'. While increasing the friction would help to arrive at the final state faster, I think it's useful to be aware that increasing the friction is not necessary. Any fluid that is being rotated around some axis at a constant angular velocity eventually settles in a state of solid body rotation. A state of solid body rotation is arrived at when convection has decayed to zero. – Cleonis May 18 at 7:45
• @Cleonis response has answered most of your questions. – Chet Miller May 18 at 11:44

To a first approximation, imagine you have a gas in the tube at a particular temperature. That gives you the average $$KE$$ and therefore $$v$$. Then predict what acceleration would be necessary for items at that speed to not be able to reach a particular distance "up".

Assume $$\text{N}_2$$, a tube $$1\text{m}$$ from center to edge, and kept at $$300\text{K}$$.

$$E_k = \frac{3}{2} \frac{RT}{N_A} = 6.21 \times 10^{-21}\text{J}$$ $$v^2 = \frac{2E_k}{m} = 267000\text{m}^2/\text{s}^2$$ $$a = \frac{v^2}{2x} = 1.34 \times 10^5 \text{m}/\text{s}^2 = 13600g$$

Since many molecules are going faster than the average speed, you'd need a fair bit more than 13 000 g to keep the gas confined to a 1m region. For a rotating tube, the end would be subject to that acceleration with a rotation speed around 60 revolutions per second.

You're going to need a higher speed than that since not all the gas will be at the bottom of the tube, and you're going to have a long tail for the speed distribution of the molecules. 10 times that acceleration will probably get you a measurable difference in pressure.

• Ah, I shoulda specified the rotational axis! I meant rotating along the axis of the cylinder, rather than perpendicular to it! Still, I think this gives essentially the same result, assuming a tube of 1m radius... right? – Dewi Morgan May 18 at 1:08
• Mostly true. But spinning around the axis makes it harder for the gas to interact with the cylinder. You now only have drag from the wall which is much less efficient. – BowlOfRed May 18 at 1:32
• That's what I was thinking. And as you near vacuum, the drag linkage between the wall and the gas in near-vacuum of the centre drops to approximately nil. And at some point, the gas at the edge becomes liquid. Which is why I don't think anything simple like Bernoulli will work here. Hence asking here. – Dewi Morgan May 18 at 3:51

The eventual rotation of the gas as a virtually rigid body (as per @Cleonis response) is equivalent to creating artificial gravity in the radial direction, with "gravitational acceleration" equal to $$\omega^2 r$$, where $$\omega$$ is the angular rate of rotation. So the differential force balance in the radial direction is given by the "barotropic equation," $$\frac{dp}{dr}=\rho \omega^2r$$where $$\rho$$ is the gas density at radial location r. This is determined from the ideal gas law: $$\rho=\frac{pM}{RT}$$If we combine these two equations, we obtain: $$\frac{1}{p}\frac{dp}{dr}=\frac{M\omega^2}{RT}r$$This equation can be integrated with respect to r to yield: $$p=p(0)\exp{\left(\frac{M\omega^2r^2}{2RT}\right)}$$where p(0) is the pressure at r = 0. The average pressure $$\bar{p}$$ in the gas is obtained by integrating between r = 0 and r = a, the radius of the cylinder: $$\pi a^2\bar{p}=\int_0^a{2\pi r p(r)dr}=\pi a^2p(0)\left[\frac{e^{\xi}-1}{\xi}\right]$$where $$\xi=\frac{M\omega^2a^2}{2RT}$$Therefore, the pressure at the center of the cylinder is related to the average pressure by: $$p(0)=\bar{p}\left[\frac{\xi}{e^{\xi}-1}\right]$$By conservation of mass, the average pressure is the same as the original pressure which existed in the cylinder prior to rotation. So the above equation can readily be used to calculate the pressure (i.e., the amount of vacuum created) at the center of the cylinder during rotation.

• Thank you so much for fully defining all your terms :) I think my only question now is, what does the [square bracket] operator mean? – Dewi Morgan May 19 at 16:58
• It's just a parenthesis for multiplication. Let's see you make the calculation now for a sample case that you dream up. – Chet Miller May 19 at 17:00
• Lessee... I'm gonna have to make assumptions about units. angularVelocity('ω') = 2pi rad/s ; molarMassOfGas('M') = 30 g/mol (~air) ; cylinderRadius(a) = 1 m ; idealGasConstant(R) = 8 J/K/mol ; absoluteTemperature(T) = 300 K (~25C, room temp) ; averagePressure(pbar) = 100,000 Pa (~1 atm). Throwing those in, I get tempVar(ξ)= pi*pi/40, and centerPressure(p(0)) ~= 90,000. – Dewi Morgan May 19 at 18:47
• Now, I'm not sure I used the right units, and I failed to get Wolfram Alpha to confirm units, but I'm hoping that's ~90k Pa, which gives a 10% drop in the centre of a 1m radius cylinder of air rotated at 1Hz. That looks within the right order of magnitude, but rather more than I'd intuitively expect. – Dewi Morgan May 19 at 18:47
• Also, if I'm interpreting it right, p(0) is always a factor of pbar so as suspected can never be truly zero, but since it scales with e^ω^2, it suggests that it'd fall FAST. Plugging in 20pi rad/s I get an output of 0.00004747368 ... that's definitely lower than I'd intuitively suspect, and if true, makes me wonder why we don't use centrifuges to make vacuum chambers. Where'd I go wrong? :D – Dewi Morgan May 19 at 18:56


text:
# rlx_scalar.m

Scalar relaxation superoperator using Redfield theory.

## Syntax

    R=rlx_scalar(spin_system,H0,H1,tau_c)

## Description

Computes Redfield superoperator in situations when the system has a static background Hamiltonian and a perturbation with a scalar stochastic function in front of it. Scalar hyperfine relaxation is a common example. This function is called by Spinach relaxation theory module, but may also be invoked directly.

## Arguments

    H0 - background Hamiltonian

H1 - the stochastically modulated interaction operator
multiplied by its root mean square modulation depth

tau_c - the correlation time of the stochastic modulation

## Outputs

    R  - relaxation superoperator as a negative definite matrix

## Notes

If H1(t) has a non-zero average value, it must be subtracted out and put into H0.


text:
# Tag Info

5

There is a case, where \null makes a difference: At the start of a line TeX removes glue and penalties. If \verb starts with an invisible space, then it would be removed: \documentclass{article} \begin{document} \noindent x\\ \begingroup % \let\null\relax \verb| |y \endgroup \end{document} \null as \hbox{} prevents that the space is gobbled ...

4

For fancyvrb, you need to use \VerbatimEnvironment before the \begin{Verbatim}. That tells fancyvrb to detect the name of the current environment, and look for the end of that environment, rather than looking for a literal \end{Verbatim}. You will probably want to use a proper framing package to provide the background color...that way you won't have to ...

3

One possibility using the listings package; since apparently you only want to highlight some specific strings, you can escape to LaTeX and do the coloring there (in my example I used the bera package just to have a mono-spaced font allowing boldface) \documentclass{article} \usepackage{xcolor} \usepackage{listings} \usepackage{bera}% for boldfaced ...

2

Using fragile does not work for me when changing the mode as when generating slides and handouts from separate driver files calling the same content file so I came up with an ugly but effective work around. Let me give an example expanding on the one given above. The driver file to create slides is called contentfile.beamer and has the following: ...

1

First, here is a solution that uses only the xcolor package and the standard verbatim environment. But it is not a new environment, per se, and so does not directly answer the OP's question (for that, see below). \documentclass{article} \usepackage{xcolor} \fboxrule=1pt \begin{document} \setbox0=\hbox{\begin{minipage}{3in} \color{red!90} \begin{verbatim} ...

Only top voted, non community-wiki answers of a minimum length are eligible


text:
Volume 398 - The European Physical Society Conference on High Energy Physics (EPS-HEP2021) - T05: Heavy Ion Physics
First steps towards the quantum simulation of jet quenching
The leading order $\alpha_s$ effect in jet quenching corresponds to the broadening of the jet's transverse momentum, due to the multiple interactions with the underlying medium. A complete understanding of momentum broadening is critical for the success of jet quenching phenomenology.
In this talk, we introduce a strategy to quantum simulate single particle momentum broadening in a QCD background medium. We argue that it is, in principle, possible to extract the jet quenching parameter $\hat{q}$ from such an algorithm. More importantly, this corresponds to the first step towards simulating full medium induced parton showers, which is far beyond the capabilities of classical computers.


text:
# Should we always think of problems higher in the polynomial hierarchy as harder than problems lower in the hierarchy?

This "research vignette" (whatever that is) claims that the polynomial hierarchy

classifies problems according to a natural notion of logical complexity, and is defined with an infinite number of levels: problems at the zeroth level are the “easiest”, and for every integer $k$, problems at the $(k+1)$-st level have logical complexity “one notch higher” than those at level $k$.

Obviously this is just a heuristic explanation rather than any kind of rigorous claim, but is it true that problems higher in the hierarchy should be thought of as harder than problems lower in the hierarchy?

For example, consider the complexity class BQP. It is not believed to contain NP; in fact, many experts consider (Fig. 3) NP-complete problems to be much harder than the hardest problems in BQP. But the same experts also believe that BQP is not contained within the polynomial hierarchy PH (with Recursive Fourier Sampling as a concrete example of a problem believed to be in BQP \ PH). It therefore seems reasonable to say that for any $n$, there exist problems in $\Sigma_n \setminus \Sigma_{n-1}$ that are easier than RFS.

But putting these two results (that any NP-complete problem is harder than RFS, and that RFS is harder than some problem in $\Sigma_n \setminus \Sigma_{n-1}$ for any $n$) together, we find that there are problems in $\Sigma_1$ (namely, any NP-complete problem) that are harder (in fact, much, much harder) than certain problems in $\Sigma_n \setminus \Sigma_{n-1}$ for all $n$. Therefore, I don't see any way in which the polynomial hierarchy actually ranks problems by complexity.

Is there is mistake in my reasoning? Is there any useful sense in which problems higher up in the hierarchy are always harder than problems lower down? (I know this is a soft question, since there are different ways of formalizing the notion that one problem is "harder" than another. Maybe the answer is just that the PH is one way of ranking certain problems by difficulty, but not generally the best way.)

The quote you give is an informal claim/intuition. Don't try to read too much into informal claims; they are intended to give you a sense of what's going on, but for specific details, you need to look at the precise technical claim.

I suspect the source of your confusion is that you are using the same phrase in two or three different ways in different places, without realizing it. This is the logical fallacy of equivocation. In particular, I don't think you're using "harder than" in exactly the same way each time you use it. This then leads to you reaching conclusions that seem absurd or confusing. One way to remedy the confusion is to understand more clearly exactly what you mean by "harder than", and then walk through your logic.

One possible meaning of "P is harder than Q" is that the "running time of the fastest algorithm to solve P is larger than the running time of the fastest algorithm to solve Q, in some specific theoretical model of computation". This is a statement about theoretical complexity. Note that this meaning depends on the model of computation. P might be harder than Q in one model of computation (e.g., classical computation), but not in another model (e.g., quantum computation).

A second possible meaning of "P is harder than Q" is "Q reduces to P". This is a theoretical statement, which has implications for the previous statement (if Q reduces to P, then the running time of the fastest algorithm for P can't be too much less than the running time of the fastest algorithm for Q). Note that this notion of "harder than" is as a partial order. There might be two problems P,Q such that neither "P is harder than Q" nor "Q is harder than P" are true; the problems might be incomparable.

A third possible meaning of "P is harder than Q" is "in practice it's probably harder (takes more time or costs more) to solve instances of P than instances of Q". This is a statement about engineering and what is feasible in practice, rather than theory. For instance, this will depend on whether quantum computers are feasible to build, in practice -- something that no one knows the answer to right now. If quantum computers are feasible, then we'll discover that factoring is much easier than all NP-complete problems, because a quantum computer can solve factoring quickly but can't solve NP-complete problems quickly (we think). If quantum computers aren't feasible, then factoring might turn out to be not much easier than some NP-complete problems.

Finally, just because a problem isn't in PH doesn't necessarily mean it is harder than all problems in PH -- so just because Recursive Fourier Sampling is not in PH doesn't necessarily mean it is harder than all problems in PH (in the sense of the existence of a reduction).

As a final complication, Recursive Fourier Sampling is a funny kind of problem. It's not an ordinary decision problem. Rather, it's an oracle problem. Oracle problems can't be directly compared to ordinary problems.

• Yes, this is basically an expansion of the parenthetical comment at the end of my post. I'm just trying to get a rough, non-rigorous mental picture of the relative difficulties of the problems. (Also, your second-to-last paragraph is the core of my OP - the point is that RFS isn't harder than, say NP-complete problems, which are in the PH. That's the issue.) – tparker Mar 16 '18 at 0:35
• And clearly I'm not referring to engineering costs in my OP. Could you give specific examples of different difficulty orderings within the PH with respect to the various possible senses that you mention? I suspect that it practice, it doesn't matter too much which scheme you use. – tparker Mar 16 '18 at 0:47
• @tparker, OK. I apologize for misunderstanding what you are asking, then. In that case, I'm not entirely sure how to help. Hopefully someone else can get you an answer that will be more useful to you! – D.W. Mar 16 '18 at 2:22

The answer to your actual question is yes. The only thing I would (nitpickingly) change about the text you cite is that, when it talks about the $(k+1)$-st level, it should acknowledge that it includes the $k$-th level. So the "one notch higher" happens only for problems that are new in the $(k+1)$-st level.

One thing the polynomial hierarchy does not do is encompass all problems. It "classifies problems according to [...] complexity", but only those problems, which it happens to contain.

The popular conjecture seems to be that BQP is incomparable with PH. (There are problems in NP which are conjectured not to be in BQP and problems in BQP which are conjectured not to be in PH.) And that is not even surprising. PH and BQP extend P in different ways. PH by (bounded-alternation) nondeterminism, BQP by quantum. A priori there is no reason to assume the resulting classes to be comparable.

• I don't see how this answers my question. I'm not asking about the relative difficulty of PH and BQP - I'm asking about the relative difficulty of problems in NP-COMPLETE vs. certain problems in, say, $\Sigma_N$ for very large $N$. I'm comparing each of them to a problem in BQP that is outside of PH, but then eliminating the intermediate problem to conclude with a problem in $\Sigma_1$ that seems harder than a problem in $\Sigma_N$. – tparker Mar 17 '18 at 1:36
• I disagree. All your problem RFS does is exemplify that PH and BQP are incomparable. Anyway, I wish you good luck in attracting answers to the question you intended to ask. – kne Mar 17 '18 at 12:35
• Could you clarify which step you disagree with? (a) RFS is harder than some problem $x \in (\Sigma_N \setminus \Sigma_{N-1})$ with $N > 1$, (b) any $y$ in NP-COMPLETE is harder than RFS, or (c) there exists an $x \in (\Sigma_N \setminus \Sigma_{N-1})$ easier than any $y$ in NP-COMPLETE $\subset \Sigma_1$? – tparker Mar 17 '18 at 16:19


text:
# Tag Info

11

I think you wanted to write *{2}{c@{{}\mathrel{<}{}}}l instead of c*{2}{@{{}\mathrel{<}{}}l} which means having the last two columns left-aligned. In fact, the syntax for multiple columns with same alignment is *{<number of columns>}{<column alignment>} Also, since the < symbol is defined as \mathrel by default, you can ...

5

Your current table is quite hard to read so I would like to propose a completely different approach: % arara: pdflatex \documentclass{article} \usepackage[utf8]{inputenc} \usepackage{siunitx} \usepackage{booktabs} \usepackage{chngcntr} \counterwithin{table}{section} \usepackage{etoolbox} \begin{document} \setcounter{section}{1} \setcounter{table}{1} ...

2

You can try something like this (all horizontal and vertical rules only for explanation and can be removed): \documentclass{article} \usepackage{array,tabularx} \begin{document} \newcolumntype{R}[1]{>{\raggedleft\arraybackslash}p{#1}} \newcolumntype{N}{>{\centering\arraybackslash}X} \begin{tabularx}{\linewidth}{|R{5cm}|N|m{5cm}|} \hline Lorem ipsum ...

2

Two options: Using some tabulars for each layer and the subcaption package: The code: \documentclass{article} \usepackage{subcaption} \usepackage{graphicx} \begin{document} \begin{figure} \begin{minipage}{\linewidth} \centering \begin{tabular}{ccc} \includegraphics[width=.28\linewidth,height=1cm]{example-image-a} & ...

2

May be you are looking for \documentclass{article} \def\inv{^{-1}} \begin{document} $\begin{array}{c*{2}{@{{}\mathrel{<}{}}c}} 1 & |z| & |k|\inv \\[\jot] |k| & |\phi(z)| & \hphantom{|} 1 \end{array}$ \end{document} in your original code c*{2}{@{{}\mathrel{<}{}}l} means first column is center and the two last column ...

1

When you process the first example Here some metrical text, longer than one line, and I want the {\raggedleft second line to be right aligned.\quad 1\par} the \par command appears when \raggedleft is in effect and so the whole paragraph will be ragged left. In the second case you're telling TeX where to break the first line, but the paragraph is ragged ...

1

Obvious your picture is to wide to be fit in text width. See comparison: As you can see, figures b and c overlap. What to do: 1. enlarge (locally text width for example with help of package changepage. With \adjustwidth}{<leftmargin>}{<rightmargin>} <your figures> \end{adjustwidth} redesign your second and third figures so, that ...

1

Insteadtabulary i suggest to use tabularx. \documentclass[a4paper,twoside,11pt,openany]{book} \usepackage[utf8]{inputenc} \usepackage{makecell,booktabs,tabularx} \renewcommand\theadfont{\bfseries} \usepackage{siunitx} \usepackage{ragged2e} \usepackage[active,floats,tightpage]{preview} \setlength\PreviewBorder{1mm}% \begin{document} ...

Only top voted, non community-wiki answers of a minimum length are eligible


text:
# Using “found” code to typeset augmented matrices, want [] instead of ()

Here's a minimal example of what I'm doing presently:

\documentclass[a4paper,12pt]{article}
\usepackage{amsmath}
\usepackage{arydshln}
\makeatletter
\renewcommand*\env@matrix[1][*\c@MaxMatrixCols c]{%
\hskip -\arraycolsep
\let\@ifnextchar\new@ifnextchar
\array{#1}}
\makeatother

\begin{document}
$\begin{pmatrix}[ccc:c] 1&2&3&0 \\ 4&5&6&0 \\ 7&8&9&0 \\ \end{pmatrix}$
\end{document}

Here's what the output looks like:

I'd prefer if the left and right brackets on the matrix were square brackets instead of parentheses.

Is there an easy way to make such a change?

-
A excellent summary of matricies is in this answer: where is the matrix command – Peter Grill Nov 21 '11 at 17:46
Nice. That is a good summary. – Harold Nov 21 '11 at 17:59

Easy. Change pmatrix to bmatrix:
See amsmath documentation for other kinds of matrices, like vmatrix, Vmatrix, etc
or look at mathmode.pdf (26.6 Matrix environments) with texdoc mathmode.pdf – Alain Matthes Nov 21 '11 at 17:42


text:
## General, Organic, and Biological Chemistry: Structures of Life (5th Edition)

a. $NH_4Cl$ will produce a solution that contains only ions. b. $C_2H_5OH$ will produce a solution that contains only molecules. c. $HCN$ will produce a solution that contains mostly molecules and a few ions.


text:
# Existence of Real-Valued Functions Satisfying Certain Properties

(1)Please give a real-valued function $f$ satisfies the set $\{(x,f(x)):x\text{ belongs to }\mathbb{R}\}$ is a second category subset of $\mathbb{R}^2$? (2)Please give a real-valued function f satisfies the set $\{(x,f(x)):x\text{ belongs to }\mathbb{R}\}$ is a non-measurable set in $\mathbb{R}^2$ in the Lebesgue sense?

-
but how do you proof the range of f is a second category subset of R2? –  mathabc Aug 4 '11 at 1:11
@mathabc: Mike’s function is a surjection: its range is all of $\mathbb{R}^2$. –  Brian M. Scott Aug 4 '11 at 1:17
Whoops, you're right that doesn't work. –  Mike F Aug 4 '11 at 1:18
my mistake,what I mean is how to proof the graph of f is a second category subset of R2? –  mathabc Aug 4 '11 at 1:19

For the first, wouldn't using a combination using a nonmeasurable subset of $\mathbb R^2$ help? –  gary Aug 4 '11 at 2:02


text:
# Difference between revisions of "2013 AIME I Problems/Problem 2"

## Problem 2

Find the number of five-digit positive integers, $n$, that satisfy the following conditions:

(a) the number $n$ is divisible by $5,$
(b) the first and last digits of $n$ are equal, and
(c) the sum of the digits of $n$ is divisible by $5.$

## Solution

The number takes a form of $5\text{x,y,z}5$, in which $5|x+y+z$. Let $x$ and $y$ be arbitrary digits. For each pair of $x,y$, there are exactly two values of $z$ that satisfy the condition of $5|x+y+z$. Therefore, the answer is $10\times10\times2=\boxed{200}$

This 9-line code in Python also gives the answer too. import math counter=0 for integer in range(10000,99999):

 if str(integer)[4] != '5' or str(integer)[0] != '5':
counter=counter
else:
if math.remainder(int(str(integer)[1]+str(integer)[2]+str(integer)[3]),5)==0:
counter+=1

print(counter)


text:
# Properties

 Modulus $1638$ Structure $$C_{6}\times C_{6}\times C_{12}$$ Order $432$

Show commands: Pari/GP / SageMath

sage: H = DirichletGroup(1638)

pari: g = idealstar(,1638,2)

## Character group

 sage: G.order()  pari: g.no Order = 432 sage: H.invariants()  pari: g.cyc Structure = $$C_{6}\times C_{6}\times C_{12}$$ sage: H.gens()  pari: g.gen Generators = $\chi_{1638}(911,\cdot)$, $\chi_{1638}(703,\cdot)$, $\chi_{1638}(379,\cdot)$

## First 32 of 432 characters

Each row describes a character. When available, the columns show the orbit label, order of the character, whether the character is primitive, and several values of the character.

Character Orbit Order Primitive $$-1$$ $$1$$ $$5$$ $$11$$ $$17$$ $$19$$ $$23$$ $$25$$ $$29$$ $$31$$ $$37$$ $$41$$
$$\chi_{1638}(1,\cdot)$$ 1638.a 1 no $$1$$ $$1$$ $$1$$ $$1$$ $$1$$ $$1$$ $$1$$ $$1$$ $$1$$ $$1$$ $$1$$ $$1$$
$$\chi_{1638}(5,\cdot)$$ 1638.ft 12 no $$-1$$ $$1$$ $$e\left(\frac{1}{12}\right)$$ $$e\left(\frac{5}{12}\right)$$ $$e\left(\frac{5}{6}\right)$$ $$e\left(\frac{11}{12}\right)$$ $$e\left(\frac{1}{3}\right)$$ $$e\left(\frac{1}{6}\right)$$ $$e\left(\frac{5}{6}\right)$$ $$i$$ $$e\left(\frac{11}{12}\right)$$ $$e\left(\frac{5}{12}\right)$$
$$\chi_{1638}(11,\cdot)$$ 1638.fk 12 no $$1$$ $$1$$ $$e\left(\frac{5}{12}\right)$$ $$e\left(\frac{11}{12}\right)$$ $$e\left(\frac{1}{3}\right)$$ $$i$$ $$1$$ $$e\left(\frac{5}{6}\right)$$ $$-1$$ $$i$$ $$e\left(\frac{5}{12}\right)$$ $$e\left(\frac{5}{12}\right)$$
$$\chi_{1638}(17,\cdot)$$ 1638.dg 6 no $$1$$ $$1$$ $$e\left(\frac{5}{6}\right)$$ $$e\left(\frac{1}{3}\right)$$ $$1$$ $$e\left(\frac{2}{3}\right)$$ $$-1$$ $$e\left(\frac{2}{3}\right)$$ $$e\left(\frac{1}{6}\right)$$ $$e\left(\frac{2}{3}\right)$$ $$-1$$ $$e\left(\frac{1}{6}\right)$$
$$\chi_{1638}(19,\cdot)$$ 1638.fg 12 no $$1$$ $$1$$ $$e\left(\frac{11}{12}\right)$$ $$i$$ $$e\left(\frac{2}{3}\right)$$ $$i$$ $$e\left(\frac{5}{6}\right)$$ $$e\left(\frac{5}{6}\right)$$ $$e\left(\frac{2}{3}\right)$$ $$e\left(\frac{7}{12}\right)$$ $$e\left(\frac{7}{12}\right)$$ $$e\left(\frac{11}{12}\right)$$
$$\chi_{1638}(23,\cdot)$$ 1638.cn 6 no $$-1$$ $$1$$ $$e\left(\frac{1}{3}\right)$$ $$1$$ $$-1$$ $$e\left(\frac{5}{6}\right)$$ $$e\left(\frac{1}{6}\right)$$ $$e\left(\frac{2}{3}\right)$$ $$e\left(\frac{1}{6}\right)$$ $$-1$$ $$-1$$ $$1$$
$$\chi_{1638}(25,\cdot)$$ 1638.dl 6 no $$1$$ $$1$$ $$e\left(\frac{1}{6}\right)$$ $$e\left(\frac{5}{6}\right)$$ $$e\left(\frac{2}{3}\right)$$ $$e\left(\frac{5}{6}\right)$$ $$e\left(\frac{2}{3}\right)$$ $$e\left(\frac{1}{3}\right)$$ $$e\left(\frac{2}{3}\right)$$ $$-1$$ $$e\left(\frac{5}{6}\right)$$ $$e\left(\frac{5}{6}\right)$$
$$\chi_{1638}(29,\cdot)$$ 1638.ct 6 no $$-1$$ $$1$$ $$e\left(\frac{5}{6}\right)$$ $$-1$$ $$e\left(\frac{1}{6}\right)$$ $$e\left(\frac{2}{3}\right)$$ $$e\left(\frac{1}{6}\right)$$ $$e\left(\frac{2}{3}\right)$$ $$-1$$ $$e\left(\frac{1}{3}\right)$$ $$e\left(\frac{1}{3}\right)$$ $$e\left(\frac{1}{6}\right)$$
$$\chi_{1638}(31,\cdot)$$ 1638.eu 12 no $$1$$ $$1$$ $$i$$ $$i$$ $$e\left(\frac{2}{3}\right)$$ $$e\left(\frac{7}{12}\right)$$ $$-1$$ $$-1$$ $$e\left(\frac{1}{3}\right)$$ $$e\left(\frac{7}{12}\right)$$ $$e\left(\frac{7}{12}\right)$$ $$e\left(\frac{11}{12}\right)$$
$$\chi_{1638}(37,\cdot)$$ 1638.em 12 no $$-1$$ $$1$$ $$e\left(\frac{11}{12}\right)$$ $$e\left(\frac{5}{12}\right)$$ $$-1$$ $$e\left(\frac{7}{12}\right)$$ $$-1$$ $$e\left(\frac{5}{6}\right)$$ $$e\left(\frac{1}{3}\right)$$ $$e\left(\frac{7}{12}\right)$$ $$-i$$ $$e\left(\frac{7}{12}\right)$$
$$\chi_{1638}(41,\cdot)$$ 1638.gd 12 no $$-1$$ $$1$$ $$e\left(\frac{5}{12}\right)$$ $$e\left(\frac{5}{12}\right)$$ $$e\left(\frac{1}{6}\right)$$ $$e\left(\frac{11}{12}\right)$$ $$1$$ $$e\left(\frac{5}{6}\right)$$ $$e\left(\frac{1}{6}\right)$$ $$e\left(\frac{11}{12}\right)$$ $$e\left(\frac{7}{12}\right)$$ $$-i$$
$$\chi_{1638}(43,\cdot)$$ 1638.dn 6 no $$1$$ $$1$$ $$e\left(\frac{5}{6}\right)$$ $$e\left(\frac{5}{6}\right)$$ $$e\left(\frac{1}{3}\right)$$ $$e\left(\frac{5}{6}\right)$$ $$1$$ $$e\left(\frac{2}{3}\right)$$ $$e\left(\frac{1}{3}\right)$$ $$e\left(\frac{5}{6}\right)$$ $$e\left(\frac{1}{6}\right)$$ $$-1$$
$$\chi_{1638}(47,\cdot)$$ 1638.gb 12 no $$-1$$ $$1$$ $$i$$ $$i$$ $$e\left(\frac{5}{6}\right)$$ $$e\left(\frac{5}{12}\right)$$ $$1$$ $$-1$$ $$e\left(\frac{1}{6}\right)$$ $$e\left(\frac{5}{12}\right)$$ $$e\left(\frac{5}{12}\right)$$ $$e\left(\frac{7}{12}\right)$$
$$\chi_{1638}(53,\cdot)$$ 1638.dp 6 no $$-1$$ $$1$$ $$e\left(\frac{5}{6}\right)$$ $$e\left(\frac{1}{6}\right)$$ $$e\left(\frac{1}{6}\right)$$ $$e\left(\frac{1}{3}\right)$$ $$e\left(\frac{5}{6}\right)$$ $$e\left(\frac{2}{3}\right)$$ $$-1$$ $$e\left(\frac{2}{3}\right)$$ $$e\left(\frac{1}{3}\right)$$ $$-1$$
$$\chi_{1638}(55,\cdot)$$ 1638.bf 6 no $$-1$$ $$1$$ $$-1$$ $$e\left(\frac{1}{3}\right)$$ $$e\left(\frac{1}{6}\right)$$ $$e\left(\frac{1}{6}\right)$$ $$e\left(\frac{1}{3}\right)$$ $$1$$ $$e\left(\frac{1}{3}\right)$$ $$-1$$ $$e\left(\frac{1}{3}\right)$$ $$e\left(\frac{5}{6}\right)$$
$$\chi_{1638}(59,\cdot)$$ 1638.en 12 no $$-1$$ $$1$$ $$i$$ $$e\left(\frac{11}{12}\right)$$ $$-1$$ $$e\left(\frac{5}{12}\right)$$ $$e\left(\frac{2}{3}\right)$$ $$-1$$ $$-1$$ $$e\left(\frac{1}{12}\right)$$ $$-i$$ $$e\left(\frac{7}{12}\right)$$
$$\chi_{1638}(61,\cdot)$$ 1638.be 6 no $$-1$$ $$1$$ $$-1$$ $$e\left(\frac{2}{3}\right)$$ $$e\left(\frac{1}{6}\right)$$ $$-1$$ $$e\left(\frac{2}{3}\right)$$ $$1$$ $$e\left(\frac{1}{3}\right)$$ $$e\left(\frac{1}{6}\right)$$ $$e\left(\frac{1}{3}\right)$$ $$-1$$
$$\chi_{1638}(67,\cdot)$$ 1638.fv 12 no $$-1$$ $$1$$ $$-i$$ $$e\left(\frac{7}{12}\right)$$ $$e\left(\frac{5}{6}\right)$$ $$-i$$ $$e\left(\frac{5}{6}\right)$$ $$-1$$ $$e\left(\frac{2}{3}\right)$$ $$e\left(\frac{1}{12}\right)$$ $$e\left(\frac{11}{12}\right)$$ $$-i$$
$$\chi_{1638}(71,\cdot)$$ 1638.ey 12 no $$1$$ $$1$$ $$i$$ $$e\left(\frac{5}{12}\right)$$ $$e\left(\frac{1}{3}\right)$$ $$e\left(\frac{1}{12}\right)$$ $$e\left(\frac{2}{3}\right)$$ $$-1$$ $$e\left(\frac{1}{6}\right)$$ $$-i$$ $$e\left(\frac{11}{12}\right)$$ $$e\left(\frac{11}{12}\right)$$
$$\chi_{1638}(73,\cdot)$$ 1638.fh 12 no $$1$$ $$1$$ $$e\left(\frac{1}{12}\right)$$ $$e\left(\frac{5}{12}\right)$$ $$e\left(\frac{2}{3}\right)$$ $$e\left(\frac{1}{12}\right)$$ $$e\left(\frac{5}{6}\right)$$ $$e\left(\frac{1}{6}\right)$$ $$1$$ $$e\left(\frac{5}{12}\right)$$ $$e\left(\frac{1}{12}\right)$$ $$-i$$
$$\chi_{1638}(79,\cdot)$$ 1638.u 3 no $$1$$ $$1$$ $$1$$ $$1$$ $$e\left(\frac{1}{3}\right)$$ $$e\left(\frac{2}{3}\right)$$ $$1$$ $$1$$ $$e\left(\frac{2}{3}\right)$$ $$e\left(\frac{2}{3}\right)$$ $$e\left(\frac{2}{3}\right)$$ $$e\left(\frac{1}{3}\right)$$
$$\chi_{1638}(83,\cdot)$$ 1638.ep 12 no $$-1$$ $$1$$ $$e\left(\frac{1}{12}\right)$$ $$e\left(\frac{5}{12}\right)$$ $$-1$$ $$i$$ $$e\left(\frac{1}{3}\right)$$ $$e\left(\frac{1}{6}\right)$$ $$e\left(\frac{1}{6}\right)$$ $$e\left(\frac{7}{12}\right)$$ $$i$$ $$e\left(\frac{1}{12}\right)$$
$$\chi_{1638}(85,\cdot)$$ 1638.ga 12 no $$-1$$ $$1$$ $$e\left(\frac{11}{12}\right)$$ $$-i$$ $$e\left(\frac{5}{6}\right)$$ $$e\left(\frac{7}{12}\right)$$ $$e\left(\frac{5}{6}\right)$$ $$e\left(\frac{5}{6}\right)$$ $$1$$ $$e\left(\frac{11}{12}\right)$$ $$e\left(\frac{5}{12}\right)$$ $$e\left(\frac{7}{12}\right)$$
$$\chi_{1638}(89,\cdot)$$ 1638.et 12 no $$-1$$ $$1$$ $$e\left(\frac{11}{12}\right)$$ $$e\left(\frac{11}{12}\right)$$ $$-1$$ $$e\left(\frac{1}{12}\right)$$ $$1$$ $$e\left(\frac{5}{6}\right)$$ $$e\left(\frac{5}{6}\right)$$ $$e\left(\frac{1}{12}\right)$$ $$-i$$ $$e\left(\frac{7}{12}\right)$$
$$\chi_{1638}(95,\cdot)$$ 1638.ec 6 no $$-1$$ $$1$$ $$1$$ $$e\left(\frac{2}{3}\right)$$ $$-1$$ $$e\left(\frac{1}{6}\right)$$ $$e\left(\frac{1}{6}\right)$$ $$1$$ $$-1$$ $$e\left(\frac{5}{6}\right)$$ $$-1$$ $$e\left(\frac{1}{3}\right)$$
$$\chi_{1638}(97,\cdot)$$ 1638.ev 12 no $$1$$ $$1$$ $$e\left(\frac{7}{12}\right)$$ $$e\left(\frac{7}{12}\right)$$ $$e\left(\frac{1}{3}\right)$$ $$e\left(\frac{7}{12}\right)$$ $$-1$$ $$e\left(\frac{1}{6}\right)$$ $$e\left(\frac{1}{3}\right)$$ $$e\left(\frac{7}{12}\right)$$ $$e\left(\frac{11}{12}\right)$$ $$i$$
$$\chi_{1638}(101,\cdot)$$ 1638.db 6 no $$1$$ $$1$$ $$e\left(\frac{1}{6}\right)$$ $$e\left(\frac{2}{3}\right)$$ $$e\left(\frac{1}{3}\right)$$ $$1$$ $$-1$$ $$e\left(\frac{1}{3}\right)$$ $$-1$$ $$1$$ $$e\left(\frac{1}{6}\right)$$ $$e\left(\frac{1}{6}\right)$$
$$\chi_{1638}(103,\cdot)$$ 1638.ch 6 no $$-1$$ $$1$$ $$e\left(\frac{1}{3}\right)$$ $$e\left(\frac{1}{6}\right)$$ $$e\left(\frac{5}{6}\right)$$ $$e\left(\frac{2}{3}\right)$$ $$e\left(\frac{1}{3}\right)$$ $$e\left(\frac{2}{3}\right)$$ $$e\left(\frac{1}{3}\right)$$ $$1$$ $$e\left(\frac{1}{6}\right)$$ $$e\left(\frac{2}{3}\right)$$
$$\chi_{1638}(107,\cdot)$$ 1638.di 6 no $$-1$$ $$1$$ $$e\left(\frac{1}{6}\right)$$ $$e\left(\frac{1}{6}\right)$$ $$-1$$ $$e\left(\frac{1}{3}\right)$$ $$-1$$ $$e\left(\frac{1}{3}\right)$$ $$e\left(\frac{5}{6}\right)$$ $$e\left(\frac{1}{3}\right)$$ $$1$$ $$e\left(\frac{5}{6}\right)$$
$$\chi_{1638}(109,\cdot)$$ 1638.fz 12 no $$-1$$ $$1$$ $$e\left(\frac{1}{12}\right)$$ $$e\left(\frac{11}{12}\right)$$ $$e\left(\frac{1}{6}\right)$$ $$e\left(\frac{1}{12}\right)$$ $$e\left(\frac{5}{6}\right)$$ $$e\left(\frac{1}{6}\right)$$ $$1$$ $$e\left(\frac{5}{12}\right)$$ $$e\left(\frac{7}{12}\right)$$ $$-i$$
$$\chi_{1638}(113,\cdot)$$ 1638.ct 6 no $$-1$$ $$1$$ $$e\left(\frac{1}{6}\right)$$ $$-1$$ $$e\left(\frac{5}{6}\right)$$ $$e\left(\frac{1}{3}\right)$$ $$e\left(\frac{5}{6}\right)$$ $$e\left(\frac{1}{3}\right)$$ $$-1$$ $$e\left(\frac{2}{3}\right)$$ $$e\left(\frac{2}{3}\right)$$ $$e\left(\frac{5}{6}\right)$$
$$\chi_{1638}(115,\cdot)$$ 1638.ew 12 no $$1$$ $$1$$ $$e\left(\frac{5}{12}\right)$$ $$e\left(\frac{5}{12}\right)$$ $$e\left(\frac{1}{3}\right)$$ $$-i$$ $$-1$$ $$e\left(\frac{5}{6}\right)$$ $$1$$ $$-i$$ $$e\left(\frac{5}{12}\right)$$ $$e\left(\frac{5}{12}\right)$$


text:
# Finite mixture regression models with varying intercepts and slopes

#1

Hi!

I am working on a research project in which two treatments are evaluated by a randomized clinical trial and the outcome is measured in three moments (before de intervention, right after the intervention and one month follow-up).

I want to evaluate the differential treatment effect in the slope, similar to the CD4 model in ARM book (Chapter 20, section 5):

y_i \sim N(\alpha_{ji} + \beta_{ji} t_i, \sigma_y)

with \alpha and \beta modeled by a multivariate normal with mean parameters \gamma^{\alpha}_0 and \gamma^{\beta}_0 + \gamma^{\beta}_1 t_j, in which t is a binary treatment indicator.

So far, so good, I can fit such a model with ease. But I hypothetize that there are two latent classes: some subjects have better results with treatment 1, and some have better results with treatment 2. A finite mixture model is the obvious choice, but I couldn’t find a model in the literature that corresponds exactly to my problem.

At first, I implemented a finite mixture regression model without the hierarchical component, and the model definition was quite clear, and Stan recovered all parameters beautifully.

But when the model has two levels, how the mixture should be defined? Fermund and Magidson (https://jeroenvermunt.nl/gfkl2004a.pdf) suggests mixture in both levels, but I don’t think it makes sense, in my case, to consider mixture at the single measurement level.

So far, I implemented a model (code below) in which the mixture component applies only to the second level (varying intercepts and slopes), and it also recovers all parameters correctly (I think). But I really would like some input in how to better model this problem. Papers about similar models are welcome!

Thanks!
Erikson

data {
int<lower=1> N;
int<lower=1> J;
vector[J] t;
vector[N] time;
vector[N] y;
int id[N];
}

parameters {
// Group model
real<lower=0, upper=1> theta;

// Intercept model
vector[2] muAlpha;
vector<lower=0>[2] sigmaAlpha;
vector[J] alpha;

ordered[2] muBeta;
ordered[2] tau;
vector<lower=0>[2] sigmaBeta;
vector[J] beta;

corr_matrix[2] Omega0;
corr_matrix[2] Omega1;

real<lower=0> sigma;
}

model {
theta ~ beta(5, 5);

muAlpha ~ normal(0, 10);
tau ~ normal(0, 10);
sigmaAlpha ~ lognormal(0, 0.3);

muBeta ~ normal(0, 10);
sigmaBeta ~ lognormal(0, 0.3);

sigma ~ student_t(5, 0, 3);

Omega0 ~ lkj_corr(3);
Omega1 ~ lkj_corr(3);

{
matrix[J, 2] regPars;
matrix[J, 2] mu0;
matrix[J, 2] mu1;
vector[2] sigma0;
vector[2] sigma1;

regPars[, 1] = alpha;
regPars[, 2] = beta;

mu0[, 1] = rep_vector(muAlpha[1], J);
mu0[, 2] = muBeta[1] + tau[2] * t;

mu1[, 1] = rep_vector(muAlpha[2], J);
mu1[, 2] = muBeta[2] + tau[1] * t;

sigma0[1] = sigmaAlpha[1];
sigma0[2] = sigmaBeta[1];

sigma1[1] = sigmaAlpha[2];
sigma1[2] = sigmaBeta[2];

for (j in 1:J) {
target += log_mix(theta,
multi_normal_lpdf(regPars[j, ] | mu0[j, ],
multi_normal_lpdf(regPars[j, ] | mu1[j, ],

}
}

y ~ normal(alpha[id] + beta[id] .* time, sigma);

}

1 Like
#2

A well written question! I would however be skeptical about the possibility of finding a “best” or even “universally good” model for a problem by theoretical speculation. If I understand it correctly, you have already gathered the data? If so, my recommendation would be to run some posterior predictive (PP) checks for the model without mixture. If you don’t find any discrepancies in the PP checks, a more complex model will likely only overfit. If you do find discrepancies, those should motivate how to expand the model (i.e. how the mixture should behave).

A concrete example: you could use your model to predict the trajectories of all patients. Visualize the posterior and actual trajectories separately for each treatment (or for each patient). If fitted posterior trajectories show a narrow range of slopes, but the actual trajectories have a wide range of slopes and frequently go “outside” the posterior trajectories (or even better, if there are clusters of slopes) this might mean a mixture for the slopes is justified.

Hope that does make sense to you :-)

As for implementation there are likely some speedups to be had using multi_normal_cholesky and lkj_corr_cholesky (I believe the manual has some examples)

2 Likes
#3

Thank you for your suggestion, Martin! Your idea of using posterior predictive checks to evaluate if the mixture model is necessary sounds great, I haven’t thought about that. I want to compare the mixture to the simple(r ) model using LOO and cross-validation (mean square error of the prediction of a fourth point in time, not included in data to compute the posterior) but your idea sounds even more informative (checking if slopes cluster together, e.g.).

Actually, the data haven’t been collected yet. I am designing a pragmatic randomized trial but I want to make sure I understand the model I am proposing to evaluate it and also to use fake data to decide on the sample size.

P.S.: Indeed, using the Cholesky implementation of the multivariate normal speeds up the MCMC sampling. In case someone else wants to implement a similar model, my code for the multilevel mixture is currently (besides the cholesky implementation of the multi_normal, the first level measurements are accounted for in the log_mix function directly):

data {
int<lower=1> N;
int<lower=1> J;
vector[J] t;
vector[N] time;
vector[N] y;
int id[N];
int idx[J, 3];
}

parameters {
// Group model
real<lower=0, upper=1> theta;

// Intercept model
vector[2] muAlpha;
vector<lower=0>[2] sigmaAlpha;
vector[J] alpha;

ordered[2] muBeta;
ordered[2] tau;
vector<lower=0>[2] sigmaBeta;
vector[J] beta;

cholesky_factor_corr[2] Omega0;
cholesky_factor_corr[2] Omega1;

vector<lower=0>[2] sigma;
}

model {
theta ~ beta(5, 5);

muAlpha ~ normal(0, 10);
tau ~ normal(0, 10);
sigmaAlpha ~ lognormal(0, 0.3);

muBeta ~ normal(0, 10);
sigmaBeta ~ lognormal(0, 0.3);

sigma ~ student_t(5, 0, 3);

Omega0 ~ lkj_corr_cholesky(3);
Omega1 ~ lkj_corr_cholesky(3);

{
matrix[J, 2] regPars;
matrix[J, 2] mu0;
matrix[J, 2] mu1;
vector[2] sigma0;
vector[2] sigma1;

regPars[, 1] = alpha;
regPars[, 2] = beta;

mu0[, 1] = rep_vector(muAlpha[1], J);
mu0[, 2] = muBeta[1] + tau[2] * t;

mu1[, 1] = rep_vector(muAlpha[2], J);
mu1[, 2] = muBeta[2] + tau[1] * t;

sigma0[1] = sigmaAlpha[1];
sigma0[2] = sigmaBeta[1];

sigma1[1] = sigmaAlpha[2];
sigma1[2] = sigmaBeta[2];

for (j in 1:J) {
vector[3] sub_y;
vector[3] sub_time;

sub_y = y[idx[j,]];
sub_time = time[idx[j,]];
target += log_mix(theta,
multi_normal_cholesky_lpdf(regPars[j, ] | mu0[j, ],
diag_pre_multiply(sigma0, Omega0)) +
normal_lpdf(sub_y | alpha[j] + beta[j] * sub_time, sigma[1]),
multi_normal_cholesky_lpdf(regPars[j, ] | mu1[j, ],
diag_pre_multiply(sigma1, Omega1)) +
normal_lpdf(sub_y | alpha[j] + beta[j] * sub_time, sigma[2]));

}
}

//y ~ normal(alpha[id] + beta[id] .* time, sigma);

}

#4

Just to clear things up - if I understand it correctly, PP checks and LOO/CV/predicting further datapoints serve different purposes. With LOO / validation dataset you are evaluating prediction (which is a good thing if that’s your focus). LOO will explicitly consider the full distribution of your model, including tails etc. LOO is quantitative. On the other hand PP checks will inform you, if there are qualitative problems with your model. It is well possible to have a model that improves LOO but does not pass (some) PP checks and vice versa.

That’s great to hear, it sure is a good practice. What I would suggest is that you use both models and see how the required sample size changes and also to test your ability to distinguish between them. This could be by looking how LOO changes between the correct and wrong model of simulated data or to design a PP check that reliably shows problems when the simpler model is not good enough.

To be really safe, it might also make sense to write simulators for even more complex/different models (say varying intercept drawn from a heavy-tailed distribution or a mixture of more components than you fit or the response being skew-normal) and test how your two simple models fare against data generated from those other models to check for robustness.

Best of luck with the trial!

1 Like
#5

Martin, some feedback about your suggestions. They were really important to calibrate my expectations!

Following your suggestion for a PP check, I simulated data for the posterior predictive distribution of new subjects using the simple ( r ) multilevel model without the mixture component, considering some range of differences between between latent classes. Then, I computed the simple least-squares slope for each original subject and for the ‘new’ subjects in each simulated dataset. Below is a resulting graph for one set of latent class values:

The original data produces an obvious bimodal density, which can be evaluated by the (negative) excess kurtosis of the original data compared to the posterior predictive data based on the non-mixture model.

But if the difference between latent classes is small, the true model does not provide enough evidence to diferentiate between both models at least under sample sizes that are compatible with my resources.


text:
# Complex Integral

1. Oct 4, 2009

### owlpride

1. The problem statement, all variables and given/known data

Assume that f(z) is analytic and that f'(z) is continuous in a region that contains a closed curve $$\gamma$$. Show that
$$\int_\gamma \overline{f(z)} f'(z) dz$$

is purely imaginary.

2. Relevant equations

If f(z) is holomorphic on the region containing a closed curve $$\gamma$$ or if f(z) has a primitive (we have not yet established a relationship between these two properties), then

$$\int_\gamma f(z)dz = 0.$$

And while we did not prove that analytic functions are holomorphic, that's not hard to verify if necessary.

3. The attempt at a solution

If we let $$f(z) = u(z) + i v(z)$$, where u and v are functions from the complex plane to the real line, then

$$\int_\gamma \overline{f(z)} f'(z) dz = \int f(z) f'(z) dz - 2 i \int v(z) f'(z) dz = 0 - 2 i \int_\gamma v(z) f'(z)dz$$

So I have to verify that the latter integral is real valued, and this is where I am stuck. I could parametrize $$z = \gamma(t)$$ where $$t \in [0,1]$$ but I am not sure that helps me in any way.

$$- 2 i \int_\gamma v(z) f'(z)dz = -2 i \int_0^1 v(\gamma(t)) f'(\gamma(t)) \gamma'(t) dt = 2 i \int_0^1 v'(\gamma(t))f'(\gamma(t))\gamma'(t) \gamma'(t) dt$$

(The last step comes from integration by parts, with one term = 0 because gamma is a closed curve.)

Is there any reason to believe that this last integral is real-valued?

Last edited: Oct 4, 2009
2. Oct 4, 2009

### jbunniii

I am not sure what you did here.

If $f(z) = u(z) + iv(z)$, then $$\overline{f(z)} = u(z) - i v(z)$$ and f'(z) = u'(z) + i v'(z)[/tex], so \begin{align*}\int_{\gamma} \overline{f(z)} f'(z) dz &= \int_{\gamma} (u(z) - i v(z)) (u'(z) + i v'(z)) dz \\ &= \int_{\gamma} (u(z) u'(z) + v(z) v'(z)) dz +i \int_{\gamma} (u(z) v'(z) - v(z) u'(z)) dz \end{align*} All of [itex]u(z), $u'(z)$, $v(z)$, and $v'(z)$ are real, so if you can show that the first integral is zero then you're done.

3. Oct 5, 2009

### owlpride

But $$dz$$ is not real. Does that mess with the value of the last integral?


text:
# [plt-scheme] Pattern-matching macro chokes on conditional statement which would otherwise work.

 From: Gregory Cooper (greg at cs.brown.edu) Date: Sat Jan 19 14:28:04 EST 2008

```That's odd.  When I use the Macro Stepper, clicking "Next Term", "Next
Term", "Step" gets me to the following expression, which contains an
obvious error.  If you can't figure it out, then I'd recommend reading
up a bit before trying to write programs you don't understand.  Also,
showing some basic courtesy when addressing the mailing list would
probably evoke a more helpful and sympathetic response in the future.

(cond
((and (not (doublequoted-symbol? (quote one))) (symbol? (quote one)))
(let ((one (car '(1 2 3))))
(cond
((and (not (doublequoted-symbol? (quote 2))) (symbol? (quote 2)))
(let ((2 (car (cdr '(1 2 3)))))
(match (cdr (cdr '(1 2 3))) (three) (display three))))
((eqv? 2 (car (cdr '(1 2 3))))
(match (cdr (cdr '(1 2 3))) (three) (display three)))
(else #f))))
((eqv? one (car '(1 2 3)))
(match (cdr '(1 2 3)) (2 three) (display three)))
(else #f))

On Jan 19, 2008 1:10 PM, Ran Gutin <manicmessiah at gmail.com> wrote:
> Yup. Tried that too. It expands the code (which seems right at first), and
> before it can continue to reveal the wonders beneath it, it stops and
> replaces the expanded form with 'Error'.
>
> That's very nice indeed.
>
>
>
> On Jan 19, 2008 6:05 PM, Gregory Cooper <greg at cs.brown.edu> wrote:
> > Actually, though, since the error seems to arise during the expansion
> > of your macro, you'd probably find that the Macro Stepper is more
> > appropriate than the Debug button.  (The Debug button won't show you
> > what happens until after macro expansion is finished.)
> >
> >
> >
> >
> > On Jan 19, 2008 12:43 PM, Ran Gutin <manicmessiah at gmail.com> wrote:
> > > Wait. It seems that you're right.
> > > I'm running version 371. So I'll update now.
> > >
> > > :) Thanks. I'll update you in how things go.
> > >
> > >
> > >
> > > On Jan 19, 2008 3:57 PM, Gregory Cooper < greg at cs.brown.edu> wrote:
> > > > What version of DrScheme are you running?  There was a bug in the v371
> > > > debugger that would produce error messages like that, but it should
> > > > have been fixed in v372 (and in svn as of r7169 I think).
> > > >
> > > >
> > > >
> > > >
> > > > On Jan 19, 2008 10:28 AM, Ran Gutin < manicmessiah at gmail.com> wrote:
> > > > > (define (doublequoted-symbol? sym)
> > > > >   (and (pair? sym) (eqv? (car sym) 'quote)))
> > > > >
> > > > > (define-syntax match
> > > > >   (syntax-rules ()
> > > > >     ((match vars [pfirst prest ...] body ...)
> > > > >
> > > > >      (cond
> > > > >
> > > > >         ((and (not (doublequoted-symbol? (quote pfirst)))
> > > > >              (symbol? (quote pfirst)))
> > > > >         (let ((pfirst (car vars)))
> > > > >           (match (cdr vars) [prest ...] body ...)))
> > > > >
> > > > >        ((eqv? pfirst (car vars))
> > > > >         (match (cdr vars) [prest ...] body ...))
> > > > >
> > > > >        (else #f)))
> > > > >
> > > > >     ((match vars [] body ...) (begin body ...))))
> > > > >
> > > > > (match '(1 2 3) (one 2 three)
> > > > >   (display three))
> > > > >
> > > > >
> > > > >
> > > > > Sorry for not commenting on the code, but here's a basic idea of
> what it
> > > > > SHOULD do:
> > > > > (match '(1 2 3) (1 2 3) (display 3)) should match perfectly and
> display
> > > 3 on
> > > > > the terminal (it doesn't).
> > > > > (match '(1 2 3) (one two three) (display 3)) works perfectly, and
> prints
> > > 3.
> > > > > (match '(1 2 3) ('one 'two 'three) (display 'one)) - This should
> fail to
> > > > > match the pattern altogether, as symbols which are already quoted
> are
> > > > > matched for equality, rather than used as identifiers as above. This
> > > dies
> > > > > miserably without returning #f.
> > > > > (match '(1 2 3) (one 2 three) (display three)) - This should
> immediately
> > > > > create an alias for the values 1 and 3 ('one' and 'three) and match
> the
> > > > > second values for equality. Unfortunately, this is not the case.
> > > > >
> > > > >
> > > > >  (match '(1 2 3) (one 2 three)
> > > > >    (display three))
> > > > > ... gives the following error:
> > > > > "let: bad syntax (not an identifier) in: 2"
> > > > >
> > > > > It seems to be completely ignoring the conditional.
> > > > > So I performed a test:
> > > > > (and (not (doublequoted-symbol? (quote 2)))
> > > > >              (symbol? (quote 2)))
> > > > > ... actually returns FALSE. So then why is the conditional statement
> > > > > branching off completely wrong?
> > > > >
> > > > > And then, here's the real kill. I can't debug the damn thing.
> > > > >  Doing so sends an alert window flying in my face, and a larger one
> > > behind
> > > > > it.
> > > > >
> > > > > "rest: expected argument of type <non-empty list>; given ()
> > > > >
> > > > >  === context ===
> > > > > C:\Program Files\PLT\collects\mzlib\list.ss:295:2: rest
> > > > > C:\Program Files\PLT\collects\mztake\debug-tool.ss:804:10:
> can-step-out?
> > > > >
> > > > > rest: expected argument of type <non-empty list>; given ()
> > > > >
> > > > >  === context ===
> > > > > C:\Program Files\PLT\collects\mzlib\list.ss:295:2: rest
> > > > > C:\Program Files\PLT\collects\mztake\debug-tool.ss:804:10:
> can-step-out?
> > > > >
> > > > > rest: expected argument of type <non-empty list>; given ()
> > > > >
> > > > >  === context ===
> > > > > C:\Program Files\PLT\collects\mzlib\list.ss:295:2: rest
> > > > > C:\Program Files\PLT\collects\mztake\debug-tool.ss:804:10:
> can-step-out?
> > > > >
> > > > > rest: expected argument of type <non-empty list>; given ()
> > > > >
> > > > >  === context ===
> > > > > C:\Program Files\PLT\collects\mzlib\list.ss:295:2: rest
> > > > > C:\Program Files\PLT\collects\mztake\debug-tool.ss:804:10:
> can-step-out?
> > > > >
> > > > > rest: expected argument of type <non-empty list>; given ()
> > > > >
> > > > >  === context ===
> > > > > C:\Program Files\PLT\collects\mzlib\list.ss:295:2: rest
> > > > > C:\Program Files\PLT\collects\mztake\debug-tool.ss:804:10:
> can-step-out?
> > > > >
> > > > > rest: expected argument of type <non-empty list>; given ()
> > > > >
> > > > >  === context ===
> > > > > C:\Program Files\PLT\collects\mzlib\list.ss:295:2: rest
> > > > > C:\Program Files\PLT\collects\mztake\debug-tool.ss:804:10:
> can-step-out?
> > > > >
> > > > > rest: expected argument of type <non-empty list>; given ()
> > > > >
> > > > >  === context ===
> > > > > C:\Program Files\PLT\collects\mzlib\list.ss:295:2: rest
> > > > > C:\Program Files\PLT\collects\mztake\debug-tool.ss:804:10:
> > > can-step-out?"
> > > > >
> > > > > ^ Can someone tell me what the hell is going on?
> > > > >
> > > > > _________________________________________________


text: fourier superfunction ? - Printable Version +- Tetration Forum (https://math.eretrandre.org/tetrationforum) +-- Forum: Tetration and Related Topics (https://math.eretrandre.org/tetrationforum/forumdisplay.php?fid=1) +--- Forum: Mathematical and General Discussion (https://math.eretrandre.org/tetrationforum/forumdisplay.php?fid=3) +--- Thread: fourier superfunction ? (/showthread.php?tid=460) fourier superfunction ? - tommy1729 - 06/22/2010 the idea of slog(e^x) = slog(x) + 1 in terms of taylor series has been around for a while. i propose to consider f(e^x) = f(x) + exp(x). since exp(x) =/= 0 , f(e^x) =/= f(x). thus f has no "fixed point" of e^x. now instead of trying taylor on both sides of the equation , how about using fourier series on one side ? afterall we have a periodic function ! define f(0) = some real A with A as you wish ! (whatever makes the equations the easiest ) thus we could set the values of the fourier coefficients equal to those of the taylor series : keeping in mind that we have 'expressions' for n'th derivate ( taylor ) and fourier coefficients. ( in fourier ) f(exp(x)) - exp(x) = ( in taylor ) f(x). nth fourier coef = nth taylor coef. it follows that f(-oo) = f(0) ( and = A ) thus i would expand f(x) at x >= 0 and consider it valid only for real z >= 0. i guess A can be 0.... maybe this is related to kouznetsov and/or andrew slog ? it certainly seems to have similar properties at first sight ... not everything is totally clear to me though ... hoping to be correct ... regards tommy1729 RE: fourier superfunction ? - mike3 - 06/23/2010 $f(e^x)$ can be expressed as a Fourier series, but then how do you express the right hand side? If it's a Taylor series, you can't just equate coefficients, since what they're multiplying is different! E.g. $3e^{2x} \ne 3x^2$. Just because the coefficients are equal doesn't mean the terms are equal. Equating coefficients of the two distinct series types will not produce a solution of the equation. I don't see what you're trying to get at here... RE: fourier superfunction ? - tommy1729 - 06/23/2010 (06/23/2010, 01:20 AM)mike3 Wrote: $f(e^x)$ can be expressed as a Fourier series, but then how do you express the right hand side? If it's a Taylor series, you can't just equate coefficients, since what they're multiplying is different! E.g. $3e^{2x} \ne 3x^2$. Just because the coefficients are equal doesn't mean the terms are equal. Equating coefficients of the two distinct series types will not produce a solution of the equation. I don't see what you're trying to get at here... yes , but the thing is this : we compute the fourier coefficients with the taylor expression and the n'th derivate of the four series. this crossed self-reference might be solvable directly or recursively. regards tommy1729