text:
Oktober 2016

Kategorien-Filter ist aus: keine Filterung nach Kategorien.

### 04.10.2016 15:15 Dr. Christoph Lehrenfeld (Universität Münster) :Introduction to Geometrically Unfitted Finite Element MethodsMI 03.08.011 (Boltzmannstr. 3, 85748 Garching)

The course takes place on October 04 and October 05, 2016.

Many applications of simulation science involve complex and evolving geometries with possibly strong deformations during the evolution. In the context of finite element methods most often a “fitted” characterization is used where a parametric description in terms of a computational mesh is available. An alternative approach is based on the idea of separating the computational mesh and the geometry description, resulting in geometrically “unfitted” methods, which allow for a very flexible handling of geometries. On a (typically simple) background mesh a basis discretization is defined. Only afterwards, according to the separately defined geometry this discretization is adapted to the geometrical information. This approach allows to handle complex and possibly time-dependent geometries without the need for complex and time consuming mesh generation or remeshing. In the recent years finite element methods based on this methodology, geometrically unfitted finite element methods, have drawn more and more attention. Despite its advantages unfitted discretizations, often also called cut-cell methods, give rise to new problems. Finite element spaces that are usually directly linked to the underlying mesh have to be adapted to account for the separated geometry description. As a consequence important properties such as the stability of bases, conditioning of matrices, the implementation of accurate numerical integration, stable time discretization or the imposition of boundary and interface conditions have to be re-established. This is often much harder to accomplish compared to fitted finite element methods and requires new techniques and ideas. We present a class of geometrically unfitted finite element methods, apply them to different PDE problems and present the key techniques to obtain (high order) accurate numerical approximations, optimal order error bounds and robust implementations.

More details you can find on http://igdk1754.ma.tum.de/IGDK1754/CCLehrenfeld2016

### 05.10.2016 16:00 Prof. Dr. Thomas Surowiec (HU Berlin) :Risk-Averse PDE-Constrained Optimization using Risk MeasuresMI 02.06.011 (Boltzmannstr. 3, 85748 Garching)

In order to effectively model uncertainty or ambiguity in engineering and the natural sciences one typically considers partial differential equations (PDEs) with uncertain or distributed parameters. Passing from modeling and simulation to optimization, we arrive at stochastic optimization problems with PDE-constraints. This relatively new area requires a number of extensions from the classical stochastic optimization literature due to the infinite dimensional nature of the deterministic decision variables. This includes, e.g., well-posedness questions, derivation of optimality conditions, handling state constraints, and developing viable numerical methods. On the other hand, the uncertainty requires us to employ or extend concepts from risk management to assure risk-averse or robust decisions are met. In our work, we do this by using risk measures, e.g., conditional value-at-risk or mean plus upper-semideviation. Since these functionals are typically non-smooth, we suggest several smoothing techniques in order to make use of existing algorithms from PDE-constrained optimization. After motivating the model class, we discuss appropriate conditions on the objective functionals and derive first-order optimality conditions. We then demonstrate the effect of various risk-measures on the optimal solution via numerical experiments.

### 12.10.2016 09:00 S. Buhl, R. Davis, J. Einmahl, S. Engelke, N. Gissibl, P. Green, A. Hitz, S. Lauritzen, P. Naveau, J. Peters, B. Schölkopf, J. Segers, D. Straub, B. Sturmfels, H. Rootzén, A. Roverato, C. Uhler, N. Wermuth, P. Zwiernik:Conference on "Conditional Independence Structures and Extremes"H.E. 009 (Leibniz-Rechenzentrum der Bayerischen Akademie der Wissenschaften (LRZ), Boltzmannstr. 1, 85748 Garching)

The scientific topics include graphical models, networks and extremes. One aim of the conference is to celebrate the Carl Friedrich von Siemens Prize of the Alexander von Humboldt Foundation awarded to Steffen Lauritzen from University of Copenhagen.

www.statistics.ma.tum.de/CISE2016

### 13.10.2016 09:00 S. Buhl, R. Davis, J. Einmahl, S. Engelke, N. Gissibl, P. Green, A. Hitz, S. Lauritzen, P. Naveau, J. Peters, B. Schölkopf, J. Segers, D. Straub, B. Sturmfels, H. Rootzén, A. Roverato, C. Uhler, N. Wermuth, P. Zwiernik:Conference on "Conditional Independence Structures and Extremes"H.E. 009 (Leibniz-Rechenzentrum der Bayerischen Akademie der Wissenschaften (LRZ), Boltzmannstr. 1, 85748 Garching)

The scientific topics include graphical models, networks and extremes. One aim of the conference is to celebrate the Carl Friedrich von Siemens Prize of the Alexander von Humboldt Foundation awarded to Steffen Lauritzen from University of Copenhagen.

www.statistics.ma.tum.de/CISE2016

### 13.10.2016 17:00 Patrick Mehlitz (TU Bergakademie Freiberg):Bilevel Optimal Control - An IntroductionGebäuse 33, Raum 0131 (Werner-Heisenberg-Weg 39, 85577 Neubiberg)

Hierarchical optimization problems with two decision levels where at least one decision maker has to solve an optimal control problem are called bilevel optimal control problems. This class of optimization models suffers from nonconvexity, nondifferentiability, and an inherent lack of regularity. Thus, the derivation of existence results and optimality conditions for such problems is a challenging task. On the other hand, these problems frequently appear when dealing with parameter estimation or optimal control models whose feasible sets depend implicitly on another optimized system. In this talk, we start to motivate the consideration of bilevel optimal control problems by means of several examples. Afterwards, we present two different strategies which can be used to transform the original bilevel optimal control problem into a single-level surrogate model using lower level optimality conditions or the lower level optimal value function. We point out several puzzling difficulties arising from the bilevel structure and the function space setting. Finally, we present constraint qualifications and necessary optimality conditions for certain instances of bilevel optimal control problems. Parts of the talk are based on joint works with Francisco Benita and Gerd Wachsmuth, respectively.

### 14.10.2016 09:00 S. Buhl, R. Davis, J. Einmahl, S. Engelke, N. Gissibl, P. Green, A. Hitz, S. Lauritzen, P. Naveau, J. Peters, B. Schölkopf, J. Segers, D. Straub, B. Sturmfels, H. Rootzén, A. Roverato, C. Uhler, N. Wermuth, P. Zwiernik:Conference on "Conditional Independence Structures and Extremes"H.E. 009 (Leibniz-Rechenzentrum der Bayerischen Akademie der Wissenschaften (LRZ), Boltzmannstr. 1, 85748 Garching)

The scientific topics include graphical models, networks and extremes. One aim of the conference is to celebrate the Carl Friedrich von Siemens Prize of the Alexander von Humboldt Foundation awarded to Steffen Lauritzen from University of Copenhagen.

www.statistics.ma.tum.de/CISE2016

### 17.10.2016 16:15 Maximilian Engel M.Sc. (Imperial College London):Bifurcation analysis of stochastically driven limit cyclesMI 03.06.011 (Boltzmannstr. 3, 85748 Garching)

We investigate bifurcations from an attractive random equilibrium to shear-induced chaos for stochastically driven limit cycles, indicated by a change of sign of the first Lyapunov exponent. This addresses an open problem posed by Lai-Sang Young and co-workers, extending results on periodically kicked limit cycles to the stochastic context. We also apply concepts from ergodic theory, like entropy and the SRB property of the invariant random measure, to describe the random attractors in the chaotic case.

### 17.10.2016 16:30 Simon Reisser :Rumor spreading algorithms on expander graphsB 252 (Theresienstr. 39, 80333 München)

In this thesis three popular and well-studied randomized rumor spreading algorithms are studied, the push, pull and push\&pull model. Initially, some vertex owns a rumor and it is passed to one of its neighbours in a way depending on the rumor spreading algorithm. For the push algorithm every vertex that knows the rumor passes it to a random neighbour. For the pull algorithm every uninformed vertex ask the rumor from a random neighbour. The push\&pull algorithm is a combination of both, every vertex either asks or passes the information. This spreading is repeated until every vertex knows the rumor. The main question is how many rounds does it take on a given graphs until all vertices are informed. Here the asymptotic (random) broadcast time for these algorithms on expander graphs, which are almost regular and have small spectral expansion, is studied. The time for the push model was already shown to be $\log_2 n + \log n +o(\log n)$, which is asymptotically the same time it takes on the complete graph. The main result of this thesis is that for the pull and the push\&pull algorithm the same holds, i.e. the asymptotic runtime on expander graphs coincides with the runtime on the complete graph. For the pull model the runtime is $\log_2 n +o(\log n)$ and for the push\&pull model it is $\log_3 n+o(\log n)$.

### 18.10.2016 10:30 Michael Sandbichler:Sequential Analysis Operator LearningMI 02.10.011 (Boltzmannstr. 3, 85748 Garching)

Efficient data representation is a core aspect of modern signal processing, for example sparsity of data has been very efficiently used in compressed sensing in order to improve the required minimal number of measurements. We will look at a 'dual' version of sparsity, namely Analysis cosparsity and provide new sequential algorithms to find Analysis Operators which sparsify a given class of signals.

### 20.10.2016 16:30 Bernhard Hanke:The space of positive scalar curvature metricsA 027 (Theresienstr. 39, 80333 München)

The construction and classification of Riemannian metrics satisfying certain curvature bounds are of fundamental interest in differential geometry. In this talk we specialize to metrics of positive scalar curvature, which are characterized by a simple volume growth condition of balls with small radii. Research during the last couple of years, based on a variety of methods, revealed the topological complexity of the space of all such metrics on a fixed manifold. We will give an overview of this development.

### 24.10.2016 16:15 Dr. Gero Schnücke (Universität Würzburg):An Arbitrary Lagrangian-Eulerian Discontinuous Galerkin method for conservation lawsMI 03.06.011 (Boltzmannstr. 3, 85748 Garching)

Two specifications are commonly used to describe the motion of a fluid in computational fluid dynamics. The Lagrangian specification based on grid generating points which are moving with the particles in a fluid. This approach allows the preservation of specific motion related properties of a physical model like the Galilei invariance. Nevertheless, the Lagrangian specification often leads to a distorted computational mesh, since the mesh moves with respect to the fluid. These distortions are the source of numerical artifacts which destabilize the scheme. Distortions are not an issue in the Eulerian specification, since this approach based on a static mesh. However, this approach is too stiff to maintain specific motion related properties of a physical model. The arbitrary Lagrangian-Eulerian (ALE) approach locally allows the description of the fluid motion by the Lagrangian or Eulerian specification. Hence, in some sense, the ALE approach is a kind of compromise between the Lagrangian and Eulerian specification which allows to exploit the advantages of both specifications.

We adopted the ALE approach to develop and analyze a moving mesh discontinuous Galerkin method for one dimensional nonlinear conservation laws in [1]. This method based on the "'method of lines approach'". For the spatial discretization a discontinuous Galerkin method with a time-dependent test function space is used. For the time integration the total variation diminishing Runge-Kutta methods are used.

In this talk, in the context of scalar conservation laws, certain mathematical aspects of the ALE-DG method will be presented. In particular a local maximum principle and the entropy stability will be discussed. Afterward, the capability of the method to handle singularities will be shown by one dimensional numerical experiments for the Burgers' and Euler equations. Furthermore, we present accuracy tests for the one and two dimensional Euler equations.

(Collaborators: Christian Klingenberg (University of Würzburg) and Yinhua Xia (University of Science and Technology of China).

[1] Klingenberg C., Schnücke G. and Xia Y., Arbitrary Lagrangian-Eulerian discontinuous Galerkin method for conservation laws: analysis and application in one dimension, Math. Comp. (June20, 2016), available via DIALOG: http://dx.doi.org/10.1090/mcom/3126.

### 24.10.2016 16:30 Stein Andreas Bethuelsen (TUM):Stochastic domination in space-time for the contact process2.01.10 (Parkring 11, 85748 Garching-Hochbrück)

The contact process is a classical interacting particle system. Liggett and Steif (2006) proved that, for the supercritical contact process on certain graphs, the upper invariant measure stochastically dominates an i.i.d. Bernoulli product measure. In particular, they proved this for Z^d and (for infection rate sufficiently large) d-ary homogeneous trees T_d. In this talk we will discuss some space-time versions of their results. In particular, we ask the question whether the contact process may dominate an independent spin-flip process. The answer to this question seems to depend on properties of the graph. We first show that it is not possible if the graph is amenable. On the other hand, we prove some results indicating that it is indeed the case for the contact process on T_d. This talk is based on joint work with Rob van den Berg (CWI and VU Amsterdam).

### 25.10.2016 10:30 Matthias Wissel (TUM):A Data Driven Prognostic Model for the Availability of ParkingMI 02.10.011 (Boltzmannstr. 3, 85748 Garching)

We will propose a time-dependent nonhomogeneous Markov model for predicting free parking spaces in urban areas. We therefore will describe the formalized general setting that reflects the real world environment we work in when concerned with parking prediction. Also, issues concerning the matter of availability of the right kind of data will be addressed. Then, the parameter estimation based on a given data set will be of particular interest. To this end, an extended framework of empirical risk minimization for matrix-valued functions and the use of matrix-valued reproducing kernel Hilbert spaces to approximate the time-dependent generator of the Markov process will be introduced. Finally, we want to give an outlook on further research possibilities in this field with a focus on a purely data driven approach.

### 26.10.2016 14:30 Prof. Steffen Lauritzen, Humboldt Prize Awardee (University of Copenhagen):Fakultätskolloquium: Multivariate total positivity, Simpson's paradox, and the structure of M-matrices MI 02.08.011 (Boltzmannstr. 3, 85748 Garching)

Title: Multivariate total positivity, Simpson's paradox, and the structure of M-matrices

Simpson's paradox is describing the phenomenon that two quantities can be positively associated in a population, but negatively associated within subpopulations. This can imply quite misleading interpretation of statistical information and it is therefore important to identify situations where this cannot happen. When a distribution is multivariate totally positive of order two (MTP2) this cannot happen. The MTP2 property is closed under marginalization, conditioning, and increasing transformations and has a number of other stability properties. In addition, it has fundamental implications for conditional independence relations. A multivariate Gaussian distribution is MTP2 if and only if its covariance matrix is an inverse M-matrix, i.e.\ if all off-diagonal elements of the concentration matrix (inverse covariance matrix) are non-positive. For other types of distributions, other conditions apply.

In the talk I shall give examples of Simpson's paradox, explain the basic properties associated with the MTP2 condition, give examples of MTP2 distributions and characterize these in a number of special cases. I shall also indicate some of the fundamental consequences that this property implies for conditional independence structures.

see www.ma.tum.de/Mathematik/FakultaetsKolloquium

### 26.10.2016 16:00 Prof. Dr. Klaus Nehring (UC Davis):Weighing Experts, Weighing Sources: The Diversity ValueMI 01.10.033 (Boltzmannstr. 3, 85748 Garching)

In aggregating the judgments (subjective probabilities, preference rankings etc) of different information sources, one often needs to assign weights to each source. Intuitively, these weights should reflect the quality of individual sources and their (dis)similarity, as judged by the decision maker. Formally, such judgments are captured by a non-additive set functions that characterizes sets of sources in terms of their “joint reliability” or “valued diversity”. The main contribution of the paper is to propose and axiomatically justify a particular weighting rule, the Diversity Value. The Diversity Value is defined by a logarithmic scoring criterion and can be characterized as a weighted Shapley value in which source weights are determined endogenously.

Bio: Prof. Dr. Klaus Nehring is a Professor of Economics at the University of California, Davis, since 1998. He received his Ph.D. in economics at Harvard University in 1991 and held visiting positions at the London School of Economics and Princeton University. His current research focuses on “Temptation and Self-Control”, “Decision-Making under Ambiguity”, “Judgment Aggregation in Social Choice”, “Abstract Convexity Theory” and “A Theory of Diversity”. Prof. Nehring has published his work in leading economics journals such as Econometrica, the Journal of Economic Theory, and Games and Economic Behavior.

### 27.10.2016 16:30 Roman Sauer:"Counting negatively curved manifolds"A 027 (Theresienstr. 39, 80333 München)

In joint work with Tsachik Gelander and Uri Bader we ask the following questions about negatively curved manifolds whose volume is below a given number V>0: How many are there? Is the size of their homology universally bounded in terms of V? We answer these questions by developing a kind of simplicial thick-thin decomposition.

### 27.10.2016 19:00 Prof. Dr. Günter M. Ziegler (FU Berlin):Beweise, Fehler und ein SchinkenbrotFürstensaal (Ludwigstraße 16, 80539 München)

Woher kommt der Fortschritt in der Mathematik? Setzt sich da jemand an den Schreibtisch, schreibt viele komplizierte Formeln auf, hat einen Geistesblitz, ruft „Heureka – ich hab‘s!”, und dann stimmt das bis in alle Ewigkeit?

Tatsächlich kommt so etwas vor, aber der Alltag der mathematischen Forschung ist deutlich vielfältiger und interessanter! Professor Günter M. Ziegler hinterfragt in seinem Vortrag die viel beschworene „absolute Sicherheit“ von mathematischen Beweisen. Seine Überzeugung: Das Fehler-Machen gehört zur Mathematik, und es gibt keine Kreativität und keine Ideen ohne Fehler. Um dies zu verdeutlichen, wird er eine kleine Kulturgeschichte der mathematischen Fehler skizzieren, von Euklid bis in die heutige Forschung. Und was hat das alles mit einem Schinkenbrot zu tun? Ziegler wird es aufklären und erzählen, wie Mathematikerinnen und Mathematiker um die Ergebnisse ringen, die dann wirklich für immer gelten und nicht nur bis zur nächsten Mahlzeit.

Veranstalter: Deutsche Forschungsgemeinschaft (DFG) Ort: Bayerische Staatsbibliothek, Fürstensaal (1. OG) Anmeldung erforderlich unter veranstaltungen@bsb-muenchen.de oder Tel. +49 89 28638-2115 Eintritt frei


text:
### 0248

Highly Undersampled Kooshball Reconstruction with Low-rank Modeling and Sparsity Constraints for High-resolution T1 Mapping
Haikun Qi1, Huiyu Qiao1, Aiqi Sun1, Shuo Chen1, Xihai Zhao1, Rui Li1, Chun Yuan1,2, and Huijun Chen1

1Department of Biomedical Engineering, School of Medicine, Tsinghua University, Beijing, China, 2Department of Radiology, University of Washington, Seattle, WA, United States

### Synopsis

Highly undersampled 3D radial is very useful for 3D imaging acceleration, and compressed sensing and low-rank can be used for reconstruction of the undersampled kooshball data. In this study, we propose a novel reconstruction method for fast 3D T1 mapping of carotid artery using 3D radial sampling. The reconstruction method is based on low-rank modeling with parallel imaging and sparsity constraints, and is potential to improve the accuracy and precision of T1 estimation. The aim of this study is to evaluate the effectiveness of the proposed method using phantom and in vivo imaging experiments on volunteers and carotid atherosclerosis patients.

### Introduction

A fast 3D T1 mapping sequence for carotid artery, GOAL-SNAP, has recently been proposed, using inversion recovery (IR) prepared 3D golden angle radial (kooshball) sampling (1). Because of the short scan time (5min), the k-space data to reconstruct the image series along the IR curve is highly undersampled. And in the previous study, we’ve used the KWIC method to increase the reconstructed SNR, which, however, may introduce contrast mixture and influence the T1 estimation accuracy (2,3). The image series along the IR curve are well suited for low-rank and compressed sensing (CS) reconstructions, which have been used to enable reconstruction of dynamic image series from undersampled data (4,5). But the utility of low-rank and CS constraints on undersampled kooshball data hasn’t been widely investigated. In this study, we aimed to propose a more advanced reconstruction method for the highly undersampled kooshball data from GOAL-SNAP using low-rank modeling and sparsity constraint (LRS) to reduce undersampling artifacts.

### Methods

Theory: The GOAL-SNAP sequence is IR prepared, followed by 3D radial sampling (Fig. 1) (1), with imaging parameters shown in Table 1. To generate images along the IR curve, sliding window reconstruction was performed with temporal width=19 (190ms/frame), resulting in 9 frames for T1 fitting. Here, we proposed a low-rank model with parallel imaging and sparsity constraint method for the kooshball data reconstruction. Specifically, the image series along the IR curve can be represented by a Casorati matrix:

$\color{black} {P}= \begin {bmatrix}\rho(r_{1},TI_{1}) & ... &\rho(r_{1},TI_{M})\\⋮ & ⋱ &⋮\\\rho(r_{N},TI_{1}) & ... &\rho(r_{N},TI_{M})\end{bmatrix}$ [1]

As there is strong temporal and spatial correlation among the image at different TIs, the low-rank structure was enforced using an explicit rank constraint by setting $rank(\color{black} {P})\leq L$. The matrix factorization was peformed: $\color{black} {P=UV}$, where columns of $\color{black} {U }(N×L)$ and rows of $\color{black} {V }(L×M)$ span the spatial and temporal subspace of $\color{black} {P}$. Using the central k-space region satisfying Nyquist rule as training data, the temporal subspace can be pre-estimated using principal component analysis. Then, the reconstruction problem can be formulated as:

$\color{black} {\color{black} {\color{black} { \widehat{U}}=arg min(||d-F_{nu} S(UV)||_2^2} +λ\cdot||TV(UV)}||_1)$ [2]

where $\color{black} {d}$ is the measured multi-coil k-space data, $\color{black} {F_{nu}}$ is the NUFFT operator, $\color{black} {S}$ denotes the sensitivity maps, $\lambda$ is the regularization parameter and TV is the spatial total-variation operator. With the estimated $\color{black} {\widehat{U}}$ from Eq. [2], the Casorati matrix can be reconstructed by $\color{black} {\widehat{P}}=\color{black} {\widehat{U}V}$, from which the image series can be obtained for T1 fitting. In this study, L was set to be 4 and $\lambda$ was selected empirically. MR imaging: All imaging was performed on a 3T MR scanner (Philips, Achieva). First, phantoms of different T1 values were imaged to evaluate whether the proposed reconstruction method can improve the accuracy and precision of the T1 estimation compared with the reconstruction by CG-SENSE (6). The conventional 2D IR-SE was performed as gold standard. Then, the proposed reconstruction was evaluated using in vivo data of carotid artery. Four healthy volunteers and 2 carotid atherosclerosis patients with IPH were imaged using an 8-channel carotid coil after institutional review board approval. The reconstructed image quality and the estimated T1 map were compared between reconstructions by the proposed LRS and CG-SENSE

### Results

The T1 values estimated by LRS showed smaller standard deviation (SD) than CG-SENSE (Fig. 2a). The mean coefficient of variation (CV) of the 13 phantoms were 4.9% and 2.8% for CG-SENSE and LRS, respectively. A higher correlation with 2D IR-SE was observed for LRS (Fig. 2b). And the measurement bias by LRS was lower than CG-SENSE (7.0%±3.4% vs. 10.8%±3.8%). Fig. 3 shows images of a volunteer at 3 representative TIs, as well as the resulting T1 maps. The LRS had less noise in the reconstructed images and lower variations in the T1 map compared with CG-SENSE. Similar results were observed for the patients, and representative images of a plaque with IPH are shown in Fig. 4. The IPH was detected by strong hyperintensities on SNAP (7), and the IPH region showed decreased T1 values on the T1 maps (Fig. 4b,c).

### Discussion and Conclusions

A novel low-rank modeling and sparsity constrained reconstruction method was introduced for the fast 3D T1 mapping of carotid artery. The proposed method enables reconstruction of images along the IR curve with good quality from highly undersampled 3D radial data for T1 fitting. Its effectiveness has been demonstrated with phantom and in vivo experiments. It’s expected to improve the T1 estimation accuracy and precision of GOAL-SNAP. Although not addressed here, the proposed LRS method may also be applicable to other 3D dynamic imaging using highly undersampled 3D radial acquisition. And its utility should be fully explored in future studies.

### Acknowledgements

No acknowledgement found.

### References

1. Qi H, Sun J, Qiao H, Chen S, Zhou Z, Pan X, Wang Y, Zhao X, Li R, Yuan C, Chen H. Carotid Intraplaque Hemorrhage Imaging with Quantitative Vessel Wall T1 Mapping: Technical Development and Initial Experience. Radiology 2017;(Accepted).

2. Song HK, Dougherty L. k-space weighted image contrast (KWIC) for contrast manipulation in projection reconstruction MRI. Magn Reson Med 2000;44(6):825-832.

3. Neumann D, Breuer FA, Volker M, Brandt T, Griswold MA, Jakob PM, Blaimer M. Reducing Contrast Contamination in Radial Turbo-Spin-Echo Acquisitions by Combining a Narrow-Band KWIC Filter with Parallel Imaging. Magn Reson Med 2014;72(6):1680-1686.

4. Zhao B, Haldar JP, Christodoulou AG, Liang ZP. Image Reconstruction From Highly Undersampled (k, t)-Space Data With Joint Partial Separability and Sparsity Constraints. Ieee T Med Imaging 2012;31(9):1809-1820.

5. Sun A, Zhao B, Li Y, He Q, Li R, Yuan C. Real-time phase-contrast flow cardiovascular magnetic resonance with low-rank modeling and parallel imaging. Journal of cardiovascular magnetic resonance : official journal of the Society for Cardiovascular Magnetic Resonance 2017;19(1):19.

6. Pruessmann KP, Weiger M, Bornert P, Boesiger P. Advances in sensitivity encoding with arbitrary k-space trajectories. Magn Reson Med 2001;46(4):638-651.

7. Wang JN, Bornert P, Zhao HL, Hippe DS, Zhao XH, Balu N, Ferguson MS, Hatsukami TS, Xu JR, Yuan C, Kerwin WS. Simultaneous noncontrast angiography and intraPlaque hemorrhage (SNAP) imaging for carotid atherosclerotic disease evaluation. Magn Reson Med 2013;69(2):337-345.

### Figures

FIG. 1. The schematic diagram of GOAL-SNAP, which is inversion recovery prepared, followed by 3D golden angle radial sampling.

FIG. 2. a: The measured T1 values of phantoms shown as meanSD by GOAL-SNAP using reconstructions by CG-SENSE and LRS. b: Regression analysis of T1 measurements by GOAL-SNAP: blue dots for CG-SENSE; red dots for LRS. The red and blue lines indicate the linear regression lines and the black line represents y=x.

FIG. 3. T1 mapping results of a healthy volunteer by GOAL-SNAP. The three selected images along the IR curve at TI of 480, 670 and 1050ms reconstructed using LRS (a) and CG-SENSE (b), and the resulting T1 maps are shown for comparison.

FIG. 4. T1 mapping results of one atherosclerotic plaque with IPH. The red arrow indicates the IPH region which was identified on the SNAP image (a). The three selected images at TI of 480, 670 and 1050ms reconstructed using LRS (b) and CG-SENSE (c), and the resulting T1 maps are shown for comparison.

Table 1: Imaging parameters of GOAL-SNAP

Proc. Intl. Soc. Mag. Reson. Med. 26 (2018)
0248

format: plain


text:
# a mathtext bug?

Hi,

I am trying to use mathtex expression for Molecule descriptions(in the legend)

[in matplotlib-0.70.1 tkagg backend]

The following mathtext expression throws an exception in the parser.

plot(range(10))
title(r'$^{12}\rm{CO}$') # a CO molecule

The following doesn't plot the superscript part of the mathtext in the legend:
r'$\rm{CO}^{2}$

whereas this one does:

r'$CO^{2}$'

Can anyone reproduce this.

PS: Excellent plotting package! No greater pleasure than giving pgplot the
boot and replace it with something "modern".

PPS: I think this ahs come up on the mailing list earlier, but I can't quite
remember. Is it possible to tune "subplot" to do ganged plotting as in the
example script without the overhead?

Cheers,
Malte.


text:
## Is Python Slow?

Python is a programming language that I learnt somewhat recently (something like 2, 3 years ago) and that I like very much. It is simple, to the point, and has several functional-like constructs that I am already familiar with. But Python is slow compared to other programming languages. But it was unclear to me just how slow Python was compared to other languages. It just felt slow.

So I have decided to investigate by comparing the implementation of a simple, compute-bound problem, the eight queens puzzle generalized to any board dimensions. This puzzle is most easily solved using, as Dijkstra did, a depth-first backtracking program, using bitmaps to test rapidly whether or not a square is free of attack1. I implemented the same program in C++, Python, and Bash, and got help from friends for the C# and Java versions2. I then compared the resulting speeds.

The eight queens puzzle consist in finding a way to place 8 queens on a 8×8 chessboard so that none of the queen checks another queen. By “checking”, we mean that if the other queen was of the opposing camp, you could capture it if it were your turn to play. So this means that no queen is on the same row, column, or diagonal as another queen. Using a real chessboard and pawns in lieu of queens, you can easily find a solution in a few seconds. Now, to make things more interesting, we might be interested in enumerating all solutions (and, for the time being, neglecting to check if a solution is a rotated or mirrored version of another solution).

The basic algorithm to solve the Eight queens puzzle is a relatively simple recursive algorithm. First, we place a queen somewhere on the first row and we mark the row it occupies as menaced. We also do so with the column and two diagonals. We then try to place a second queen somewhere on the second row, on a square that is menace-free, and mark the row, column, and diagonals of the new queen as menaced. And we proceed in the same fashion for other queens. But suppose that at the $n$th stage, we cannot find a menace-free square, preventing us from placing the $n$th queen. If the situation arises, we give up for the $n$th queen and backtrack to the $(n-1)$th queen. We try a new (and never tried before) location for the $(n-1)$th queen and we go forth trying to place the $n$th queen. If may happen that we go all the way back to the $(n-k)$th queen because there are no other solutions for the $(n-1)$th queen, which asks for the $(n-2)$th queen to be moved, which can also result in a dead-end; and so forth all the way down to the $(n-k)$th queen.

Because the algorithm proceeds depth-first and can rear back quite a bit in looking for new solutions, it is called a backtracking algorithm. Backtracking algorithms are key to many artificial intelligence systems like, well, chess programs.

So I wrote the program for the $n$ queens puzzle for a $n\times{}n$ board in C quite sometime ago (circa 1995), then I ported to C++ recently (2006). And just for kicks, I decided to port it to different languages, with help from friends for Java and C# (of which I know about zilch). The C++ versions consist in a generic version that accepts the board size as a command-line argument and in a constant-propagated version where the board size is determined at compile-time. The Python versions, as there are two of them also, differ on how python-esque they are. The first variant is a rather literal translation of the C++ program. The second uses pythonesque idioms such as sets rather than bitmaps and turns out to be quite a bit faster—about 40% faster in fact. The Bash version is necessarily rather bash-esque as Bash does not offer anything much more sophisticated than arrays in terms of data structures.

All implementations were compiled with all optimizations enabled (-O3, inlining, interprocedural optimizations, etc.). For C++, I used g++ 4.2.4, for C#, gmcs 1.2.6.0, for Java, gcj 4.2.4, Python 2.6.2, and, finally, Bash 3.2.39—all latest versions for Ubuntu 8.04 LTS, which doesn’t means that they’re the really latest versions.

So I ran all seven implementations with boards sizes ranging from 1 to 15 on a AMD64 4000+ CPU (the numbers are arbitrary; I wanted to get good data but also limit the CPU time spent as the time increases factorially in board size!). At first, the results are not very informative:

Results, Time, Linear Scale

As expected, all times shoot up quite fast, with, unsurprisingly, BASH shooting up faster, followed by the two Python implementations. At this scale, Java, C#, C++, C++-fixed (the constant-propagated version) all seems to be more or less similar. To remove the factorial growth (as even with a log plot the data remains rather unclear), I scaled all performances relative to the C++ version. The C++ version is therefore 1.0 regardless of actual run-time; for board size $n$, the time needed by Bash, for example, was divided by the time needed by C++ for board size $n$. We now get:

Speed Ratio, Linear Scale

We can use a log-scale for the $y$ axis to better separate the similar results:

Speed Ratio, Log Scale

We see three very strange things. The first is Bash shooting up wildly. The second is that C# relative time goes down with the increasing board size. The third is that before $n=8$, the results are fluctuating. The first is easily explained: Bash is incredibly slow. About 10,000 times as slow as the optimized compiled C++ version. It is so slow that the two last data points are estimated as it would have taken an extra week, or so, to get them. The second anomaly needs a bit more analysis. Looking at the raw timing data, we can see that the C# version seems to be needing an extra 7ms regardless of board size. I do not know where that comes from, as the timings do not time things such as program load and initialization, but only the solving of the puzzle itself. It may well be the JIT that takes a while to figure out that the recursive function is expensive and the run-time compilation takes 7ms? Anyway, would we remove this mysterious extra 7ms, the odd behaviour of the C# implementation would vanish. The third anomaly is easily explained by the granularity of the timer and the operating system; up to puzzle size of 8, the times are much less than 100 μs for most implementations. Suffice to move the mouse and generate a couple of interrupts to throw timing off considerably.

Removing the small board sizes yields:

Speed Ratios, Log Scale, Without Outliers

which shows that the respective implementations are well behaved (except for C# and its most probably JIT-related extra 7ms).

So we see that Bash is about 10,000 times slower than the optimized C++ version. The constant-propagated version is only a bit (~5%) faster than the generic C++ version. The Java version takes about 1.5× the time of the C++ version, which is way better than I expected—don’t forget that this is a native-code version of the Java program, it doesn’t run on the JVM. The C# version is twice as slow as the C++ version, which is somewhat disappointing but not terribly so. The Python versions are 120× (for the more pythonesque version) and 200× slower. That’s unacceptably slow, especially that the Python programs aren’t particularly fancy nor complex. We do see that using pythonesque idioms yields a nice performance improvement—40%—but that’s still nowhere useful.

*
* *

So what does this tell us? For one thing, that Bash is slow. But that Bash is slow even when it doesn’t use any external command should not come as a surprise. From what I understand from Bash, data structures are limited to strings and arrays. Lists and strings are the same. Basically, a list is merely a string with items separated by the IFS character(s), which causes all array-like accesses to lists to be performed in linear time as each time the string is reinterpreted given the current IFS. So even though a construct such as ${x[i]} looks like random-access, it is not. As for explicitly constructed arrays (as opposed to lists), there seems to be a real random-access capability, but it’s still very slow. I do not think that bash uses something like a virtual machine and an internal tokenizer to speed up script interpretation. Maybe that’d be something to put on the to-do list for Bash 5? In any case, I also learnt that Bash is a lot more generic than I thought. The other thing is that Python is not a programming language for compute-bound problems. This makes me question how far projects such as Pygame (which aims at developing a cromulent gaming framework for Python) can go. While all of the graphics and sound processing can be off-loaded to third party libraries written in C or assembly language and interacting with the platform-specific drivers, the central problem of driving the game itself remains complete. How do you provide strong non-player characters/opponents when everything is 100× slower than the equivalent C or C++ program? What about strategy games? How can you build a MMORPG with a Python engine? Is a MMORPG I/O or compute bound? Could you write a championship-grade chess engine in Python? My guess is that you just can’t. And that’s quite sad because I like Python as a programming language. I used it in a number of (I/O-bound) mini-projects and I was each time delighted with the ease of coding compared to C or C++ (for those specific tasks). It pains me that Python is just too slow to be of any use whatsoever in scientific/high-performance computing. I wish for Python 4 to have a new virtual machine and interpreter to bring Python back with Java and C#, performance-wise. Better yet, why not have a true native compiler like gcj for Python? * * * I am fully aware that the $n$ queens on a $n\times{}n$ board puzzle is a toy problem of sorts. But its extreme simplicity and its somewhat universal backtracking structure makes it an especially adequate toy problem. If a language can’t handle such a simple problem very well, how can we expect it to be able to scale to much more complex problems like, say, a championship-level chess engine? * * * The raw data (do not forget that the two last timings for Bash are estimated). All times are in seconds.  Language 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 C++ 0 2e-06 3e-06 4.6e-05 5e-06 1.2e-05 3.6e-05 0.000126 0.000569 0.002973 0.016647 0.080705 0.448602 2.83042 18.648 C++-fixed 0 1e-06 1e-06 7e-06 5e-06 1.1e-05 3.3e-05 0.000104 0.0005 0.002369 0.011468 0.065407 0.462506 2.7651 18.0326 C# 0.007315 0.00726 0.008356 0.007302 0.007864 0.007451 0.007421 0.008287 0.008452 0.012481 0.033548 0.15449 0.877194 5.44465 35.7691 Java 1e-06 2e-06 2e-06 3e-06 5e-06 1.5e-05 4.9e-05 0.000198 0.000895 0.004244 0.022947 0.128498 0.692349 4.45776 29.3217 Python 1.2e-05 2.9e-05 5.4e-05 0.000136 0.000424 0.001708 0.006078 0.026174 0.115218 0.546922 2.82255 15.405 91.1701 581.984 3762.74 Python-2 1.2e-05 2.8e-05 4.5e-05 0.000109 0.000318 0.001275 0.004125 0.017448 0.077854 0.348823 1.70177 9.34966 55.5321 339.244 2259.01 Bash 0.003054 0.010938 0.006067 0.011355 0.026913 0.091869 0.347451 1.4721 6.48308 30.8131 163.061 891.828 5031.66 31746 209162 The More Pythonesque version: #!/usr/bin/python -O # -*- coding: utf-8 -*- import sys import time ######################################## ## ## (c) 2009 Steven Pigeon (pythonesque version) ## diag45=set() diag135=set() cols=set() solutions=0 ######################################## ## ## Marks occupancy ## def mark(k,j): global cols, diag45, diag135 cols.add(j); diag135.add(j+k) diag45.add(32+j-k) ######################################## ## ## unmarks occupancy ## def unmark(k,j): global cols, diag45, diag135 cols.remove(j); diag135.remove(j+k) diag45.remove(32+j-k) ######################################## ## ## Tests if a square is menaced ## def test(k,j): global cols, diag45, diag135 return not((j in cols) or \ ((j+k) in diag135) or \ ((32+j-k) in diag45)) ######################################## ## ## Backtracking solver ## def solve( niv, dx ): global solutions, nodes if niv > 0 : for i in xrange(0,dx): if test(niv,i) == True: mark ( niv, i ) solve( niv-1, dx) unmark ( niv, i ) else: for i in xrange(0,dx): if (test(0,i) == True): solutions += 1 ######################################## ## ## usage message ## def usage( progname ): print "usage: ", progname, " <size>" print "size must be 1..32" ######################################## ## ## c/c++-style main function ## def main(): if len(sys.argv) < 2: usage(sys.argv[0]) else: try: size = int(sys.argv[1]) except: usage(sys.argv[0]) return if (size <= 32) & (size>0): start = time.time() solve(size-1,size) elapsed = time.time()-start print "%s %0.6f" % (solutions,elapsed) else: usage(sys.argv[0]) # if __name__ == "__main__": main()  The other versions can be found here in super_reines.zip. The Bash and C++ versions are somewhat Linux-specific. 1 A trick explained in detail in Brassard and Bratley, Introduction à l’algorithmique, Presses de l’Université de Montréal. Translated to English: Fundamentals of Algorithmics (at Amazon.com) 2 Frédéric Marceau translated the program from C++ to C#. François-Denis Gonthier translated from C++ to Java. * * * So I added a third Python version to the archive. I also benchmarked it. It is quite a bit faster than the original one, and even than the ‘pythonesque’ version. For example: $ super-reines.py 12
14200 15.966019
$super-reines-2.py 12 14200 9.478235$ super-reines-3.py 12
14200 6.845071

So a more ‘functional’ version performs about 2.3× faster than a direct translation from C++. For the same problem size, however, the C++ (fixed) version takes 0.069s… Roughly 100× faster than the 3rd version.

Speed Ratios, Log Scale, Without Outliers, with 3rd Python version

### 82 Responses to Is Python Slow?

1. Stu says:

Hopefully by python 4 PyPy will be ready… however it’s a long time to wait (with unladen swallow happening inbetween).

The slowness of python is pretty frustrating, as the language feels ‘right’ in a number of ways, and going back to more verbose languages feels like a waste of typing.

2. Rbee says:

I’m not a lawyer but I believe Microsoft’s EULA for the .net run time forbids publishing bench marked results and it’s one of the reasons I’ve seen a few people use the mono run time when benchmarking the language. Just a heads up.

Great article though, I’m really enjoying your series of articles using empirical methods to test assumptions about languages and structures, it reminds me to keep the science in computer science.

• Steven Pigeon says:

I didn’t know that. I used the mono run-time just because I am a linux-centric guy, having moved progressively away from windows in the last few years. So, basically just out of convenience, I used the compiler available from the ubuntu repository. Which also means that I measured gmcs’ performance rather than Microsoft’s compiler.

• pauln says:

That’s not true as of 2005. The EULA does have specifics regarding benchmarking, though.

Not sure if I can link here, but this is the current wording: http://msdn.microsoft.com/en-us/library/ms973265.aspx

3. jelle says:

what happens if you type the program and compile it cython? that should speed it up to C++ execution speed, with a minimum of effort. experienced python programmers know that python is slow, but have understood that its not a big deal. there is an abundance of ways to speed up your python code.

try: “import psyco; psyco.full()”. likely you’ll get a 10* speed up or so. cython will speed up your code with slight more effort perhaps a hundred times.

• Steven Pigeon says:

I discussed the issue with friends about two months ago (at the time of writing) and someone suggested psyco (probably Gnuvince). For the readers that do not know, psyco is a just-in-time compiler addon for python, similar in spirit to the Java JIT. As I understand, psyco is unfortunately only available for 32 bits platforms and it turns out that most of my machines are in 64 bits mode.

Cython is not a python-to-C-compiler (I’d love that). From what I understand, it’s some kind of Python fork with tools to help you link C or C++ code with your now-not-quite-python application. Might as well just write everything in C or C++ then. I will still investigate this solution, however.

Neither cyton nor psyco have been integrated into debian / ubuntu repositories as far as I know. I know, that’s not a huge problem, but I’d rather have it in the package management system to get updates automagically. I had my share of installing stuff from tarballz, so I avoid it whenever I can.

• jelle says:

True and False. Cython compiles code to the python C API, which isn’t the same at all as vanilla C/C++. Cython provides a very elegant path to high performance code.

What really bothers me in your post is the statement: “It pains me that Python is just too slow to be of any use whatsoever in scientific/high-performance computing”. Surely you haven’t even bothered to see scipy.org. With the tiniest bit of effort your post would have been more informative ( and correct for that matter ) and less pendantic at the same time ;’)

• Steven Pigeon says:

We must make the difference between using libraries written in other languages (again, you’re right, I haven’t fully investigated all possibilities) and native Python code written in Python only.

Maybe I wasn’t clear in my intention: I wanted to compare implementations using the given programming languages only. On that account, someone could (and probably will) complain that I didn’t use a similar mechanism for Bash, or even Java. I could have written parts of the C++ version in assembly language, why not? No, all the tests are self-contained, if you will; the language X implementation uses only language X code.

The bottom line remains, I think, that you can still write a wrapper for high-performance code in Python (as I state in the text as well) but that you can’t write the basic constituents of high performance code in Python: you can call an external library to invert a matrix but you probably don’t want to write that in Python.

What’s your take on this? How would you, for example, convert my Python code into “high performance” code? (this being said, I’m open to suggestions)

• jelle says:

Well, I think typing a few variables or write assembler is a vast, vast difference. Python let’s you easily test various algorithms and approaches in little time, and provides simple and highly effective means of getting your code to the performance level of C. That is what is designed to do, pretty much in that order. You mentioned you’d like a gcj compiler for python. Which is called cython. Enough talk, I’m really curious to see what performance boost this will give you. Have you had a glimps at the performancepython link at scipy.org?

• Steven Pigeon says:

Yes, I’m browsing it as of now.

And if you want to try it for yourself, there’s a link with a zip containing all the source code.

4. jelle says:

ooops… forgot to post this link, which is very informative: http://www.scipy.org/PerformancePython

5. Steven Pigeon says:

Another thing I haven’t done is checking the impact of compiler Python itself with different compilers. Someone told me that compiler Python with ICC (the Intel C Compiler) yielded *much* better results (lots of handwaving here) than compiling it with gcc. Anyone here tried this?

6. Have you heard of Shed Skin?

Shed Skin is an “Optimizing Python-to-C++ Compiler” that compiles ordinary Python code to C++ in order to speed up the code, typically by an order of magnitude or more over standard Python (and even over Psyco). Still in experimental form, but it works on a variety of real-world examples. (Full disclosure: I co-wrote the tutorial for it.)

7. Daniel says:

You should consider using the self documenting feature for commenting your functions

• Steven Pigeon says:

Yes, of course, you’re right. I usually do when I write large-ish code, but, well, obviously, I didn’t for this ‘toy program’

8. Social comments and analytics for this post…

This post was mentioned on Reddit by ptemple: Python in “dynamically typed interpreted language slower than statically typed compiled language” shocker. The conclusion appears to be: if RAD and maintainability is more important, you should use a lang…

9. Iceman says:

Check out EVE online from CCP Games. It’s an MMORPG written in Stackless Python.

• fdgonthier says:

They say they have made the “game logic” in Python. This is nothing like making the full game in Python.

10. Foo says:

Why use GCJ and not the OpenJDK JVM?

11. your main point is valid but there are some easy optimisation to make to your python code.

The global lookup is quite costly, so that would be the first suspect.

Also a bit of profiling would get you much better result. (solve could likely be written differently).

Two things to remember:

– first : you are not very experimented in python, hence a negative bias on the performance of the python prog. (ask on stack overflow, there are quite python expert there)

– second : more importantly, what are you measuring ? the speed of the language or the time needed to make a program with a minimum speed level. If you measure the first point, all is right, but I think the second is more important and valuable, and in this case, the test needs to be done differently.

• Steven Pigeon says:

“solve could likely be written differently” : pray tell how.

12. I just wanna say one thing: Fast/Slow is relative (for those that never noticed :)); Our brains can capture and interpret 25 frames per second. Do you really need to project movies at 500 fps? No. You wouldn’t be able to tell the difference anyways.

My point is: There are games out there done in Python. And it works. It’s fast enough. So unless you are talking about a very specific problem that really requires the fastest of languages, I don’t think anything is gained by stating that Python is slow.

Btw, EVE Online… Python (Stackless Python, but Python nonetheless) ;)

Peace

• Steven Pigeon says:

Fast/Slow doesn’t make a difference if you’re considering a game that is bound by the user. For example, at one extreme, solitaire and “five or more” are games that just wait for the player. I suppose simple shoot-them-up are in this category as well, where computation is still dominated by the rendering and video effects.

Fast/Slow makes a difference when you’re talking about a game that needs a lot of intelligence to be played right. Chess in an example of the other extreme. It’s not action-based, 70 fps rendering, but still a game. The only way of playing it correctly is to have a fast program. Smart, fast program.

I’m sure there are a number of hard-core gamers that could enumerate a long list of RPG-style games where the NPCs (non-player characters) would gain immensely from more complex (and therefore more costly?) programming. That would be a realistic case of the ‘in between’ case where you do not have to be blinding fast but fast enough to not let the user feel lag, and where you still need a lot of (non-rendering) computation.

Fast/Slow also makes a huge difference on the infra-structure. Maybe your program is I/O bound so it doesn’t really matter. What if it’s compute-bound or something in between? Something mostly I/O bound but that needs burst of computations to be performed? How many servers do you need to have a decent response time? Could you do with fewer servers if your program was much faster? I’ve discussed this in a previous entry a while ago: you’re in this situation where you have to balance ease of development/maintenance with infrastructure costs (computers, space, cooling, power, maintenance, etc). A data center gets expensive real fast.

(BTW, have you even seen a CRT screen flicker despite a 85Hz refresh rate? We do see a lot more than 25 fps… We just accomodate ourselves with slow frame rate. There’s a reason why most TV / movie standards have framerates above 24 fps.)

• Pedro says:

Fair enough. I was just illustrating the point that speed is always relative.

It’s like the old discussion that java is/was slower than a natively compiled language: It’s a useless argument unless you specify your problem at hand.

• Chanandler Bong says:

Well the world is bigger than computer games. From my experience Python is NOT a good idea for highly computational problems and mathematical modelling. I can understand someone arguing about using Java for such a complex task (rather than proven winners C and C++) but Python, that’s just unheard of… So yes, fast/slow kinda does matter just not in any domain!

• I never use Python whenever I have moderately compute-intensive to do. Of course not! I tend to rely on SIMD-capable libraries, C++, and, yes, not too often, assembly language (as someone else suggested).

13. Marcin Koziuk says:

Most, if not all popular game engines use scripting languages, NOT C++ to abstract the game logic. Examples are Crysis (Lua), Unreal Engine (Unreal Script), Id tech engines (virtual machines), Eve online (Stackless Python) etc. The actual rendering stage is the real bottleneck here.

14. Paolo Bernardi says:

There are two implementations of the Python language running respectively on .NET and Java’s virtual machines:

1) http://www.codeplex.com/IronPython (up to 2.6)
2) http://www.jython.org/ (up to 2.5.1)

I’ve never tried them, really, so I have no idea about their performances.

By the way, Guido Van Rossum has declared a suspension from adding new features to the language for at least 2 years after that the 3.1 version of the Python main implementation will be released, just to allow such implementations (well, PyPy too), to catch up with new language features.

http://python.org/dev/peps/pep-3003/

15. Steven Pigeon says:

I want to try IronPython but it turns out it’s Windows only. It’s not a big deal, but Windows isn’t part of my development environment anymore. I haven’t tried Jython either.

I think the most promising approach is like that of Shed Skin, linked to in a comment above. Analyse the python code and generate a fast, native code executable version of the program. I’m not that excited about byte-code and virtual machines and JIT (although it’s clear that if you go for virtual machines with byte-code, you MUST have JIT).

16. Paolo Bernardi says:

I read that IronPython can run also under Linux, with Mono:

http://www.ironpython.info/index.php/Mono

I tried it right now and it looks like it works, at least for an hello world. :-)

17. Anders says:

Most of EVE Online (a MMORPG) is written in Python.

18. Alex says:

PyPy does a pretty good job on this one:

alex@alex-laptop:~/Desktop$python queens.py 12 14200 6.475548 alex@alex-laptop:~/Desktop$ ~/projects/pypy/pypy-c queens.py 12
14200 2.627967

• Steven Pigeon says:

19. [...] This post was mentioned on Twitter by Andreas Schreiber, all2one, vertoda, Tech news, ksaver and others. ksaver said: RT @programmingjoy: Is Python Slow? #programming http://bit.ly/4jyzWm [...]

20. I tried compiling queens.py with Shed Skin. The only change I had to make to the code was to hard-code the size argument in main() rather than using sys.argv[]. It compiled right away, and here are the results with size=12:

Time required by standard Python version: 7.3 sec.
Time required by Shed Skin: 0.5 sec.

This order-of-magnitude speed-up was extremely easy to achieve!

• Steven Pigeon says:

That’s pretty darn impressive.

So what are, in a nutshell, the current limitations of Shed Skin ?

1.) In my last reply I used the “pythonesque” version of your code. But when I use the other (earlier, more C-like) version instead, the speed-up factor is even better. For size=12:

Time for standard Python version: 17.8 sec.
Time for Shed Skin: 0.12 sec.

2.) So, what are the restrictions ?

Basically, Shed Skin only handles a subset of Python that is less dynamic (and more like C++) than standard Python. Specifically, variables must have static typing (if you define a=1 you can’t subsequently define it as a=’hi’), and container variables should be homogeneous, i.e. a list such as [1,2,3] is allowed but not [1, 2.3, '4']. Other common Python features are not supported, such as generators, multiple inheritance, and nested functions/classes.

Also, Shed Skin is experimental, so you may encounter bugs (which the creator, Mark Dufour, is happy to fix in my experience), and it hasn’t been tested on programs longer than one or two thousand lines.

Still, I have found it surprisingly easy to use, so I encourage you to experiment with it.

21. Isaac Gouy says:

Why are all the y-axis labels to 6 places?

Those 6 decimal places are zeros in all the labels in all the charts.

• fdgonthier says:

Thanks, in the name of all readers, for that insightful comment, WHICH IS UTTERLY POINTLESS.

• isilanes says:

Oh, the irony.

From your comment I infer that you consider that pointless comments shouldn’t be made (conclusion A). OTOH, from the fact that you *do* comment, I infer (using conclusion A) that you consider criticizing pointless things “pertinent” (conclusion B).

Now, the comment that you label as “pointless” is itself criticizing a pointless thing (labels in a graph having unnecessary decimal places), so by your logic, it must be “pertient” (by conclusion B).

Either you fail at labeling Isaac’s comment as “pointless” (by conclusion B), or you fail at implying that Isaac shouldn’t have written it, since your comment would be equally pointless, and you *did* comment (if you negate conclusion B, conclusion A must be negated too).

• Steven Pigeon says:

Because the axes are really, really super precise.

(seriously, defaults settings in gnumeric with a log scale)

22. Steven Pigeon says:

Reading on SciPy and NumPy, and other resources, I wrote yet another version, this time more functional in style:

def solve( niv, dx, cols, diag135, diag45 ):
global solutions, nodes

if niv > 0 :
for i in xrange(0,dx):
if not( (i in cols) or \
((i+niv) in diag135) or \
((32+i-niv) in diag45)):
solve( niv-1, dx,
[i]+cols,
[i+niv]+diag135,
[32+i-niv]+diag45 )
else:
for i in xrange(0,dx):
if not( (i in cols) or \
((i+niv) in diag135) or \
((32+i-niv) in diag45)):
solutions += 1

This version yields an interesting speed-up:

> super-reines.py 12
14200 15.966019
> super-reines-2.py 12
14200 9.478235
> super-reines-3.py 12
14200 6.845071

23. green tea says:

I think, Yes. From the above mentioned statistics, Python is slow as compared to Java. Java has acquired globally acceptance just because of it is platform independent.

24. [...] Is Python Slow? Python is a programming language that I learnt somewhat recently (something like 2, 3 years ago) and that I like very [...] [...]

25. [...] Pigeon fragt sich »Is Python Slow?« und liefert auch gleich ein paar Benchmarks mit (bitte auch die Kommentare beachten). [Harder, [...]

26. fdgonthier says:

I’ve found the source of the 7ms anomaly for Mono C#. At the first call of DateTime.Now the Mono class library initializes a handful of data that it needs to properly return the result for the current timezone.

There is a loop which calculates some data related to the start and end of daylight saving time during one year. Most of that processing is done in native code so it’s actually quite fast but does enough system call in a loop to cause a significant delay.

Once you add a dummy DateTime.Now call right before the first call to DateTime.Now, this calculation stays cached and valid and the delay is eliminated.

Another alternative would have been to use DateTime.Ticks to get the time at a 100ns resolution with little overhead. DateTime.Ticks is probably the thing to use for tight benchmarking.

I think this is a bug in Mono, and know a way to mitigate that effect, but the real problem is that DateTime.Now should return the system time right at the return of the Now property, but I don’t know how to solve the bug that way.

• Steven Pigeon says:

Indeed, changing the original code for so that DateTime is instanciated before it is used:

   DateTime TIMMY=DateTime.Now;
start = DateTime.Now;
solve(dx - 1, dx);
stop = DateTime.Now;
TimeSpan z = stop - start;

Does solves the problem.

27. drfrankenstein90 says:

@fdgonthier: System.Diagnostics.Stopwatch can be used for benchmarks, too.

• Steven Pigeon says:

Indeed, the code:

        chrono.Reset();
chrono.Start();
solve(dx - 1, dx);
chrono.Stop();
TimeSpan z = chrono.Elapsed;

makes a lot more sense.

@fdgonthier: Still something you should file as a bug to the mono developpers. 7ms is a lot of drift between “now” and the time the function actually finishes.

28. Steven Pigeon says:

Fixing the C# version with either the dummy variable or the Stopwatch (while the latter makes more sense) gets rid of the 7ms. There’s still a little something, but now it’s about 200µs, so it’s not really a major issue. Still strange, though.

29. 멤피스의 생각…

Is Python Slow? « Harder, Better, Faster, Stronger…

30. [...] Programming, boost, template | A few weeks ago, a friend posted an article on his blog about python being slow by comparing implementations of the 8 queens puzzle in different languages using a recursive [...]

31. satmeet says:

Thanks for this great article

32. Steven Pigeon says:

EVE online not that fast, as seen on a /. story.

33. R. Perez says:

I ran a very similar experiment though you went through greater lengths with analysis and had pretty much the same results. Python was slow, but did you try running your Python code on the JVM with Jython? It was so slow that it made Python look fast.

34. Steven Pigeon says:

No, I didn’t try Jython, although one of my friends did, and the results were far from encouraging. He ran a somewhat similar test, one that’s essentially recursive, the construction of a tree and python, even on jython, was really much slower than other (similar-ish) languages such as native Java, Haskell (if I remember correctly) and some other language like ocaml.

There’ll be a follow up on this post sometime soon, I will include Jython and others that I can (not all are available for 64 bits platform yet, or if they are, haven’t made their way into the Ubuntu repositories, which is a major bummer.)

35. Octopusgrabbus says:

I went to our Cambridge, MA Python Meetup speaker preview before PyCon (two in the last 3 weeks) and there is a lot of discussion about speed with Python and improvements coming up.

36. [...] Python Slow? (Part II) In a previous post I expressed my worries about Python being excruciatingly slow and I used a toy problem to compare [...]

37. [...] have increased steadily over the last year, principally due to a few shocking posts such as Is Python Slow? and high-visibility posts such as the CFM-00 (which was featured on Hack-a-Day). The first post [...]

38. larry says:

There are so many other programming languages that are arguably “nicer” than python, i.e. more elegant, more concise, better support for high level abstracgtions .. .whatever .. AND they are faster than Python Why try so hard to cling to python? All the python libraries are written in C, C++ aren’t they? It should be just as easy to interface with existing python libraries in a modern fast programming language as in Python. Look at Clojure. It leverages all the existing java libraries.
Python — just say no.

39. [...] than C++, and that’s some what new for me. Of course, I’ve criticized Python’s dismal performance on two occasions, getting me all kind of comments (from “you can’t compare [...]

40. [...] the n-queens problem I used before, I get the following [...]

41. Jach says:

I did some informal benchmarks on n=13 on the python version, c++ version, and java versions. The python version is the one you printed here, I also ran the 2to3 converter on it. Data:

Python2.6: 31.450s
Python3.1: 24.196s
Jython2.5: 26.871s
PyPy1.6: 06.547s
Java on Sun JVM with naked javac: 0.422s
C++ (fixed), naked g++: 0.695s
C++ just -Os: 0.283s
C++ your ops with -pipe -march=native: 0.227s

This doesn’t bother me that much, and PyPy continues to get faster with every release, it’s really not that slow anymore. PyPy continues to impress: http://speed.pypy.org/ Parallelism is where it’s at anyway. (Ignore the GIL behind the curtain.) I don’t really agree with the conclusions of this old post.

42. ;lllll says:

Python 3 is easier, better and faster. So I think you should have done a benchmark of that.

• Steven Pigeon says:

Probably. At the time I did this, I’m not sure it was out. Anyway, the latest production version is 2.7.x. I’m not sure python 3 is universally available on all distros (there are advantages to stick to distro-approved versions).

43. [...] right-hand sides will depend on previously (or concurrently) computed left-hand sides. Remember, in Is Python Slow? I used the generalized 8 Queens problem to test the efficiency of different programming languages. [...]

44. kinto mangunkusumo says:

after python what new next language ? too many language make me be an idiot,

• Steven Pigeon says:

Some people think there are too many languages, and I think I would agree with them except for the fact that different languages try to solve different problems or use different approaches to the same problems. Python, for example, is a really fun language to use: not too complicated, you can write some things really fast, and it is flexible enough that you never really end up in a dead end. However, Python is a language that is meant to be fun, simple, and flexible. By design it doesn’t care if it’s efficient or not (and even at times it seems it makes an effort not to). C is at the other extreme: by design it’s meant to be efficient, to let you control very finely what will happen in the machine, and guess what will be the (most likely) generated code, but does nothing to help you; you have to do everything by yourself. Take for example string manipulation in C. About as fun as putting your contact glasses with a fork.

In either case, it’s not a limitation if it’s by design.

This being said, I try to limit the number of different languages I use, otherwise I feel I never use one language fully, just write something in that language that I could have written in any other language. That is, it is hard to stop writing C++-style code in Python, but once you’ve grokked the spirit of the language (whether python or Java or some other), it’s usually much more pleasant.

45. Peter Nau says:

“Cython compiles to C or C++ code rather than Python” (from http://en.wikipedia.org/wiki/Cython).
“The source code gets translated into optimized C/C++ code” (from http://docs.cython.org/src/quickstart/overview.html).
This is a nice discussion about Cython performance: http://news.ycombinator.com/item?id=1845696

http://radiofreepython.com/episodes/8/ has an excellent interview with Kristjan Valur Jonsson. Kristjan covers a lot in his talk, including Eve Online, stackless, greenlets and CCP Game’s rationale for Python: programmer productivity. (He comments that programmer productivity is “money in the bank”.) So what do you want to optimize: execution speed, memory, or programmer productivity? It’s a fascinating talk.

• Steven Pigeon says:

You formulate your question as a XOR question. It’s about AND. You want to optimize programmer productivity, but not at the cost of having a slow, bloated, needs-a-data-center, product. You want to optimize both.

• Peter Nau says:

Right. My comments may be seen as suggesting mutually exclusive solutions, but that’s not the intent, which is to be informative and stimulate deeper investigation by readers.

It’s difficult, impossible, actually, to optimize everything, but Python offers solutions that can help optimize the most important things.
Evidently Cython allows easy switching between productivity and performance optimization in a way that supports both.

I cited the Kristjan Valur Jonsson talk because he gives a nice discussion of (his) optimization choices for a complex system. (There’s no point in using Stackless Python unless you need the concurrency, and even then, there are other options with their own tradeoffs.)

Q: Is Python slow? A: Not if it meets your performance requirements for the job at hand. If it’s still too slow, it need not be: use Cython (with annotated types); profile your code and then speed up the slow parts; use a more efficient algorithm; call C code.

• Steven Pigeon says:

Then we mostly agree, I suppose. My point was not that Python wasn’t fast enough for task X, but that its very core, it’s a slow interpreter, a bit of a quantitative caveat emptor on performance.

(and I still haven’t listened to the podcast, but it’s on my queue)

• David Boles says:

Exactly.

Every language that has shown itself to be suitable for compute-intensive applications has the property that the runtime for the language is largely written in the language itself. The “I’ll just escape to C” approach systematically defers issues of how the language design interacts with the potential for a high performance runtime system until it is too late.

46. sdfs@sdfs.sdf says:

if speed is your sole concern, learn and use assembly

• Chanandler Bong says:

47. Simon says:

It amazes me how many Python apologists have commented all to say something between “It doesn’t matter if it’s slow” and “it’s not slow”.

If that’s the case, why aren’t you all using your 16MHz processors?

I ended up here because a tight loop in Python which does nothing but pump integers onto a queue is running ~100 time slower than the C# client which listens to the queue _and processes the results_.

Speed _does_ matter. I like Python. It’s got a lot of positives about it but it is not fit for number-crunching, no matter how you try and justify it.

• Exactly. Sometimes speed does not matter; sometimes it does. When you consider scaling, that is, having tens or hundreds of thousands clients at the same time, somehow, something slow does not work, sometimes to a point where even adding computers and CPUs and all the infrastructure still does not cut it. But, hey, my homework finished in a few seconds, surely it’s fast enough :p

48. Peter Nau says:

Ah, …bait: “Python apologists” and “using your 16MHz processors” and “not fit for number-crunching”. Yeah, unfit at any speed and Pythonazis, too! (Hey, I just made that up. :-)

Yes, “Speed _does_ matter”, but your performance_requirements matter equally:
— Does an implementation in Python meet your performance_requirements? If so, then Python is fast.
— If an implementation with a bad algorithm does not meet your performance_requirements, then you are slow.
— If an implementation with a good algorithm does not meet your performance_requirements, then Python is slow.

— If productivity is important to you and an implementation in Python meets your performance_requirements, then Python is _very_ fast.

— If productivity is important to you and an implementation with a good algorithm, careful optimization and other speed-up techniques does not meet your performance_requirements, then Python is _very_ slow.

— If productivity is not important to you, then you are slow, on island time, or…

“You”? No, not you-you, but someone else.


text:
# How to easily write conditional pages? [closed]

Is there any easy way to make latex write only some of the pages?

My current idea is to make a function using the ifthen-package in the following way:

\newcommand{\WhatDoYouWantToWrite}[1]{
\ifthenelse{\equal{#1}{All}}{
text that will be written if all is wanted
}
\ifthenelse{\equal{#1}{PartA}{
text that will be written if part A is wanted
}
}
{Wrong input chosen. Don't know what to write}

This works, but now my problem is that if I'm changing the text I have to do it several places, which is frustrating. Then my idea was to make a separate file and use \input, but how can I then use the \ifthenelse-statement?

I have tried using the comment-package, but then I have to keep moving around in the text turning on and off \begin{comment} \end{comment}. Can it be used in a clever way in this setup?

It looked like the exam class, where one can choose if one wants to show solutions of problems, but then there is only two options of output, with or without solutions. I want more!

My hope is to just use one function in the beginning of the document which turns on/off the parts that I want/don't want.

## closed as unclear what you're asking by user31729, egreg, user13907, Mensch, Sean AllredJun 11 '15 at 19:04

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

• Why not include your files using \include and then at the top of your document your could write \includeonly{<insert files that you want}. – Andrew May 28 '15 at 8:32
• @Andrew: The (undesireful) feature of \include is that it always uses a new page. This is perhaps not desired by the OP – user31729 May 28 '15 at 8:48
• This is possible but it would be easier to do what you want if you gave slightly more detail. Do you want 5 options, or 10 or ...? – Andrew Jun 11 '15 at 15:49
• I think it's in OP's best interest if he tells us why this is needed. As someone who's taken advantage of TeX's scriptability, I feel like there's a better way to go about this. – Sean Allred Jun 11 '15 at 19:04
• User7919, there are now three answers to your question. Do any of them do what you want? Please clarify. – Andrew Jun 12 '15 at 6:11

Here is a flexible solution using pgfkeys that allows for arbitrary switches that are given as keys to the command/environment. I define two (user) commands \SelectCommentsToPrint and \SelectiveComment. The first command controls which comments will be printed and the second command defines the comments and specifies under what conditions they should be printed. Both commands take arbitrary "keys". For example.

\SelectCommentsToPrint{one,three,five}

specifies that comments labeled "one", "three" or "five" should be printed and all other comments should be ignored. After this a comment can be given as

\SelectiveComment[one,four,eleven]{This is a silly comment}

and this comment will be printed only when any one of "one", "four" and "eleven" have been set using \SelectCommentsToPrint. At any point you can issue another \SelectCommentsToPrint to add extra comments to print. You can also use

\SelectCommentsToPrint{all}

\SelectCommentsToPrint{unset/four}%      stop four from being printed

to stop "four" etc from being printed. There is also a SelectiveEnvironment environment for printing longer comments, this uses the environ package. The syntax is similar:

\begin{SelectiveEnvironment}[one,four]% print if one or four is set
some nice stuff
\end{SelectiveEnvironment}

Here is the output from the MWE:

If a comment is not printed in the MWE then a ? is printed instead. The remarks after the --- say why something was printed or not printed. The words in blue indicate when the printing of comments is turned on or off.

Here is the code:

\documentclass{article}
\usepackage{pgf,pgffor}
\usepackage{environ}
\usepackage{xcolor}% only needed for highlighting selections in MWE

% https://tex.stackexchange.com/questions/15204/is-there-a-way-to-set-a-global-key-value-using-pgfkeys
\makeatletter
\newcommand{\pgfkeysgsetvalue}[2]{\pgfkeys@temptoks{#2}\expandafter\xdef\csname pgfk@#1\endcsname{\the\pgfkeys@temptoks}}
\makeatother

\pgfkeys{/SelectiveComment/.is family,/SelectiveComment,
set/.unknown/.code={
\pgfkeysgsetvalue{/SelectiveComment/\pgfkeyscurrentname}{1}
},
set/unset/.unknown/.code={
\pgfkeysgsetvalue{/SelectiveComment/\pgfkeyscurrentname}{0}
}
}

\newif\ifPrintComment% print comment if true
\textcolor{blue}{Setting: #1!}% delete when using properly
\foreach \key in {#1}{\pgfkeys{/SelectiveComment,set/\key} }
}
\newcommand\MakeSelection[1]{
\foreach \key in {#1,all} {
\pgfkeysifdefined{/SelectiveComment/\key}%
{\pgfkeysgetvalue{/SelectiveComment/\key}{\temp}
\ifnum\temp=1\global\PrintCommenttrue\fi% print if key=1
}{}
}
}

\newcommand\SelectiveComment[2][]{\MakeSelection{#1}\ifPrintComment#2\fi}
\NewEnviron{SelectiveEnvironment}[1][]{\MakeSelection{#1}\ifPrintComment\BODY\fi }

\begin{document}\obeylines% onlyto decrease space taken up by MWE
\SelectCommentsToPrint{one, two, four}% print one, two or four
\SelectiveComment[one]{This is one}\hfil--- printed as one set
\SelectiveComment[two]{This is two}\hfil--- printed as two set
\SelectiveComment[three]{This is three}\hfil? --- NOT printed as three not set
\SelectiveComment[three, four]{This is three/four}\hfil--- printed as four set
\SelectiveComment[four]{This is four}\hfil? --- NOT printed as four not set
\SelectiveComment[four]{This is four}\hfil--- printed as four set
\SelectiveComment[five]{This is five}\hfil--- printed as all set
\SelectiveComment[six]{This is six}\hfil? --- NOT printed as six not set
\begin{SelectiveEnvironment}[one,four]
Inside an environment with one/four
\end{SelectiveEnvironment}\hfil--- printed as one and four set
\begin{SelectiveEnvironment}[three,six]% will NOT  print environment
Inside an environment with three/six
\end{SelectiveEnvironment}\hfil? --- NOT printed as three and six not set
\end{document}

The command \SelectCommentsToPrint calls keys inside /SelectiveComment/set that, in turn, sets the key /SelectiveComment/<key> equal to 1. The unset commands calls /SelectiveComment/set/unset and this then sets /SelectiveComment/<key> equal to 0. I did it this way to stop the keys from printing their values when they are being set and unset. The actual printing is controlled by the switch \ifPrintComment. By default this is off and all the keys do is issue \PrintCommenttrue if one of the keys for the comment is set to 1.

Both the /SelectiveComment/set and /SelectiveComment/set/unset keys are controlled using the .unknown key handler. This allows arbitrary key names to be used. I use a hack of Martin Scharrer's to set all of the pgfkeys globally.

The \textcolor{blue}{Setting: #1!} line in the definition of \SelectCommentsToPrint is only there to make the output from the MWE easier to understand. It should be removed if you want to use this.

The question is a little bit vague, but I tried to provide a solution, showing the \include(only) method and a \InputOnCondition way, where external files are fetched using \input. (The \InputOnCondition command can be extended of course, but the best would be to use a naming scheme for external files such that \InputOnCondition generates the file name in its test branches)

\documentclass{book}

\usepackage{blindtext}
\usepackage{ifthen}
\newcommand{\InputOnCondition}[1]{%
\ifthenelse{\equal{#1}{All}}{%
\input{mychap1}%
\input{mychap2}%
}{%
\ifthenelse{\equal{#1}{partA}}{%
\input{mychap1}%
}{%
\input{mychap2}%
}%
}%
}

\begin{filecontents}{mychap1.tex}

\chapter{First}
\section{First}
\blindtext[10]
\end{filecontents}

\begin{filecontents}{mychap2.tex}
\chapter{Second}
\section{First of Second}
\subsection{First}
\blindtext[5]
\end{filecontents}

\includeonly{mychap2}

\begin{document}

\tableofcontents

\include{mychap1}
\include{mychap2}

% Now with \InputOnCondition

\InputOnCondition{All}

\InputOnCondition{partA}

\InputOnCondition{partB}

\end{document}

• could you not \input{\ifthenelse{…}}? (or you might need to \expandafter\input\expandafter{\ifthenelse{…}…) – Sean Allred Jun 11 '15 at 19:02

Your approach here is to avoid having

\WhatDoYouWantToWrite{All}

throughout the document and then having to change every All to PartA (or something else) at a later stage. It's better to not pass an argument at all, and set something at the global level.

Here is one such approach using TeX \if-statements:

\documentclass{article}
\newif\ifALL% \ALLfalse
\newif\ifPARTA% \PARTAfalse
\newif\ifPARTB% \PARTBfalse

\newcommand{\ConditionalWrite}{%
\ifALL
Text that will be written if ALL is wanted.
\else
\ifPARTA
Text that will be written if PARTA is wanted.
\fi
\ifPARTB
Text that will be written if PARTB is wanted.
\fi
\fi
}

\begin{document}

\ALLtrue
\ConditionalWrite

\ALLfalse
\PARTAtrue
\ConditionalWrite

\PARTAfalse
\PARTBtrue
\ConditionalWrite

\end{document}

You can set \<cond>true or \<cond>false in the preamble. The example above just shows how the selection is conditioned.

The same can be done using etoolbox toggles.

• The \ifAll seems redundant. More than this, by making this a separate switch it is necessary to type all text govnerned by "All" twice. If using this approach rather than defining \ifAll it would be better to drop the \ifAll and type \PARTAtrue\PARTBtrue etc at the top of the document instead. – Andrew Jun 12 '15 at 10:03
• @Andrew: Sure. I show one application of the conditionals that echoed the OP's intent. Other suggestions and configurations are also possible. – Werner Jun 12 '15 at 16:25


text:
Warnings when plotting in ContourPlot a function defined as the solution of FindRoot

I am trying to plot implicitly a transcendental equation where one of the parameters (lambda) is given by another transcendental equation which, in this case, I can solve. Therefore, I defined lambda as

\[Lambda][St_, Le_, \[Rho]_, cp_, k_, \[Kappa]_, ms_, ml_, Di_, \[Alpha]_] :=
x /. FindRoot[(cl\[Infinity] F[-x/Sqrt[Di]] - cs\[Infinity] F[x])/
(F[-x/Sqrt[Di]] - F[x] ((1 - \[Alpha]) F[-x/Sqrt[Di]] + \[Alpha])) +
ml (\[Rho] F[x/Sqrt[Le]] (cp St Ts\[Infinity] - F[-x/Sqrt[Le \[Kappa]]]) -
St Tl\[Infinity] F[-x/Sqrt[\[Kappa] Le]])/(St (cp \[Rho] F[x/Sqrt[Le]] -
F[-x/Sqrt[\[Kappa] Le]])), {x, 1}]

where F[x] is a function that I have defined. Then, I define a quite convoluted function (called marg) where lambda appears several times. As I want to plot the curve where marg=0 varying two of the parameters, I use

ContourPlot[marg[St, Le, \[Rho], cp, k, \[Kappa], ms, ml, Di, \[Alpha]] == 0, {k, 0, 10}, {\[Kappa], 0, 10}, FrameLabel -> {"k", "\[Kappa]"}, PerformanceGoal -> "Quality"]

Everything worked perfectly but suddenly I started getting a lot of warnings (even though I still obtain the plots and they haven't changed from the ones I got without warnings). Some of the warnings are the following

• FindRoot::nlnum
• ReplaceAll::reps
• FindRoot::cvmit

I attach a screenshot with all the warning messages in case it helps.

How can I sort it out? Thank you very much in advance!

• you should define lambda and marg so they only take numeric arguments. ( do k_?NumericQ in the arg lists ) . Be sure to clear old function defs when you do that ) – george2079 Nov 22 '16 at 19:07
• It worked, thank you very much! – Ferran Brosa Planella Nov 23 '16 at 12:47


text:
# zbMATH — the first resource for mathematics

Orthogonal polynomials generated by a linear structure relation: inverse problem. (English) Zbl 1264.33011
Summary: Let $$(P_{n})_{n}$$ and $$(Q_{n})_{n}$$ be two sequences of monic polynomials linked by a type of structure relation such as
$Q_{n}(x)+r_{n}Q_{n-1}(x)=P_{n}(x)+s_{n}P_{n-1}(x)+t_{n}P_{n-2}(x)$
where $$(r_n)_n$$, $$(s_n)_n$$ and $$(t_n)_n$$ are sequences of complex numbers.
First, we state necessary and sufficient conditions on the parameters such that the above relation becomes non-degenerate when both sequences $$(P_n)_n$$ and $$(Q_n)_n$$ are orthogonal with respect to regular moment linear functionals $$\mathbf u$$ and $$\mathbf v$$, respectively.
Second, assuming that the above relation is non-degenerate and $$(P_n)_n$$ is an orthogonal sequence, we obtain a characterization for the orthogonality of the sequence $$(Q_n)_n$$ in terms of the coefficients of polynomials $$\varPhi$$ and $$\varPsi$$ which appear in the rational transformation (in the distributional sense) $$\varPhi \mathbf u=\varPsi \mathbf v$$.
Some illustrative examples for the developed theory are presented.

##### MSC:
 33C45 Orthogonal polynomials and functions of hypergeometric type (Jacobi, Laguerre, Hermite, Askey scheme, etc.)
Full Text:


text:
Skip to Main content Skip to Navigation

# Phase diagram of hot QCD in an external magnetic field: possible splitting of deconfinement and chiral transitions

Abstract : The structure of the phase diagram for strong interactions becomes richer in the presence of a magnetic background, which enters as a new control parameter for the thermodynamics. Motivated by the relevance of this physical setting for current and future high-energy heavy ion collision experiments and for the cosmological QCD transitions, we use the linear sigma model coupled to quarks and to Polyakov loops as an effective theory to investigate how the chiral and the deconfining transitions are affected, and present a general picture for the temperature--magnetic field phase diagram. We compute and discuss each contribution to the effective potential for the approximate order parameters, and uncover new phenomena such as the paramagnetically-induced breaking of global $\mathbb{Z}_3$ symmetry, and possible splitting of deconfinement and chiral transitions in a strong magnetic field.
Keywords :
Complete list of metadatas

https://hal.archives-ouvertes.fr/hal-00474445
Contributor : Maxim Chernodub <>
Submitted on : Tuesday, April 20, 2010 - 10:16:40 AM
Last modification on : Monday, May 18, 2020 - 4:50:33 PM

### Citation

A. J. Mizher, M. N. Chernodub, E. S. Fraga. Phase diagram of hot QCD in an external magnetic field: possible splitting of deconfinement and chiral transitions. Physical Review D, American Physical Society, 2010, 82, pp.105016. ⟨10.1103/PhysRevD.82.105016⟩. ⟨hal-00474445⟩

Record views