text:
# zbMATH — the first resource for mathematics

## Greenbaum, Anne

Compute Distance To:
 Author ID: greenbaum.anne Published as: Greenbaum, A.; Greenbaum, Anne External Links: MGP · Wikidata
 Documents Indexed: 61 Publications since 1979, including 7 Books
all top 5

#### Co-Authors

 19 single-authored 5 Mayo, Anita A. 5 Strakoš, Zdeněk 3 Choi, Daeshik 3 Overton, Michael L. 2 Anderson, Edward 2 Ashby, Steve 2 Bai, Zhaojun 2 Bischof, Christian H. 2 Caldwell, Trevor 2 Chao, Han Zheng 2 Demmel, James Weldon 2 Dongarra, Jack J. 2 Du Croz, Jeremy J. 2 Elman, Howard C. 2 Freund, Roland W. 2 Greengard, Leslie F. 2 Gurvits, Leonid 2 Hammarling, Sven J. 2 Knizhnerman, L. A. 2 Li, Congming 2 Li, Kenan 2 McKenney, Alan 2 Parter, Seymour V. 2 Rodrigue, Garry H. 2 Rozlozník, Miroslav 2 Saylor, Paul E. 2 Sorensen, Danny C. 2 Walker, Homer F. 2 Widlund, Olof B. 1 Blackford, S. 1 Burke, James V. 1 Chang, Britton 1 Chartier, Timothy P. 1 Chen, Menghuo 1 Crouzeix, Michel 1 Cullum, Jane K. 1 Drkošová, Jitka 1 Drushkin, V. L. 1 Druskin, V. L. 1 Dubois, Paul F. 1 Faber, Vance 1 Ferguson, Jake M. 1 Golub, Gene Howard 1 Kyanfar, Faranges 1 Lewis, Adrian S. 1 Li, Rencang 1 Luskin, Mitchell 1 Machorro, Eric A. 1 Marshall, Donald E. 1 McFadden, Geoffrey Bey 1 Ostrouchov, Susan 1 Pták, Vlastimil 1 Salemi, Abbas 1 Sonnad, Vijay 1 Trefethen, Lloyd Nicholas
all top 5

#### Serials

 10 SIAM Journal on Matrix Analysis and Applications 9 Linear Algebra and its Applications 5 SIAM Journal on Scientific Computing 4 Journal of Computational Physics 3 BIT 3 SIAM Review 2 Numerische Mathematik 2 Numerical Linear Algebra with Applications 1 Computer Physics Communications 1 Applied Mathematics and Computation 1 Computing 1 SIAM Journal on Numerical Analysis 1 SIAM Journal on Scientific and Statistical Computing 1 Physica D 1 Parallel Computing 1 Computational Mathematics and Mathematical Physics 1 Mathematical Programming. Series A. Series B 1 ETNA. Electronic Transactions on Numerical Analysis 1 Frontiers in Applied Mathematics 1 The IMA Volumes in Mathematics and its Applications 1 Software - Environments - Tools
all top 5

#### Fields

 51 Numerical analysis (65-XX) 20 Linear and multilinear algebra; matrix theory (15-XX) 9 Partial differential equations (35-XX) 6 General and overarching topics; collections (00-XX) 5 Operator theory (47-XX) 4 Computer science (68-XX) 3 Potential theory (31-XX) 2 Integral equations (45-XX) 1 Functions of a complex variable (30-XX) 1 Special functions (33-XX) 1 Approximations and expansions (41-XX) 1 Calculus of variations and optimal control; optimization (49-XX) 1 Probability theory and stochastic processes (60-XX) 1 Statistical mechanics, structure of matter (82-XX)

#### Citations contained in zbMATH

48 Publications have been cited 1,484 times in 1,284 Documents Cited by Year
LAPACK user’s guide. This work is dedicated to Jim Wilkinson. 3rd ed. Zbl 0934.65030
Anderson, E.; Bai, Z.; Bischof, C.; Blackford, S.; Demmel, J.; Dongarra, J.; Du Croz, J.; Greenbaum, A.; Hammarling, S.; McKenney, A.; Sorensen, D.
1999
Iterative methods for solving linear systems. Zbl 0883.65022
Greenbaum, Anne
1997
LAPACK user’s guide. 2nd ed. Zbl 0843.65018
Anderson, E.; Bai, Z.; Bischof, C.; Demmel, J.; Dongarra, J.; Du Croz, J.; Greenbaum, A.; Hammarling, S.; McKenney, A.; Ostrouchov, S.; Sorensen, D.
1995
Any nonincreasing convergence curve is possible for GMRES. Zbl 0857.65029
Greenbaum, Anne; Pták, Vlastimil; Strakoš, Zdeněk
1996
Laplace’s equation and the Dirichlet-Neumann map in multiply connected domains. Zbl 0769.65085
Greenbaum, A.; Greengard, L.; McFadden, G. B.
1993
Approximating the inverse of a matrix for use in iterative algorithms on vector processors. Zbl 0438.65037
Dubois, P. F.; Greenbaum, A.; Rodrigue, Garry H.
1979
Behavior of slightly perturbed Lanczos and conjugate-gradient recurrences. Zbl 0662.65032
Greenbaum, A.
1989
Predicting the behavior of finite precision Lanczos and conjugate gradient computations. Zbl 0755.65037
Greenbaum, A.; Strakos, Z.
1992
Fast parallel iterative solution of Poisson’s and the biharmonic equations on irregular regions. Zbl 0752.65080
Mayo, A.; Greenbaum, A.
1992
On the numerical solution of the biharmonic equation in the plane. Zbl 0824.65117
Greenbaum, Anne; Greengard, Leslie; Mayo, Anita
1992
Generalizations of the field of values useful in the study of polynomial functions of a matrix. Zbl 1004.15027
Greenbaum, Anne
2002
Relations between Galerkin and norm-minimizing iterative methods for solving linear systems. Zbl 0855.65021
Cullum, Jane; Greenbaum, Anne
1996
Estimating the attainable accuracy of recursively computed residual methods. Zbl 0873.65027
Greenbaum, Anne
1997
Matrices that generate the same Krylov residual spaces. Zbl 0803.65029
Greenbaum, Anne; Strakos, Zdenek
1994
GMRES/CR and Arnoldi/Lanczos as matrix approximation problems. Zbl 0806.65031
Greenbaum, Anne; Trefethen, Lloyd N.
1994
Using nonorthogonal Lanczos vectors in the computation of matrix functions. Zbl 0912.65021
Druskin, V.; Greenbaum, A.; Knizhnerman, L.
1998
Numerical stability of GMRES. Zbl 0837.65040
Drkošová, J.; Greenbaum, A.; Rozložník, M.; Strakoš, Z.
1995
Numerical behaviour of the modified Gram-Schmidt GMRES implementation. Zbl 0891.65031
Greenbaum, A.; Rozložník, M.; Strakoš, Z.
1997
Comparison of splittings used with the conjugate gradient algorithm. Zbl 0394.65011
Greenbaum, A.
1979
The polynomial numerical hulls of Jordan blocks and related matrices. Zbl 1044.15019
Faber, Vance; Greenbaum, Anne; Marshall, Donald E.
2003
Analysis of a multigrid method as an iterative technique for solving linear systems. Zbl 0539.65011
Greenbaum, Anne
1984
Fourth order accurate evaluation of integrals in potential theory on exterior 3D regions. Zbl 1109.65028
Mayo, Anita; Greenbaum, Anne
2007
Crouzeix’s conjecture and perturbed Jordan blocks. Zbl 1390.15074
Greenbaum, Anne; Choi, Daeshik
2012
Parallelizing preconditioned conjugate gradient algorithms. Zbl 0798.65040
Greenbaum, Anne; Li, Congming; Chao, Han Zheng
1989
A multigrid method for multiprocessors. Zbl 0616.65094
Greenbaum, A.
1986
Diagonal scalings of the Laplacian as preconditioners for other elliptic differential operators. Zbl 0754.65042
Greenbaum, A.
1992
Some extensions of the Crouzeix-Palencia result. Zbl 1392.15029
Caldwell, Trevor; Greenbaum, Anne; Li, Kenan
2018
Rapid parallel evaluation of integrals in potential theory on general three-dimensional regions. Zbl 0911.65016
Greenbaum, A.; Mayo, A.
1998
Optimal preconditioners of a given sparsity pattern. Zbl 0689.65014
Greenbaum, A.; Rodrigue, G. H.
1989
A Petrov-Galerkin finite element method for solving the neutron transport equation. Zbl 0589.65090
Greenbaum, A.; Ferguson, J. M.
1986
Roots of matrices in the study of GMRES convergence and Crouzeix’s conjecture. Zbl 1314.15015
Choi, Daeshik; Greenbaum, Anne
2015
Upper and lower bounds on norms of functions of matrices. Zbl 1155.15032
Greenbaum, Anne
2009
Characterizations of the polynomial numerical hull of degree $$k$$. Zbl 1106.15018
Burke, James V.; Greenbaum, Anne
2006
Card shuffling and the polynomial numerical hull of degree $$k$$. Zbl 1047.15013
Greenbaum, Anne
2003
Max-min properties of matrix factor norms. Zbl 0799.15014
Greenbaum, A.; Gurvits, L.
1994
Analysis of an aggregation-based algebraic two-grid method for a rotated anisotropic diffusion problem. Zbl 1363.65213
Chen, Meng-Huo; Greenbaum, Anne
2015
Some theoretical results derived from polynomial numerical hulls of Jordan blocks. Zbl 1068.15039
Greenbaum, Anne
2004
Accuracy of computed solutions from conjugate-gradient-like methods. Zbl 0811.65026
Greenbaum, Anne
1994
Variational analysis of the Crouzeix ratio. Zbl 1376.15015
Greenbaum, Anne; Lewis, Adrian S.; Overton, Michael L.
2017
Near normal dilations of nonnormal matrices and linear operators. Zbl 1388.15019
Greenbaum, Anne; Caldwell, Trevor; Li, Kenan
2016
Numerical methods. Design, analysis, and computer implementation of algorithms. Zbl 1247.65001
Greenbaum, Anne; Chartier, Timothy P.
2012
First-order perturbation theory for eigenvalues and eigenvectors. Zbl 07207347
Greenbaum, Anne; Li, Ren-Cang; Overton, Michael L.
2020
Spectral sets: numerical range and beyond. Zbl 07122453
Crouzeix, Michel; Greenbaum, Anne
2019
Numerical investigation of Crouzeix’s conjecture. Zbl 1415.15021
Greenbaum, Anne; Overton, Michael L.
2018
An algorithm for finding a 2-similarity transformation from a numerical contraction to a contraction. Zbl 1323.65040
Choi, Daeshik; Greenbaum, Anne
2015
On solving indefinite symmetric linear systems by means of the Lanczos method. Zbl 0970.65040
Greenbaum, A.; Drushkin, V. L.; Knizhnerman, L. A.
1999
On the role of the left starting vector in the two-sided Lanczos algorithm and nonsymmetric linear system solvers. Zbl 0902.65011
Greenbaum, A.
1998
The Lanczos and conjugate gradient algorithms in finite precision arithmetic. Zbl 1260.65026
Greenbaum, Anne
1994
First-order perturbation theory for eigenvalues and eigenvectors. Zbl 07207347
Greenbaum, Anne; Li, Ren-Cang; Overton, Michael L.
2020
Spectral sets: numerical range and beyond. Zbl 07122453
Crouzeix, Michel; Greenbaum, Anne
2019
Some extensions of the Crouzeix-Palencia result. Zbl 1392.15029
Caldwell, Trevor; Greenbaum, Anne; Li, Kenan
2018
Numerical investigation of Crouzeix’s conjecture. Zbl 1415.15021
Greenbaum, Anne; Overton, Michael L.
2018
Variational analysis of the Crouzeix ratio. Zbl 1376.15015
Greenbaum, Anne; Lewis, Adrian S.; Overton, Michael L.
2017
Near normal dilations of nonnormal matrices and linear operators. Zbl 1388.15019
Greenbaum, Anne; Caldwell, Trevor; Li, Kenan
2016
Roots of matrices in the study of GMRES convergence and Crouzeix’s conjecture. Zbl 1314.15015
Choi, Daeshik; Greenbaum, Anne
2015
Analysis of an aggregation-based algebraic two-grid method for a rotated anisotropic diffusion problem. Zbl 1363.65213
Chen, Meng-Huo; Greenbaum, Anne
2015
An algorithm for finding a 2-similarity transformation from a numerical contraction to a contraction. Zbl 1323.65040
Choi, Daeshik; Greenbaum, Anne
2015
Crouzeix’s conjecture and perturbed Jordan blocks. Zbl 1390.15074
Greenbaum, Anne; Choi, Daeshik
2012
Numerical methods. Design, analysis, and computer implementation of algorithms. Zbl 1247.65001
Greenbaum, Anne; Chartier, Timothy P.
2012
Upper and lower bounds on norms of functions of matrices. Zbl 1155.15032
Greenbaum, Anne
2009
Fourth order accurate evaluation of integrals in potential theory on exterior 3D regions. Zbl 1109.65028
Mayo, Anita; Greenbaum, Anne
2007
Characterizations of the polynomial numerical hull of degree $$k$$. Zbl 1106.15018
Burke, James V.; Greenbaum, Anne
2006
Some theoretical results derived from polynomial numerical hulls of Jordan blocks. Zbl 1068.15039
Greenbaum, Anne
2004
The polynomial numerical hulls of Jordan blocks and related matrices. Zbl 1044.15019
Faber, Vance; Greenbaum, Anne; Marshall, Donald E.
2003
Card shuffling and the polynomial numerical hull of degree $$k$$. Zbl 1047.15013
Greenbaum, Anne
2003
Generalizations of the field of values useful in the study of polynomial functions of a matrix. Zbl 1004.15027
Greenbaum, Anne
2002
LAPACK user’s guide. This work is dedicated to Jim Wilkinson. 3rd ed. Zbl 0934.65030
Anderson, E.; Bai, Z.; Bischof, C.; Blackford, S.; Demmel, J.; Dongarra, J.; Du Croz, J.; Greenbaum, A.; Hammarling, S.; McKenney, A.; Sorensen, D.
1999
On solving indefinite symmetric linear systems by means of the Lanczos method. Zbl 0970.65040
Greenbaum, A.; Drushkin, V. L.; Knizhnerman, L. A.
1999
Using nonorthogonal Lanczos vectors in the computation of matrix functions. Zbl 0912.65021
Druskin, V.; Greenbaum, A.; Knizhnerman, L.
1998
Rapid parallel evaluation of integrals in potential theory on general three-dimensional regions. Zbl 0911.65016
Greenbaum, A.; Mayo, A.
1998
On the role of the left starting vector in the two-sided Lanczos algorithm and nonsymmetric linear system solvers. Zbl 0902.65011
Greenbaum, A.
1998
Iterative methods for solving linear systems. Zbl 0883.65022
Greenbaum, Anne
1997
Estimating the attainable accuracy of recursively computed residual methods. Zbl 0873.65027
Greenbaum, Anne
1997
Numerical behaviour of the modified Gram-Schmidt GMRES implementation. Zbl 0891.65031
Greenbaum, A.; Rozložník, M.; Strakoš, Z.
1997
Any nonincreasing convergence curve is possible for GMRES. Zbl 0857.65029
Greenbaum, Anne; Pták, Vlastimil; Strakoš, Zdeněk
1996
Relations between Galerkin and norm-minimizing iterative methods for solving linear systems. Zbl 0855.65021
Cullum, Jane; Greenbaum, Anne
1996
LAPACK user’s guide. 2nd ed. Zbl 0843.65018
Anderson, E.; Bai, Z.; Bischof, C.; Demmel, J.; Dongarra, J.; Du Croz, J.; Greenbaum, A.; Hammarling, S.; McKenney, A.; Ostrouchov, S.; Sorensen, D.
1995
Numerical stability of GMRES. Zbl 0837.65040
Drkošová, J.; Greenbaum, A.; Rozložník, M.; Strakoš, Z.
1995
Matrices that generate the same Krylov residual spaces. Zbl 0803.65029
Greenbaum, Anne; Strakos, Zdenek
1994
GMRES/CR and Arnoldi/Lanczos as matrix approximation problems. Zbl 0806.65031
Greenbaum, Anne; Trefethen, Lloyd N.
1994
Max-min properties of matrix factor norms. Zbl 0799.15014
Greenbaum, A.; Gurvits, L.
1994
Accuracy of computed solutions from conjugate-gradient-like methods. Zbl 0811.65026
Greenbaum, Anne
1994
The Lanczos and conjugate gradient algorithms in finite precision arithmetic. Zbl 1260.65026
Greenbaum, Anne
1994
Laplace’s equation and the Dirichlet-Neumann map in multiply connected domains. Zbl 0769.65085
Greenbaum, A.; Greengard, L.; McFadden, G. B.
1993
Predicting the behavior of finite precision Lanczos and conjugate gradient computations. Zbl 0755.65037
Greenbaum, A.; Strakos, Z.
1992
Fast parallel iterative solution of Poisson’s and the biharmonic equations on irregular regions. Zbl 0752.65080
Mayo, A.; Greenbaum, A.
1992
On the numerical solution of the biharmonic equation in the plane. Zbl 0824.65117
Greenbaum, Anne; Greengard, Leslie; Mayo, Anita
1992
Diagonal scalings of the Laplacian as preconditioners for other elliptic differential operators. Zbl 0754.65042
Greenbaum, A.
1992
Behavior of slightly perturbed Lanczos and conjugate-gradient recurrences. Zbl 0662.65032
Greenbaum, A.
1989
Parallelizing preconditioned conjugate gradient algorithms. Zbl 0798.65040
Greenbaum, Anne; Li, Congming; Chao, Han Zheng
1989
Optimal preconditioners of a given sparsity pattern. Zbl 0689.65014
Greenbaum, A.; Rodrigue, G. H.
1989
A multigrid method for multiprocessors. Zbl 0616.65094
Greenbaum, A.
1986
A Petrov-Galerkin finite element method for solving the neutron transport equation. Zbl 0589.65090
Greenbaum, A.; Ferguson, J. M.
1986
Analysis of a multigrid method as an iterative technique for solving linear systems. Zbl 0539.65011
Greenbaum, Anne
1984
Approximating the inverse of a matrix for use in iterative algorithms on vector processors. Zbl 0438.65037
Dubois, P. F.; Greenbaum, A.; Rodrigue, Garry H.
1979
Comparison of splittings used with the conjugate gradient algorithm. Zbl 0394.65011
Greenbaum, A.
1979
all top 5

#### Cited by 2,183 Authors

 20 Greenbaum, Anne 15 Axelsson, Axel Owe Holger 15 Benner, Peter 14 Strakoš, Zdeněk 13 Dongarra, Jack J. 12 Quintana-Ortí, Enrique S. 12 Serra-Capizzano, Stefano 11 Helsing, Johan 11 Li, Rencang 11 Meurant, Gérard A. 11 Rozlozník, Miroslav 11 Zlatev, Zahari 10 Simoncini, Valeria 9 Salemi, Abbas 8 Bai, Zhongzhi 8 Demmel, James Weldon 8 Golub, Gene Howard 7 Faragó, István 7 Kropinski, Mary Catherine A. 7 Li, Zhilin 7 Lowengrub, John Samuel 7 Quintana-Ortí, Gregorio 7 Van der Vorst, Henk Albertus 6 Aishima, Kensuke 6 Carson, Erin Claire 6 Duintjer Tebbens, Jurjen 6 Higham, Nicholas J. 6 Kressner, Daniel 6 Lin, Wen-Wei 6 Pan, Victor Yakovlevich 6 Pestana, Jennifer 6 Szyld, Daniel B. 6 van de Geijn, Robert Alexander 6 Wathen, Andrew John 5 Aghamollaei, Gholamreza 5 Bai, Zhaojun 5 Bhaya, Amit 5 Bientinesi, Paolo 5 Chen, Jinhai 5 Ding, Chao 5 Drmač, Zlatko 5 Ferronato, Massimiliano 5 Giraud, Luc 5 Gravvanis, George A. 5 Greengard, Leslie F. 5 Gutknecht, Martin H. 5 Karátson, János 5 Keyes, David Elliot 5 Langou, Julien 5 Lin, Lin 5 Lipitakis, Elias A. 5 Lu, Linzhang 5 Morgan, Ronald B. 5 O’Leary, Dianne P. 5 Paprzycki, Marcin 5 Quaife, Bryan D. 5 Saad, Yousef 5 Sherwin, Spencer J. 5 Sleijpen, Gerard L. G. 5 Sun, Defeng 5 Tichý, Petr 5 Toh, Kimchuan 5 Vecharynski, Eugene 5 Walker, David W. 5 Ward, Michael J. 5 Yang, Chao 5 Ying, Wenjun 4 Bosner, Nela 4 Botchev, Mikhail A. 4 Carpentieri, Bruno 4 Diao, Huaian 4 Du, Kui 4 Fasano, Giovanni 4 Güttel, Stefan 4 Hadjidimos, Apostolos 4 Haidar, Azzam 4 Havasi, Ágnes 4 Huang, Ting-Zhu 4 Kågström, Bo 4 Kamiya, Norio 4 Kita, Eisuke 4 Koev, Plamen 4 Kolokolnikov, Theodore 4 Kontoghiorghes, Erricos John 4 Liesen, Jörg 4 Mach, Thomas 4 Manteuffel, Thomas A. 4 Matsuo, Takayasu 4 Mehrmann, Volker 4 Murota, Kazuo 4 Nasser, Mohamed M. S. 4 Neytcheva, Maya G. 4 Novati, Paolo 4 Overton, Michael L. 4 Parlett, Beresford Neill 4 Reichel, Lothar 4 Stoll, Martin 4 Tomov, Stanimire Z. 4 Vuik, Cornelis 4 Wei, Juncheng ...and 2,083 more Authors
all top 5

#### Cited in 199 Serials

 126 Journal of Computational Physics 107 Linear Algebra and its Applications 89 Journal of Computational and Applied Mathematics 52 Numerical Linear Algebra with Applications 46 SIAM Journal on Scientific Computing 40 Computers & Mathematics with Applications 40 Applied Mathematics and Computation 40 BIT 35 Computer Physics Communications 34 Numerical Algorithms 33 Computer Methods in Applied Mechanics and Engineering 32 Applied Numerical Mathematics 25 Engineering Analysis with Boundary Elements 24 SIAM Journal on Matrix Analysis and Applications 23 International Journal for Numerical Methods in Engineering 23 Journal of Scientific Computing 22 Numerische Mathematik 19 Computers and Fluids 16 Optimization Methods & Software 13 Journal of Fluid Mechanics 12 Mathematics of Computation 12 Journal of Optimization Theory and Applications 12 Computational Optimization and Applications 12 Advances in Computational Mathematics 10 ACM Transactions on Mathematical Software 10 International Journal of Computer Mathematics 9 Mathematics and Computers in Simulation 9 Japan Journal of Industrial and Applied Mathematics 9 Computational Statistics and Data Analysis 9 Mathematical Programming. Series A. Series B 8 SIAM Journal on Optimization 7 Computing 7 Physica D 6 Parallel Computing 6 Applied Mathematics Letters 6 European Journal of Operational Research 5 International Journal for Numerical Methods in Fluids 5 Journal of Mathematical Physics 5 Calcolo 5 Physics of Fluids 5 Computational and Applied Mathematics 5 Acta Numerica 4 Acta Mechanica 4 Journal of the Mechanics and Physics of Solids 4 Linear and Multilinear Algebra 4 SIAM Journal on Numerical Analysis 4 Mathematical and Computer Modelling 4 Journal of Nonlinear Science 4 Communications in Numerical Methods in Engineering 4 Mathematical Problems in Engineering 4 Archives of Computational Methods in Engineering 4 JSIAM Letters 4 SIAM/ASA Journal on Uncertainty Quantification 3 International Journal of Solids and Structures 3 Wave Motion 3 Automatica 3 Theoretical Computer Science 3 Systems & Control Letters 3 Computer Aided Geometric Design 3 Computational Mechanics 3 Numerical Methods for Partial Differential Equations 3 SIAM Review 3 Computing and Visualization in Science 3 Mathematical and Computer Modelling of Dynamical Systems 3 M2AN. Mathematical Modelling and Numerical Analysis. ESAIM, European Series in Applied and Industrial Mathematics 3 International Journal of Modern Physics C 3 Concurrency and Computation: Practice & Experience 3 Journal of Numerical Mathematics 3 Journal of Applied Mathematics and Computing 3 Multiscale Modeling & Simulation 2 Applicable Analysis 2 International Journal of Control 2 International Journal of Heat and Mass Transfer 2 International Journal for Numerical and Analytical Methods in Geomechanics 2 Mathematical Biosciences 2 Journal of Soviet Mathematics 2 Numerical Functional Analysis and Optimization 2 Studies in Applied Mathematics 2 Journal of Symbolic Computation 2 Computers & Operations Research 2 Neural Networks 2 Annals of Operations Research 2 Journal of Global Optimization 2 Annals of Physics 2 Applied Mathematical Modelling 2 Russian Journal of Numerical Analysis and Mathematical Modelling 2 Journal of Geodesy 2 Parallel Algorithms and Applications 2 ZAMM. Zeitschrift für Angewandte Mathematik und Mechanik 2 International Journal of Numerical Modelling 2 European Journal of Mechanics. B. Fluids 2 International Journal of Applied Mathematics and Computer Science 2 Combustion Theory and Modelling 2 Journal of Applied Mathematics 2 Journal of Industrial and Management Optimization 2 The Journal of Prime Research in Mathematics 2 SIAM Journal on Imaging Sciences 2 Mathematical Programming Computation 2 Statistics and Computing 1 Astrophysics and Space Science ...and 99 more Serials
all top 5

#### Cited in 48 Fields

 945 Numerical analysis (65-XX) 193 Partial differential equations (35-XX) 174 Fluid mechanics (76-XX) 154 Linear and multilinear algebra; matrix theory (15-XX) 85 Mechanics of deformable solids (74-XX) 82 Operations research, mathematical programming (90-XX) 69 Computer science (68-XX) 41 Quantum theory (81-XX) 39 Optics, electromagnetic theory (78-XX) 38 Statistics (62-XX) 37 Ordinary differential equations (34-XX) 33 Calculus of variations and optimal control; optimization (49-XX) 33 Statistical mechanics, structure of matter (82-XX) 29 Biology and other natural sciences (92-XX) 26 Operator theory (47-XX) 25 Systems theory; control (93-XX) 23 Probability theory and stochastic processes (60-XX) 19 Classical thermodynamics, heat transfer (80-XX) 15 Approximations and expansions (41-XX) 15 Integral equations (45-XX) 14 Potential theory (31-XX) 14 Dynamical systems and ergodic theory (37-XX) 12 Geophysics (86-XX) 10 Information and communication theory, circuits (94-XX) 8 Functions of a complex variable (30-XX) 8 Game theory, economics, finance, and other social and behavioral sciences (91-XX) 7 Combinatorics (05-XX) 5 Field theory and polynomials (12-XX) 5 Special functions (33-XX) 5 Mechanics of particles and systems (70-XX) 5 Astronomy and astrophysics (85-XX) 4 History and biography (01-XX) 4 Harmonic analysis on Euclidean spaces (42-XX) 4 Global analysis, analysis on manifolds (58-XX) 3 Sequences, series, summability (40-XX) 2 Algebraic geometry (14-XX) 2 Real functions (26-XX) 2 Difference and functional equations (39-XX) 2 Mathematics education (97-XX) 1 General and overarching topics; collections (00-XX) 1 Commutative algebra (13-XX) 1 Group theory and generalizations (20-XX) 1 Integral transforms, operational calculus (44-XX) 1 Geometry (51-XX) 1 Convex and discrete geometry (52-XX) 1 Differential geometry (53-XX) 1 General topology (54-XX) 1

#### Wikidata Timeline

The data are displayed as stored in Wikidata under a Creative Commons CC0 License. Updates and corrections should be made in Wikidata.


text:
+0

# Math

0
36
1

Eli conducted a scientific experiment. For a certain time, the temperature of a compound rose \frac{5}{6} 6 5  of a degree in \frac{1}{20} 20 1  of an hour. What was the rate, in degrees per hour, that the temperature of the compound rose? On the double number line below, fill in the given values, then use multiplication to find the missing value. Enter your answers as fractions, mixed numbers, or whole numbers. To enter a mixed number on the double number line, use a space and the slash key. For example: 3 1/2 0 0 degrees hours 1 5/6 5/6 1/20 1/20 Enter your final answer as a whole number, proper fraction, or mixed number in simplest form.

Sep 10, 2022

format: plain


text:
# Calculating work done on an ideal gas

I am trying to calculate the work done on an ideal gas in a piston set up where temperature is kept constant. I am given the volume, pressure and temperature.

I know from Boyle's law that volume is inversely proportional to pressure that is,

$$V \propto \frac{1}{p}$$

using this I can calculate the two volumes I need for this equation to calculate work done:

$$\Delta W = - \int^{V_2}_{V_1} p(V)dV$$

but what I do not understand is how to use this equation to help me calculate the work done, I think I am confused by the fact that I need to have $p(V)$ but I am not sure what this is. If you could help me to understand this, that would be great

-
In this usage $p(V)$ is simply referring to a function relating pressure to Volume. You will want to use the ideal gas law. – Michael Leonard Oct 22 '12 at 4:45

## 2 Answers

Try the ideal gas law

$$p V = N k_B T \Leftrightarrow p = N k_B \frac{T}{V}$$

since $N$, $k_B$ and $T$ are constant, we have

$$\Delta W = - N k_B T \int_{V_1}^{V_2} \frac{\textrm{d}V}{V} = - N k_B T \left( \ln(V_2) - \ln(V_1)\right)$$

-
In your first equation you have $pV=Nk_BT \Leftrightarrow p=Nk_B\frac{T}{V}$ shouldn't it be $p=\frac{Nk_BT}{V}$? If it isn't then could you explain how the rearrangement happens? – Aesir Oct 21 '12 at 21:58
$a \cdot \frac{b}{c} = \frac{a\cdot b}{c}$. – Claudius Oct 22 '12 at 8:26

The answer by Claudius is correct with one assumption: That is that the process is reversible. In other words the process must take place so slowly that the system is always in equilibrium.

Why is this important? Because the definition of work is really $$W = -\int_{V_1}^{V_2} p_{ext} dV$$ Note the $p_{ext}$. That's the external pressure because doing work is equivalent to raising a weight in the earth's gravitational field.

In a reversible process the external and internal pressures are always equal, so one can use $p = nRT/V$, where $p$ here is the internal pressure, in place of the external pressure.

In nonequilibrium situations one has to know how $p_{ext}$ varies with the volume of the system. And usually we don't. For instance, expansion against zero pressure does no work, while expansion against a constant external pressure does $$W = -p_{ext} (V_2 - V_1)$$ work. Can you see why?

-
Reversibility is a good point which I forgot to mention, yes. However, in this case, it is equivalent to the assumption that the ideal gas law always holds, which I would find to be implied by the fact that we, indeed, have an ideal gas? – Claudius Oct 22 '12 at 8:27


text:
# Homework Help: Suppose function g is defined as follows: g(x)=-(1/2)x-3

1. Jun 29, 2015

### Jaco Viljoen

Suppose the function g is defined as follows:
g(x)=-(1/2)x-3
Write down the D:g and solve the equation 4^(gx)=8

Thank you

2. Relevant equations
g(x)=-(1/2)x-3
4^(gx)=8
3. The attempt at a solution
D:g (-∞,∞) because the function is a line,
4^((-1/2)x-3)=8
log4^((-1/2)x-3)=log8
(-1/2x)-3=(log8)/(log4)
(-1/2x)-3=1.5
(-1/2x)=4.5 add 3 to both sides
x=-9

Have I got it right?
Thank you,

2. Jun 29, 2015

### Ray Vickson

You can check this for yourself: plug in x = -9 and see if it works! You should develop, as a matter if routine, the habit of checking your own work. There will be many times (for example, on exams) when the option of asking questions on-line is unavailable to you, and you should try not to rely on it.

3. Jun 29, 2015

### RUber

That is correct, but you got sloppy with your parentheses.
You started with (-1/2)x - 3 and then switched at some point to (-1/2x)-3. These are different expressions meaning $-\frac12 x - 3$ or $-\frac{1}{2 x} - 3$.
Luckily, you knew that you meant and solved for x correctly.

4. Jun 29, 2015

### Jaco Viljoen

Hi Ray,
-9 is correct, I have checked it.
I just want a confirmation that I did the right thing with regards to the question.
Thank you again,

Jaco

5. Jun 29, 2015

### Jaco Viljoen

Ruber,
I realised that my parentheses were wrong and changed them after from-1/(2x) which was also wrong, must have missed a coupleor corrected them incorrectly,
I write my work out first and then retype in the forum.

I do need some practice with the typing as I often make this error,
Thank you.

6. Jun 29, 2015

### Ray Vickson

Yes, you did it correctly.

7. Jun 29, 2015

### Staff: Mentor

gx makes no sense in this context. The equation you want to solve is $$4^{g(x)} = 8$$
See above.

8. Jun 29, 2015

### Jaco Viljoen

Hi Mark,
You are correct, I omitted the parentheses accidentally.
Thank you

9. Jun 29, 2015

### SammyS

Staff Emeritus
Actually, those two expressions are equivalent.

-1/2x $\displaystyle\ =-\frac{1}{2}x\ .$

As Mark points out below, writing the expression in this manner is bad practice.

Last edited: Jun 29, 2015
10. Jun 29, 2015

### Staff: Mentor

And a constant source of confusion for the ones reading things like "-1/2x". The proper interpretation is as Sammy wrote: -1/2 times x, but we are torn between wondering whether the person who wrote this understands the rules of precedence, or not.[/quote]


text:
# Is it possible to find (some) eigenvalues of a Hessian without computing it entirely?

I have a saddle point of a function defined on a $$64 \times 64 \times 64$$ grid, i.e. a function of $$64^3$$ variables. I would like to compute the lowest-lying eigenvalues of the Hessian to see how they depend on the parameters of the function.

The function is analytically twice differentiable, but computation of the complete Hessian is impossible due to memory constraints (the full matrix would be around 8TB). The Hessian is sparse, but it is not a simple sparsity pattern such as a tridiagonal matrix. I also know that the Hessian has several zero eigenvalues.

Is it possible to calculate the $$n$$ smallest eigenvalues without computing the full Hessian? Either an analytical method or a numerical approximation would be fine.

• Sylvester's law of inertia (en.wikipedia.org/wiki/Sylvester%27s_law_of_inertia) allows to analyse the Hessian (positive definite, $\ldots$) without calculating the eigenvalues. It's a matter of completing the square, or else of computing a sequence of determinants. Dec 16 '20 at 9:57
• Thanks Christian Blatter, but despite my misleading wording in the question, I am specifically interested in the values of the eigenvalues. I've edited the question to make this clear. Dec 16 '20 at 10:07
• The Lanczos method is a great way to get the extreme eigenvalues of a matrix without going through the full $O(N^3)$ process of diagonalization. But you have to actually know the matrix. Since you can’t even store it in memory, this is probably not helpful. Dec 16 '20 at 10:13
• maybe you can compute a partial principal submatrix of the the Hessian and use it as an approximation/bound of the Hessian eigenvalues Eigenvalues of a principal sub-matrix of a symmetric matrix Dec 16 '20 at 11:26
• You should move this to scicomp.stackexchange.com . Or post threre, with links on both posts to the other. Dec 19 '20 at 14:45


text:
# Current when resistance is 0

A short circuit has $\rm 0$ resistance. We use Ohm's Law $\rm V=IR$. If $\rm R=0$, then $\rm V=0$. Doesn't this mean $\rm I$ can theoretically be anything? Thus $\rm I$ can be like $\rm35A$ for example, and there would be current. But how can there be current without electron potential (voltage)?

Additionally, if $\rm R$ is infinite, then $\rm I=0$. $\rm V$ can be anything. In this case, does this mean for sure that no current will pass through?

But how can there be current without electron potential (voltage)?

In the case where there is no resistance, current (once flowing) does not require any voltage to continue flowing. If you start a current flowing in a superconductor, then even with no applied voltage, it continues to flow.

It doesn't take any force to keep a ball rolling if there is no drag. Likewise it doesn't take any voltage to keep current flowing if there is no resistance.

You're correct that if you have a perfect insulator ($R=\infty$), then any applied voltage will still produce zero current. In the real world, there are no perfect insulators. At some point the voltage will be strong enough to move charges across the material.

In circuits with areas of large resistance, we can safely ignore areas with very small resistance because it doesn't affect the circuit behavior significantly. For this reason, simple circuit behavior is modeled with perfect ($R=0$) conductors.

In almost any real world circuit, that isn't true. The wires have positive (if small) resistance. Current might rise high enough to be a danger, but it isn't infinite.

Even if you were to consider a superconductor as a wire (where resistance really is zero), it still has an inductance value. When resistance is very small (or zero), the inductance becomes significant. It will prevent the current from increasing faster than a certain rate.

• Just for my own knowledge how do you get the current moving in a super conductor I understand voltage would do it but is there another way. Can you use a magnet? I don't know much about super conductors. If the super conductor reaches the right Temp will Eddy currents start on there own? – newguy Sep 14 '15 at 21:48
• See this answer. physics.stackexchange.com/questions/179374/… – BowlOfRed Sep 14 '15 at 21:53
• It means, then, that this equation (U = R * I) is not universally correct, it is correct only for the conditions where the resistance is guaranteed, isn't it. Otherwise U = 0, no matter how much I (current) is there: U = 0 * I = 0 always, at least this is what my math teacher used to say. ;) – forsberg Mar 6 at 11:12
• It's correct at steady-state, not in transition. A voltage drop across a zero-resistance wire will never reach steady-state. – BowlOfRed Mar 6 at 16:07

I can theoretically be anything

EDIT: Oh, you mean the current,$I$, not the pronoun I....

Ohm's law applies only to components which could obey Ohm's law. It is an observational, phenomenological law. If R truly equals zero, then something else is governing the relationship between the current in the circuit and the potential drop. A filament in an incandescent light bulb obeys Ohm's law most of the time even though the resistance changes with temperature.

If one cycles the applied voltage slowly enough, however, one can create a negative slope in the V vs I curve indicating a negative resistance. I'm not sure that's what it means because I don't know if the filament is actually an Ohmic resistance at that point.

In superconducting circuits, there is no resistance and there is no potential drop. The current is produced inductively using an alternating magnetic field.

An infinite R can be produced by cutting a wire in a loop circuit. In that case I=0 and one indeed can let V be anything until the electric field across the gap becomes too large for whatever material is in the gap. Then the gap will become conducting. That's how lightning is produced.

In a circuit that is shorted the current is governed by the internal resistance of the power supply . let's say the supply resistance is 1 ohm and the supply voltage is 35 volts the supply will deliver 35 amps to the shorted circuit. You will not measure a voltage drop across the wire shorting the power supply but there will be a voltage drop inside the supply's internal resistance. In most cases this will damage or destroy the power supply unless it has a current limiting circuit. So even though you do not have an external resistor there is still resistance in the circuit. Even battery's have internal resistance. I understand this is not a physics explanation but I'm an electrical engineer so I'm pretty sure that's how it works

An ideal short circuit is that circuit element for which the voltage across is zero for any current through. One can think of the ideal short circuit in two ways:

(1) as an ideal resistor in the limit of $R \rightarrow 0$

(2) as an ideal voltage source where $V_S = 0$

In both cases, there is current without voltage. This isn't necessarily a contradiction just as there can be flow without pressure (or motion without force).

Likewise, an ideal open circuit is the circuit element (dual to the ideal short circuit) for which the current through is zero for any voltage across. One can think of the ideal open circuit in two ways:

(1) as an ideal resistor in the limit of $R \rightarrow \infty$

(2) as an ideal current source where $I_S = 0$

Every form of energy has inertia. Have a mass $m$ with speed $v$. It won't simply stop unless there is a force that makes it stop. Same way, have a current $I$. It won't stop unless there is a "force" applied.

In our nice Earth, friction stops the mass $m$. And, resistance stops the current $I$. But in space, there is no friction, and mass $m$ can't stop. And in superconducting materials, there is no resistance and current $I$ can't stop. (By the way, this is exactly why MRI equipment generates powerful magnetic fields for so long time: by having a current in zero resistance superconducting materials without a voltage source).

The inertia associated with the current relies in the magnetic energy in the magnetic field associated with the current. Because, the current is the source of the magnetic field.

About $R\to\infty$, there is no current. And that is what happens in electrostatic. You have arbitrary voltages and electric fields, but approximately no current.

"Short" answer: You can't really have a short circuit as such in the first place.

Superconductors aside, everything has resistance. Even free electrons at rest have a little bit of mass and will resist applied voltage just a wee bit. Put those electrons inside something and resistance can only go up. (Again, superconductivity aside. It doesn't just happen by accident.)

Circuits are designed to operate in a specific envelope, where each individual part is working correctly. That means that current in every wire needs to be low enough that voltage across the wire is negligible. Such terms are neglected for the sake of comprehending what the circuit does.

Complex circuits are often simulated by computer-aided design software, working on a complete physical description of the final product. The size and shape of all the wires is typically taken into account, leading to a "schematic" where no parts are directly connected except to resistors. If such a simulation turns up a problem, the designer might track it down to a wire that failed to be an ideal short. (And the solution is usually to get a bigger wire.)

Likewise, air gaps can become conducting given a high enough electric field. I've not encountered a simulator including such automatic analysis, but an engineer designing high-voltage electronics should always pay special attention to insulation.

Lines drawn between circuit elements are a fiction, predicated on all the other assumptions that went into the design of the circuit. Failure modes may simply not be described by the schematic at all. When representing excessive current through a wire, on a schematic or a system of equations, you must remove the wire with your eraser and substitute a resistor instead.


text:
subcaption color with the subfigure package

To define the caption color in my document, I am using

\usepackage{caption}
\usepackage[font={small,color=ocre}]{caption}

Which works perfectly, but currently facing the following two problems:

1. Subcaptions are not colored (I am using the subfigure package, so I can't use the same code as above)

1. When a citation is included in the figure caption , it is not colored.

Does any one have some solutions or hints?

After the request, here is a minimum working example:

\documentclass[a4paper]{article}
\usepackage{amsmath}
\usepackage[numbers,square]{natbib}
%The following is uesd to make the caption colored
\usepackage{xcolor}
\definecolor{ocre}{RGB}{1,160,233}
\usepackage{caption}
\usepackage[font={small,color=ocre}]{caption}
\usepackage{graphicx,subfigure}
\hypersetup{
allcolors=black,
citecolor=black,
}

\usepackage{filecontents}

\begin{filecontents*}{\jobname.bib}
@book{Knu86,
author = {Knuth, Donald E.},
year = {1986},
title = {The \TeX book},
}
\end{filecontents*}

\bibliography{\jobname} % if you’re using BibTeX

\begin{document}

\begin{figure}[hb]
\centering     %%% not \center
\boxed{\subfigure[Subfigure One]{\label{fig:SubfigureOne}\includegraphics[width=0.4\textwidth]{../../Desktop/StackExchange/Test.pdf}}}

\boxed{\subfigure[Subfigure Two]{\label{fig:SubfigureTwo}\includegraphics[width=0.4\textwidth]{../../Desktop/StackExchange/Test.pdf}}}

\caption{Comparison between Subfigure One and Subfigure Two. \autoref{fig:SubfigureOne} shows the difference for the complete data range, and \autoref{fig:SubfigureTwo} as displayed in \cite{Knu86}}
\label{fig:OverAllFigure}
\end{figure}

\end{document}

• Could you show us a fully MWE? – Aradnix Aug 27 '14 at 8:16

Code

\documentclass[a4paper]{article}
\usepackage{amsmath}
\usepackage[numbers,square]{natbib}
%The following is uesd to make the caption colored
\usepackage{xcolor}
\definecolor{ocre}{RGB}{1,160,233}
\usepackage{caption}
\usepackage[font={small,color=ocre}]{caption}
\usepackage{graphicx,subfigure}
\hypersetup{
allcolors=black,
citecolor=black,
}

\usepackage{etoolbox}

\AtBeginEnvironment{figure} {
\hypersetup{
allcolors=ocre,
citecolor=ocre,
}
}

\newcommand{\boxedcolor}[2]{%
\boxed{\color{#1}#2}%
}

\usepackage{filecontents}

\begin{filecontents*}{\jobname.bib}
@book{Knu86,
author = {Knuth, Donald E.},
year = {1986},
title = {The \TeX book},
}
\end{filecontents*}

\bibliography{\jobname} % if you’re using BibTeX

\begin{document}

\begin{figure}[hb]

\centering     %%% not \center
\boxedcolor{ocre}{\subfigure[Subfigure One]{\label{fig:SubfigureOne}\includegraphics[width=0.4\textwidth]{exercises.png}}}

\boxedcolor{ocre}{\subfigure[Subfigure Two]{\label{fig:SubfigureTwo}\includegraphics[width=0.4\textwidth]{exercises.png}}}

\caption{Comparison between Subfigure One and Subfigure Two. \autoref{fig:SubfigureOne} shows the difference for the complete data range, and \autoref{fig:SubfigureTwo} as displayed in \cite{Knu86}}
\label{fig:OverAllFigure}
\end{figure}

Another reference to Figure~\ref{fig:OverAllFigure} with a black hyperling.

\end{document}

Explanation

1. The problem is, that you defined a black color for hyperlinks using \hypersetup. You can change the link colors locally using \hypersetup again at the begin of every figure environment. I think the most comfortable way of doing this is using \AtBeginEnvironment of the package etoolbox.

2. To change the color of the subfigure captions, I defined a new command \boxedcolor. It allows you to change the color inside the box and also affects subfigure captions. Depending on whether you always want to use ocre as you color, you could also define \boxedcolor it with one argument

\newcommand{\boxedcolor}[1]{%
\boxed{\color{ocre}#1}%
}

which leads to shorter usage: \boxedcolor{...}.

Alternatively, you could append \color{ocre} to figure using \AtBeginDocument like I did it with hypersetup before. This would be the most comfortable solution, but it also leads to a colored box (which is not desired, I expect).

What if i'm using subfig package and instead of \boxed I use \subfloat? Here's an example:

\begin{figure}[H]

\centering

\caption{An Example}

\subfloat[\textcolor{white}{Subfigure 1} \label{img:tabuleiro}]{\includegraphics[width=0.30\linewidth]{usual_board_dots_and_squares}} \hspace{2cm}

\subfloat[\textcolor{white}{Subfigure 2} \label{img:tabuleiroInicial}]{\includegraphics[width=0.32\linewidth]{usual_board_dots_and_squares_with_pieces}}

\end{figure}

I want everything in white color, but like in the example above, everything but letters (a) and (b) (which continue to be black) are white. In this case, how can I make everything white?


text:
# List of figures prefix

Hello I want to add a prefix to list of figures. Is there any way how to do it ? I am using \documentclass[12pt]{article} and \usepackage[czech]{babel}.

I have found this solution which helped but not as I wanted to. It showed full name Obrázek instead of Obr. (Figure x Fig.)

{%
\let\oldnumberline\numberline%
\renewcommand{\numberline}{\figurename~\oldnumberline}%
\listoffigures%
}

• Welcome to TeX.SX! It would be great if you could show us what you have tried. Posting a minimal working example that indicates what you are trying to do makes it easier for people to understand what you want. It also makes it easier for people to help you, since they have some code to start from, and hence much more likely that some one will try to help you. – Andrew Jan 26 at 21:50
• I've tried this : – user205597 Jan 26 at 21:56
• Please use edit to add your code to the original post. – Teepeemm Jan 26 at 22:10
• \figurename expands to Obr\'azek (using Babel one presumes), so just replace it with Obr. – John Kormylo Jan 27 at 14:53

You can do this also using the tocloft package. If you're independently using titlesec for something, then Vincent's answer is probably to be preferred. Adjust the spacing for the label and number as needed.

\documentclass{article}
\usepackage[czech]{babel}
\usepackage{tocloft}
\renewcommand{\cftfigpresnum}{Obr.~}
\setlength{\cftfignumwidth}{5em}
\begin{document}
\listoffigures
\begin{figure}
A figure
\caption{A caption}
\end{figure}
\begin{figure}
A figure
\caption{A caption}
\end{figure}
\begin{figure}
A figure
\caption{A caption}
\end{figure}
\end{document}

It can be done with the \titlecontents command from the titletoc package (see the documentation for more details). For example, with

\documentclass{article}
\usepackage[czech]{babel}
\usepackage{titletoc}
\titlecontents{figure}[0mm]%
{\makebox{Obr.~}}%
{}%
{\enspace\dotfill\enspace\thecontentspage}
\begin{document}
\listoffigures
\begin{figure}
\caption{A first figure}
\end{figure}
\begin{figure}
\caption{A second figure}
\end{figure}
\begin{figure}
\caption{Again another figure}
\end{figure}
\end{document}

we get the following list of figures.


text:
Top

Molecular Weight Calculator
Top
The molecular weight of a substance expresses the relative mass of its molecule in composition to some arbitrarily selected standard. Molecular weight in chemistry is considered a simple matter being just the weight of one mole of the compound. The molecular weight of a substance is pure number having no unit.

$Molecular\ weight = \frac{Mass\ of\ 1\ molecule\ of\ the\ substance}{Mass\ of\ 1\ atom\ of\ hydrogen\ (H=1)}$
For a given known compound it is easily calculated as the sum of the atomic masses of the constituent atoms in the molecular formula.

Below is given a default molecular formula, you can just see how the molecular formula is calculated using the calculator.

## Steps for Molecular Weight Calculator

Step 1 :

Read the problem and find out the molecule whose molecular weight has to be determined.

Step 2 :

From the chemical formula of the given element the molecular weight can be calculated.

## Problems on Molecular Weight Calculator

1. ### The chemical formula for anhydrous codeine is C18H21NO3. Calculate the mass of 0.01 moles of the drug. [Data: m(C) = 12.01 gmol-1; m(H) = 1.008 gmol-1; m(N) = 14.01 gmol-1; m(O) = 16.00 gmol-1]

Step 1 :

First we determine the molecular molar mass from the chemical fomula.

Step 2 :

m(C18H21NO3) = 18 $\times$ 12.01 + 21 $\times$ 1.008 + 1 $\times$ 14.01 + 3 $\times$ 16.00

= 299.36 gmol-1

The molecular weight of C18H21NO3  = 299.36 gmol-1

2. ### Calculate the molecular weight of hexane.

Step 1 :

The chemical formula for hexane is C6H14.

Step 2 :

m(C6H14) = 6 $\times$ 12.01 + 14 $\times$ 1.008

= 86.175 gmol-1


text:
GATE1993-16

15 votes
928 views
Prove by the principal of mathematical induction that for any binary tree, in which every non-leaf node has $2$-descendants, the number of leaves in the tree is one more than the number of non-leaf nodes.
in DS
edited

2 Answers

15 votes

Best answer

Base Case :- When we have just root then, there are no non leaf nodes. So No of leaves $= 1$, No of non leaf nodes is $= 0$. Base case holds.

Induction Hypothesis :- Assume that now for $k$ internal nodes we will have $k+1$ leaves.

Inducting on no of leaves, Now we add $2$ more leaves to this tree. One of $k+1$ leaf will become internal node. So now we will have $k+1$ internal node. No of leafs will be $K+ 1 - 1$ ($1$ leaf just became internal node) $+ 2$(New leafs) . So we proved that for any binary tree, in which every non-leaf node has $2$-descendants, the number of leaves in the tree is one more than the number of non-leaf nodes.

edited by
0
2-descendants mean ?
0

@set2018

Descendant: A node reachable by repeated proceeding from parent to child. So for every non-leaf node, we must be having two nodes which can be obtained by proceeding from parent to child.

0
A descendant of a node N is either N itself, a child of N, a child of a child of N and so on for any number of levels .. We say node N is an ancestor of node M if M is a descendant of N ...
0
@Puja Mishra..."A descendant of a node N is either N itself, ......"

Can we call a node a descendant of itself?
7 votes
**descendents mean immediate child or no of node from that node to leaf ??

if immediate then :
let total n nodes are in binary tree.
2*non_leaf node  + 1 = total node
non leaf node = (total node -1)/2 = (n-1)/2
no of leaf node + no of nonleaf node = total node
no of leaf node + (n-1)/2 = n
no of leaf node = (n+1)/2
=  (n-1 + 2)/2
= (n - 1)/2 + 1
= no of non leaf node + 1
0

Descendant: A node reachable by repeated proceeding from parent to child..

0
Sir ,how this come "total node= 2*non_leaf node  + 1  "

Related questions

7 votes
3 answers
1
1.2k views
Consider a singly linked list having $n$ nodes. The data items $d_1, d_2, \dots d_n$ are stored in these $n$ nodes. Let $X$ be a pointer to the $j^{th}$ node $(1 \leq j \leq n)$ in which $d_j$ is stored. A new data item $d$ ... algorithm to insert $d$ into the list to obtain a list having items $d_1, d_2, \dots, d_{j}, d,\dots, d_n$ in order without using the header.
15 votes
2 answers
2
1.7k views
The following Pascal program segments finds the largest number in a two-dimensional integer array $A[0\dots n-1, 0\dots n-1]$ using a single loop. Fill up the boxes to complete the program and write against $\fbox{A}, \fbox{B}, \fbox{C} \text{ and } \fbox{D}$ in your answer book Assume that max is ... begin if A[i, j]>max then max:=A[i, j]; if |C| then j:=j+1; else begin j:=0; i:=|D| end end end
16 votes
3 answers
3
1.6k views
A size-balanced binary tree is a binary tree in which for every node the difference between the number of nodes in the left and right subtree is at most $1$. The distance of a node from the root is the length of the path from the root to the node. The height of a ... tree of height $h \geqslant 1$, how many nodes are at distance $h-1$ from the root? Write only the answer without any explanations.
31 votes
2 answers
4
5.3k views
Let LASTPOST, LASTIN and LASTPRE denote the last vertex visited `in a postorder, inorder and preorder traversal respectively, of a complete binary tree. Which of the following is always true? LASTIN = LASTPOST LASTIN = LASTPRE LASTPRE = LASTPOST None of the above


text:
# Writing a vector as a linear combination.

• September 23rd 2009, 11:27 AM
GreenDay14
Writing a vector as a linear combination.
The question is:

Write (1, 2, 3) belongs to R3 as a linear combination of (1, 1, 1), (1, 0, 1), (1, 0, 0).

So i wrote:

(1, 2, 3) = 2(1, 1, 1) + 1(1, 0, 1) - 2(1, 0, 1)

Which would give:

2 2 2
+1 0 1
= (3, 2, 3)
- (2, 0, 2)
= (1, 2, 3)

So it would appear that it works out, but it seems way to easy. Could someone check this for me and let me know if i am missing something? Thanks.
• September 23rd 2009, 12:22 PM
Plato
Quote:

Originally Posted by GreenDay14
The question is:
Write (1, 2, 3) belongs to R3 as a linear combination of (1, 1, 1), (1, 0, 1), (1, 0, 0).
So i wrote:
(1, 2, 3) = 2(1, 1, 1) + 1(1, 0, 1) - 2(1, 0, 1)

That is the correct solution. It could have been found by solving
$\left( {\begin{array}{*{20}c}
1 & 1 & 1 \\
1 & 0 & 0 \\
1 & 1 & 0 \\
\end{array} } \right)\left( {\begin{array}{*{20}c} x \\ y \\ z \\
\end{array} } \right) = \left( {\begin{array}{*{20}c}
1 \\ 2 \\ 3 \\ \end{array} } \right)$


text:
# Export The $PATH Variable, Line-By-Line Inspired by this question on AskUbuntu. Your job is extremely simple. Take the PATH environment variable (echo$PATH) and export it such that each entry (separated by the : character) is on its own line.

For example, if the PATH is /bin:/usr/bin:/usr/local/bin, your program should output:

/bin
/usr/bin
/usr/local/bin

Your program may not return a leading newline, but it may return a single trailing newline. You do not need to check if the PATH is right, or that the directory exists. Your program should take no input, meaning that your program is responsible for getting the PATH itself. You may safely assume that objects in the PATH do not contain : or newlines. However, spaces are fair game.

Reference implementations are present in the answers to the question above.

### Rules

• This is (obviously) code-golf, so the shortest answer will win the prized green checkmark.
• The accepted answer will be tested to make sure it's actually legit.
• Both Windows and *nix entries are accepted.
• However, if you don't explicitly specify Windows, I will try running it in Linux and fail. (If it's obvious (hi, Batch!), you don't need to specify explicitly.)
• Only have one solution per answer. If you have both a Windows and *nix version, I will count the shorter one.
• If two answers have the same length, I will give priority to the one with the higher vote total. If they have the same vote total, I will count the older one. If the time posted is the same, I will choose the one that executes faster. If they execute in the same amount of time, I don't know.

var QUESTION_ID=96334,OVERRIDE_USER=15422;function answersUrl(e){return"https://api.stackexchange.com/2.2/questions/"+QUESTION_ID+"/answers?page="+e+"&pagesize=100&order=desc&sort=creation&site=codegolf&filter="+ANSWER_FILTER}function commentUrl(e,s){return"https://api.stackexchange.com/2.2/answers/"+s.join(";")+"/comments?page="+e+"&pagesize=100&order=desc&sort=creation&site=codegolf&filter="+COMMENT_FILTER}function getAnswers(){jQuery.ajax({url:answersUrl(answer_page++),method:"get",dataType:"jsonp",crossDomain:!0,success:function(e){answers.push.apply(answers,e.items),answers_hash=[],answer_ids=[],e.items.forEach(function(e){e.comments=[];var s=+e.share_link.match(/\d+/);answer_ids.push(s),answers_hash[s]=e}),e.has_more||(more_answers=!1),comment_page=1,getComments()}})}function getComments(){jQuery.ajax({url:commentUrl(comment_page++,answer_ids),method:"get",dataType:"jsonp",crossDomain:!0,success:function(e){e.items.forEach(function(e){e.owner.user_id===OVERRIDE_USER&&answers_hash[e.post_id].comments.push(e)}),e.has_more?getComments():more_answers?getAnswers():process()}})}function getAuthorName(e){return e.owner.display_name}function process(){var e=[];answers.forEach(function(s){var r=s.body;s.comments.forEach(function(e){OVERRIDE_REG.test(e.body)&&(r="
"+e.body.replace(OVERRIDE_REG,"")+"
")});var a=r.match(SCORE_REG);a&&e.push({user:getAuthorName(s),size:+a[2],language:a[1],link:s.share_link})}),e.sort(function(e,s){var r=e.size,a=s.size;return r-a});var s={},r=1,a=null,n=1;e.forEach(function(e){e.size!=a&&(n=r),a=e.size,++r;var t=jQuery("#answer-template").html();t=t.replace("{{PLACE}}",n+".").replace("{{NAME}}",e.user).replace("{{LANGUAGE}}",e.language).replace("{{SIZE}}",e.size).replace("{{LINK}}",e.link),t=jQuery(t),jQuery("#answers").append(t);var o=e.language;/s.lang?1:e.lang<s.lang?-1:0});for(var c=0;c<t.length;++c){var i=jQuery("#language-template").html(),o=t[c];i=i.replace("{{LANGUAGE}}",o.lang).replace("{{NAME}}",o.user).replace("{{SIZE}}",o.size).replace("{{LINK}}",o.link),i=jQuery(i),jQuery("#languages").append(i)}}var ANSWER_FILTER="!t)IWYnsLAZle2tQ3KqrVveCRJfxcRLe",COMMENT_FILTER="!)Q2B_A2kjfAiU78X(md6BoYk",answers=[],answers_hash,answer_ids,answer_page=1,more_answers=!0,comment_page;getAnswers();var SCORE_REG=/<h\d>\s*([^\n,]*[^\s,]),.*?(\d+)(?=[^\n\d<>]*(?:<(?:s>[^\n<>]*<\/s>|[^\n<>]+>)[^\n\d<>]*)*<\/h\d>)/,OVERRIDE_REG=/^Override\s*header:\s*/i;
body{text-align:left!important}#answer-list,#language-list{padding:10px;width:290px;float:left}table thead{font-weight:700}table td{padding:5px}
 <link rel="stylesheet" type="text/css" href="//cdn.sstatic.net/codegolf/all.css?v=83c949450c8b">

Leaderboard

	Author	Language	Size

Winners by Language

Language	User	Score

{{PLACE}}	{{NAME}}	{{LANGUAGE}}	{{SIZE}}	Link

{{LANGUAGE}}	{{NAME}}	{{SIZE}}	Link

• Ahh! It was hard to visit the AskUbuntu Question without giving some golfing tipps. – Roman Gräf Oct 16 '16 at 5:41
• Some of the (shell) answers seem to assume that the path doesn't contain spaces. Should they be corrected? – Dennis Oct 16 '16 at 6:08
• @Dennis Typically, the path variable shouldn't have spaces, but as they can, they should be corrected. However, we can safely assume that paths themselves won't contain : or a newline. – Kaz Wolfe Oct 16 '16 at 7:51
• Is a function acceptable? – corvus_192 Oct 16 '16 at 9:24
• @corvus_192 Unless the challenge explicitly says otherwise, functions are allowed. – Dennis Oct 17 '16 at 15:08

# Z shell (zsh), 13 bytes

<<<${(F)path}  Uses the $path parameter, which is a special array parameter used by the shell that is tied to the $PATH parameter, and a parameter expansion flag to join an array with newlines. • Apparently one does simply out-golf @Dennis... Huh. – wizzwizz4 Oct 17 '16 at 17:45 • How to alias some word to this? I tried alias path="<<<${(F)path}" but when executed it prints /usr/local/bin zsh: no such file or directory: /Library/Apple/usr/bin zsh: no such file or directory: /Library/Apple/bin then goes to sbin – Daniel Springer Jul 18 at 21:14
• @DanielSpringer $path is being expanded during alias definition, which you don't want. Use single quotes instead: alias path='<<<${(F)path}' – GammaFunction Aug 13 at 4:49
• @GammaFunction that worked! Why did double quotes not work? – Daniel Springer Aug 13 at 10:57
• @DanielSpringe Not a lot of space here to explain, here's a pastebin: ix.io/1RyW – GammaFunction Aug 13 at 20:26

## Bash/Coreutils, 17 16 bytes

tr : '
'<<<$PATH  • tr : '\n'<<<$PATH should work as well – Arnauld Oct 15 '16 at 18:54
• It does . . . editing right now – Sergiy Kolodyazhnyy Oct 15 '16 at 18:57
• I think you can remove the spaces around <<< as well (tested on Ubuntu only) – Arnauld Oct 15 '16 at 18:59
• @Arnauld i don't think that's Ubuntu only thing, it's bash thing, so should work accross the distros – Sergiy Kolodyazhnyy Oct 15 '16 at 19:00
• It doesn't save any bytes, but using \\n instead of the quoted variable is more readable imho. – Dennis Oct 16 '16 at 0:23

## Batch, 41 bytes

@for %%a in ("%PATH:;=";"%")do @echo %%~a

PATH is semicolon-delimited on Windows of course. Conveniently, for splits on semicolons by default, but inconveniently, also on spaces, so I have to use string replace trickery to quote each path element before splitting. It then remains to remove the quotes afterwards.

• Running from the command line you can replace %% with % saving 2 bytes. – DavidPostill Oct 16 '16 at 20:08
• @DavidPostill Wouldn't that make it a code snippet rather than a program? – Neil Oct 16 '16 at 20:57
• I'm not sure what the exact code golf rules are, but aren't most of other answers just snippets as well? Most of them require a "shell" of some description to run ... – DavidPostill Oct 16 '16 at 21:08

# Z shell (zsh), 15 bytes

<<<${PATH//:/ }  You can test the code on Anarchy Golf: click use form, select zsh, paste the code and submit. ## Bash (pure), 19 bytes echo "${PATH//:/
}"

Same idea, but with Bash's less golfy syntax. Test it on Ideone.

# Powershell, 20 bytes

$env:PATH-split':'  Edit: • -2 bytes off. Thanks to @TimmyD Old: $env:PATH.split(":")

# Ruby, 25 bytes

puts ENV["PATH"].split":"

• Nice, tiny bit shorter than my answer on the original question on AskUbuntu – Sergiy Kolodyazhnyy Oct 15 '16 at 19:36
• You don't need to count the Ruby invocation, only the program itself, so this is only 26 bytes. – Jordan Oct 16 '16 at 3:01
• @Jordan didn't know that. Is it in FAQ? – Anwar Oct 16 '16 at 5:08
• @Jordan It's shown in the tour itself. So, edited. Thank you for telling that – Anwar Oct 16 '16 at 5:15
• Oh, also you can change split ":" to split":" or split ?: for 1 byte. – Jordan Oct 16 '16 at 5:20

## Perl, 22 bytes

say$ENV{PATH}=~y/:/ /r  Needs -E or -M5.010 to run : perl -E 'say$ENV{PATH}=~y/:/
/r'

### Bash+Python, 43 bytes

Let's use shell's variable expansion. It eliminates calling os.environ , thus less code and less imports. That gives us 46 bytes, and with xnor's trick and removing space before -c we've got 43 bytes.

python -c"print('$PATH'.replace(*':\n'))"  • Note that this fails if a directory with a single quote or a backslash appears in your PATH. – Joey Marianer Oct 16 '16 at 19:54 • @JoeyMarianer Since there can be almost any character in filename/path string, then yes - this may fail and becase PATH will expand to '/dir'1:/dir2' , which gives incorrectly formatted command to python. The backslash doesn't necessarily fail - it just interprets what's in the string itself. IMHO , backslash escapes shouldn't appear in normal user's path names , so for 99% of cases this is OK. I however agree - this should be kept in mind anytime you deal with shell directly or indirectly as in this case – Sergiy Kolodyazhnyy Oct 16 '16 at 20:22 ## Java, 58 bytes System.out.print(System.getenv("Path").replace(';','\n'));  Full program: 106 bytes class E { public static void main (String[] args) { System.out.print(System.getenv("Path").replace(';', '\n')); } }  ## GNU sed + bash, 25 bytes: sed 's/:/\n/g' <<<"$PATH"

If the PATH contains no directory name with whitespace, no quoting needed, 23 bytes:

sed 's/:/\n/g' <<<$PATH  Even shorter, transliterating : to newline, thanks to @Dennis: sed y/:/\\n/<<<"$PATH"

# Vim, 19 bytes

"=$PATH<CR>p:s/:/\r/g<CR> Grab $PATH from the expression register and paste it. Turn the :s into newlines. Nothing tricky.

• They should put this in Vim tutorials. As someone reading about how to get into Vim I appreciate this example. – loa_in_ Oct 16 '16 at 23:04

## PHP, 363533 32 bytes

Saved 1 byte, thanks to Blackhole
Saved 2 bytes, thanks to user59178
saved 1 byte, thanks to Martijn

### *nix version

<?=strtr(getenv(PATH),":","
")?>

### Windows version

<?=strtr(getenv(PATH),";","
")?>

• @RomanGräf *nix is just a way of referring to a Unix-like system. – Arnauld Oct 16 '16 at 11:16
• If you want a "multi-plataform" version, you can use the constant PATH_SEPARATOR – Ismael Miguel Oct 16 '16 at 11:52
• Don't use \n, but a true newline instead, it'll save you one byte. – Blackhole Oct 16 '16 at 18:58
• you can also drop the "s around PATH. You get an "use of undefined constant" notice but it still works, saving you 2 bytes. – user59178 Oct 17 '16 at 13:03
• Using the short echo <?=strtr(getenv(PATH),":","")?> safes a byte (*cant newline in comments) – Martijn Oct 17 '16 at 14:00

# Python 2, 49 bytes

Saving 2 bytes thanks to @xnor and 1 byte by replacing environ with getenv thanks to @Serg and @Oliver

import os
print os.getenv('PATH').replace(*':\n')

For Python 3, just add ( and ) around the print argument and add 1 to the byte count.

• How will this get the input? – Anwar Oct 15 '16 at 19:41
• @Anwar from os.environ['PATH'] , that will return the string – Sergiy Kolodyazhnyy Oct 15 '16 at 19:42
• @Serg ah. got it. – Anwar Oct 15 '16 at 19:46
• replace can take packed arguments replace(*':\n'). – xnor Oct 15 '16 at 20:32
• @KarlNapf Yea, thats the point. This program as-is does not run in Python 3, so you should specify the version it works with. – Denker Oct 15 '16 at 23:34

# C, 85 84 bytes

-1 byte for using #import

#import<stdlib.h>
main(){char*a=getenv("PATH");while(*a)putchar(*a++==58?10:a[-1]);}

## Racket 39 bytes

Using sed command of @heemayl :

(system "sed 's/:/\\n/g' <<<\"$PATH\"")  Ungolfed: (define (f) (system "sed 's/:/\\n/g' <<<\"$PATH\"")
)

Testing:
(f)

Output:

/usr/local/bin
/usr/bin
/bin
/usr/games
/usr/lib/java/bin
/usr/lib/java/jre/bin
#t

# Scala, 31 bytes

sys env "PATH"replace(':','\n')

In scala, a b c is syntactic sugar for a.b(c), so this compiles to sys.env("PATH").replace(':','\n')

# Perl 6,  28 25  24 bytes

%*ENV<PATH>.split(':')».put

put %*ENV<PATH>~~tr/:/\n/

put %*ENV<PATH>~~tr/:/
/

# C#, 64 bytes

x=>Environment.GetEnvironmentVariable("PATH").Replace(";","\n");

Anonymous function which returns the path variable, each directory on a separate line. Note that x is just a dummy object to save 1 byte instead of using ().

Full program:

using System;

namespace ExportPathVariable
{
class Program
{
static void Main(string[] args)
{
Func<object,string>f= x=>Environment.GetEnvironmentVariable("PATH").Replace(";","\n");

Console.WriteLine(f(0));
}
}
}

Also works on UNIX systems if you replace ; with :, presuming Mono libraries are available. Try it online on ideone, .NET Fiddle returns a security exception.

Alternatively, a full C# program, which is rather verbose:

# C#, 118 bytes

using System;class P{static void Main(){Console.Write(Environment.GetEnvironmentVariable("PATH").Replace(";","\n"));}}

import System.Environment
m ':'='\n'
m x=x

bash-4.3$jq -nr 'env.PATH/":"|.[]' /usr/local/sbin /usr/local/bin /usr/sbin /usr/bin /sbin /bin  # Awk, 51 44 characters BEGIN{$0=ENVIRON["PATH"];gsub(":",RS);print}

Thanks to:

• ninjalj for suggesting to use gsub() instead of manipulating built-in variables (-7 characters)

The typical awk way would be to set up the built-in variables which influences how awk manipulates the data automatically:

BEGIN{FS=":";OFS=RS;$0=ENVIRON["PATH"];$1=$1;print}  Sample run: bash-4.3$ PATH='/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin'

bash-4.3$awk 'BEGIN{FS=":";OFS=RS;$0=ENVIRON["PATH"];$1=$1;print}'
/usr/local/sbin
/usr/local/bin
/usr/sbin
/usr/bin
/sbin
/bin

• Doh. You are right, @ninjalj. I was to focused on doing it in awk-specific way. Thank you. – manatwork Oct 19 '16 at 7:41

# Node.js, 36 bytes

_=>process.env.PATH.split:.join

Pretty straight forward.

# MATLAB, 34 bytes

disp(strrep(getenv('PATH'),58,10))

Here is an online demo in Octave with a slight modification since strrep in octave requires the second and third inputs to be char variables rather than numeric values.

# R, 38 bytes

cat(gsub(":","\n",Sys.getenv('PATH')))

Grab the $PATH, replace : with newlines and prints to stdout. You can try it online here. # Groovy, 43 Bytes System.env['PATH'].replaceAll(":","\n")  # Gema, 36 characters \A=@subst{\\:=\\n;@getenv{PATH}}@end  Sample run: bash-4.3$ PATH='/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin'

bash-4.3\$ gema '\A=@subst{\\:=\\n;@getenv{PATH}}@end'
/usr/local/sbin
/usr/local/bin
/usr/sbin
/usr/bin
/sbin
/bin

# Befunge-98 + EVAR fingerprint, 34 bytes

"RAVE"4("HTAP"Gv
:!k@:':-!'0*-, >

Loads the EVAR fingerprint ("RAVE"4() to easily access environment variables, gets the PATH envvar ("HTAP"G), and for each character, exits the program if the character is "\0" (:!k@), substracts ASCII 48 "0" if the char is ASCII 58 ":" (:':-!'0*-), and outputs the character (,).

# ELF/x86, 78 bytes

00000000  7f 45 4c 46 01 00 00 00  43 0f 00 00 43 5f eb 10  |.ELF....C...C_..|
00000010  02 00 03 00 0c 50 eb 10  0c 50 eb 10 04 00 00 00  |.....P...P......|
00000020  5f 5f b1 05 be 49 50 eb  10 3d 20 00 01 00 5f f3  |__...IP..= ..._.|
00000030  a6 75 ef 89 f9 80 3f 3a  75 03 80 2f 30 42 ae 75  |.u....?:u../0B.u|
00000040  f4 4a 04 04 cd 80 93 cd  80 50 41 54 48 3d        |.J.......PATH=|
0000004e

NASM source:

BITS 32                                         ;
ORG 0x10eb5000                                  ;
DB 0x7f,'E','L','F'                             ; | magic       |    +--------------------+
; |             |    |                    |
; PROGRAM HEADERS                               ; |             |    |                    |
DD 1                                            ; |*class   32b | -- | type: PT_LOAD      |
; |*data   none |    |                    |
; |*version   0 |    |                    |
; |*ABI    SysV |    |                    |
DD 0xf43        ; offset = vaddr & (PAGE_SIZE-1); |*ABI vers    | -- | offset             |
; |             |    |                    |
entry:  inc     ebx     ; STDOUT_FILENO         ; |*PADx7       | -- | vaddr = 0x10eb5f43 |
pop     edi     ; discard argc          ; |             |    |                    |
jmp     short skip                      ; |             |    |                    |
DW 2                                            ; | ET_EXEC     | -- |*paddr LO           |
DW 3                                            ; | EM_386      | -- |*paddr HI           |
DD 0x10eb500c                                   ; |*version     | -- | filesz             |
DD 0x10eb500c                                   ; | entry point | -- | memsz              |
DD 4                                            ; | ph offset   | -- | flags: RX          |
; |             |    |                    |
skip:   pop     edi     ; discard argv[0]       ; |*sh offset   | -- |*align              |
pop     edi     ; discard argv[1]=NULL  ; |             |    |                    |
env:    mov     cl,5    ; \ strlen("PATH=")     ; |             |    |                    |
mov     esi,PATH; > "PATH="             ; |*flags    /--|    |                    |
DB 0x3d         ; cmp eax,0x10020               ; |*ehsize      |    +--------------------+
DW 32                                           ; | phentsize   |
DW 1                                            ; | phnum       |
; |             |
pop     edi     ; > envp                ; |*shentsize   |
repe    cmpsb   ; > strcmp(envp,"PATH="); |*shnum       |
jne     env     ; /                     ; |*shstrndx    |
mov     ecx,edi                         ; +-------------+

nlcolon:cmp     byte[edi],58  ; \ if (char == ':')
jne     nosub         ; >
sub     byte[edi],48  ; >   char -= '0'
nosub:  inc     edx           ; > wlen++
scasb                 ; >
jne     nlcolon       ; / while(char != 0)

dec     edx           ; wlen--


text:
# Solve this partial diff. equation using substitution

## Homework Statement:

$$yx'_x - xz'_y = xyz$$
Solve by variable change:
$$u = x^2 + y^2$$
$$v = e ^{-x^2/2}$$

## Relevant Equations:

None.
I completely forgot how to solve these so heres my attempt:
$$z = au + bv$$
$$z = a(x^2 + y^2) + be ^{-x^2/2}$$
$$z'_x = 2ax - bxe ^{-x^2/2}$$
$$z'_y = 2ay$$
Put that into the original equation and you get
$$y * (2ax - bxe ^{-x^2/2}) -x * (2ay) =$$
$$-ybe^{-x^2/2} = xyz$$
$$z = -be^{-x^2/2}/x$$

But the solution should be
$$e^{-x^2/2} * f(x^2 + y^2)$$

Did I do everything wrong or just missed something here?

## Answers and Replies

Related Calculus and Beyond Homework Help News on Phys.org
fresh_42
Mentor
What is ##x'_x##?

What is ##x'_x##?
If I extract x from u = x^2 + y^2 I get:
$$x = sqrt(u - y^2)$$
and getting the derivative requires me to replace u, which leads to x = x so idk :/

pasmith
Homework Helper
Is the PDE $$y\frac{\partial z}{\partial x} - x \frac{\partial z}{\partial y} = xyz$$

Your "relevant equations" is missing the chain rule: $$\frac{\partial z}{\partial x} = \frac{\partial z}{\partial u} \frac{\partial u}{\partial x} + \frac{\partial z}{\partial v} \frac{\partial v}{\partial x}$$

etotheipi
haruspex
Science Advisor
Homework Helper
Gold Member
@Addez123 , Why do you think that particular change of variables is helpful for this equation?
I had more success writing the equation as ##\frac{z_x}x-\frac{z_y}y=z##, then reasoning that I needed solutions like ##\frac{z_x}x=Az## etc.

Last edited:
epenguin
Homework Helper
Gold Member
Addez has not answered the question asked (#2) which, put another way is: it is not clear what the question is and its formula looks to be a mistranscription so can we be informed/confirmed what our problem is?

haruspex
Science Advisor
Homework Helper
Gold Member
Addez has not answered the question asked (#2) which, put another way is: it is not clear what the question is and its formula looks to be a mistranscription so can we be informed/confirmed what our problem is?
It is obvious enough that ##x_x## is a typo for ##z_x##, and that the primes in ##z'_x## etc. are redundant. In post #1, @Addez123 differentiated the expression substituted for z partially wrt x and wrote the result as ##z'_x=...##.


text:
# Showkey with cleveref and amsmath

I have the following problem with showkeys. When use in combination with cleveref and amsmath the label for equation get some extraneous curly brackets. For example im compile the following the label for the equation will be {test2}.

\documentclass{article}
\usepackage{showkeys}
\usepackage{amsmath}
\usepackage{cleveref}
\begin{document}
\section{Test}\label{test1}
$$\label{test2} \overline{a}=b$$
\end{document}

However, if a comment either amsmath or cleveref the label get fixed, i.e only test2.

• Welcome to TeX.SX! I think you should live with the extra braces. – egreg Jul 12 '16 at 9:01
• If I don't use amsmath there is no {...} pair, even with cleveref – user31729 Jul 12 '16 at 9:01
• you are loading three packages all of which redefine the label handling here. Since showkeys is just for draft usage I am, for once, inclined to agree with @egreg here. – David Carlisle Jul 12 '16 at 9:02


text:
# Vector Algebra: Finding a parallel vector

Tags:
1. Apr 10, 2016

### squelch

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

A line is given by the equation $x + 2y - 3z = 7$.
Find any vector in the direction parallel to this line in the Cartesian coordinate system.

2. Relevant equations

I imagine that there are some fundamental relationships I am missing here that would make this more comprehensible to me.

3. The attempt at a solution

Looking at the problem at the surface it would make much more sense if he had described the equation as a "plane" rather than as a "line," and if he were asking for a vector either orthogonal or parallel to the plane. As it is, it's quite confusing. I've been sifting through materials but I can't get past that this looks like the equation for a plane, not a line, and it's worded (and written) very specifically -- the notation above is the notation the professor used (no vectors, "hats," etc, but that notation appears in other questions immediately around this one, so I feel he omitted it on purpose).

What I think I want to do is convert this to a vector equation of a line in form
$\mathord{\buildrel{\lower3pt\hbox{\scriptscriptstyle\rightharpoonup}} \over r} = \left\langle {{x_0},{y_0},{z_0}} \right\rangle + t\left\langle {a,b,c} \right\rangle$, but I'm not sure how to do that from this form.

2. Apr 10, 2016

### Math_QED

What are the coordinates of the vector that describe the direction of this line? Once you have this, the problem is trivial. You might want to use parametric equations.

3. Apr 10, 2016

### squelch

Finding that is, I think, precisely my problem. I have a candidate relation:
$$\hat x{A_x} + \hat y{A_y} + \hat z{A_z} = \mathord{\buildrel{\lower3pt\hbox{\scriptscriptstyle\rightharpoonup}} \over A}$$
But I'm not completely sure if I am using it correctly if I say:
$$\hat x + \hat y2 - \hat z3 = \mathord{\buildrel{\lower3pt\hbox{\scriptscriptstyle\rightharpoonup}} \over A}$$

4. Apr 10, 2016

### Math_QED

The coordinate of this vector is any (x,y,z) for which: x + 2y - 3z = 0

This is the line going through (0,0,0), any coordinates on this line are coordinates of the direction of the vector you seek. Do you understand why?

5. Apr 10, 2016

### squelch

I do not, precisely. I'm still not getting past the idea that the equation seems to describe a plane to me. It seems that if I pick any z, there would be infinitely many x and y that satisfy the equation, and that I wouldn't be able to pick out a particular direction.

6. Apr 10, 2016

### Math_QED

As far as I can tell, this is a plane and not a line. Forget what I posted before (it's been a long time since I used this). The intersection of two planes would be the line, the equation represents an infinite amount of lines, aka a plane.

7. Apr 10, 2016

### Staff: Mentor

I agree. The equation above is definitely that of a plane.

8. Apr 10, 2016

### squelch

So I suppose my only recourse here is to go ask for clarification from the actual professor.

Thanks for the sanity check.


text:
# Using field axioms for a simple proof

Question: If $F$ is a field, and $a, b, c \in F$, then prove that if $a+b = a+c$, then $b=c$ by using the axioms for a field.

Relevant information:
Field Axioms (for $a, b, c \in F$):

$a+b = b+a$ (Commutativity)
$a+(b+c) = (a+b)+c$ (Associativity)
$a+0 = a$ (Identity element exists)
$a+(-a) = 0$ (Inverse exists)

Multiplication:
$ab = ba$ (Commutativity)
$a(bc) = (ab)c$ (Associativity)
$a1 = a$ (Identity element exists)
$aa^{-1} = 1$ (Inverse exists)

Distributive Property:
$a(b+c) = ab + ac$

Attempt at solution:
I'm not sure where I can begin. Is it ok to start with adding the inverse of a to both sides, as in the following?
$(a+b)+(-a) = (a+c)+(-a)$ (Justification?)
$(b+a)+(-a) = (c+a)+(-a)$ (Commutativity)
$b+(a+(-a)) = c+(a+(-a))$ (Associativity)
$b+0 = c+0$ (Definition of additive inverse)
$b = c$ (Definition of additive identity)

I'm wondering about my very first step. Specifically, the axioms don't mention anything about doing something to both sides of an equation simultaneously. Is there some other axiom I can use to justify this step?

This is Exercise 1, part b in Section 1 on page 2 of Halmos, Finite Dimensional Vector Spaces (reading book for fun--this is not homework (probably too easy to be a homework problem anyway!)). In part a, I proved that $0+a = a$, in case that is somehow helpful in this problem. Thanks!

• Just a minor note: you may want to write $1/a$ as $a^{-1}$ because you would want to define "/" later using the inverses and it wouldn't be good to have syntax with ambiguous parsing. – user21820 Jan 25 '14 at 11:33
• That's a good idea--I made the change. – Mike Bell Jan 25 '14 at 11:44

Martín-Blas Pérez Pinilla suggests that "=" can be considered a logical symbol obeying logical axioms. While I agree that it fundamentally is so, I would like to note that it is possible to consider it an equivalence relation obeying 'internal' field axioms, because for example the rational numbers can be taken as equivalence classes of a certain set of pairs of integers, and so it is not quite right to consider the equality between these rationals as a logical equality. Also, Ittay made a mistake where he used an unstated axiom that allows substitution. What you need, either way, is something equivalent to the following for any field $F$:

$a=a$ for any $a \in F$ [reflexivity of =]

$a=b \Rightarrow b=a$ for any $a,b \in F$ [commutativity of =]

$a=b \wedge b=c \Rightarrow a=c$ for any $a,b,c \in F$ [transitivity of =]

(These describe "=" as an equivalence relation on $F$)

$a=b \Rightarrow P(a)=P(b)$ for any $a,b \in F$ and predicate $P$ [substitution]

(This describes substitution, which can be used to replace separate axioms governing how "=" and the field operations interact. Ittay used this in one of his steps.)

These allow us to "do the same thing to both sides", for example:

For any $a,b,c \in F$ such that $a=b$,

Let $d=a+c$ [closure under +]

$a+c=a+c$ [transitivity of =; $a+c=d=a+c$]

$a+c=b+c$ [substitution; where the predicate is given by $P(x) \equiv (a+c=x+c)$]

Note that to prove that something is a field, we will have to prove the substitution axiom, which boils down to proving the following equivalent set of axioms:

$a=b \Rightarrow a+c=b+c$ for any $a,b,c \in F$

$a=b \Rightarrow ac=bc$ for any $a,b,c \in F$

The original problem can then be proven as follows:

For any $a,b,c \in F$ such that $a+b=a+c$,

$b = 0+b = (-a+a)+b = (-a)+(a+b) = (-a)+(a+c) = (-a+a)+c = 0+c = c$

• Hurkyl had given a comment indicating that we could use substitution of an argument of $+$ considered as a 2-argument function. As I noted, fields constructed through equivalence relations will still require one to prove the substitution rule before using, so it amounts to the same two more basic axioms that I gave. – user21820 Jan 25 '14 at 11:48

The first step is justified by the existence of $-a$. No further axiom is required in order to deduce that $(a+b)+(-a)=(a+c)+(-a)$. To see that, just write $a+b=y=a+c$ (after all, it is given that $a+b=a+c$). Now, one of the information defining a field is the function of addition: $(u,v)\mapsto u+v$. Applying it to $u=y$ and $v=(-a)$, yields the element $y+(-a)$. But, since $y=a+b$, $y+(-a)=(a+b)+(-a)$. Similarly, since $y=a+c$, $y+(-a)=(a+c)+(-a)$. By transitivity of equality, it follows that $(a+b)+(-a)=(a+c)+(-a)$.

Note that it would be a lot easier to add $(-a)$ on the left rather than on the right. It will save you using commutativity.

• The step where you substitute $(a+b)$ into $y$ requires another axiom such as substitution. (See my answer.) With substitution or the alternative, you can just do it in one line. And that very axiom is the most important part of the problem! – user21820 Jan 25 '14 at 11:19
• Yes, you can put $(-a)$ on the left. But the axiom says $a + (-a) = 0$, not $(-a) + a = 0$. So you have to use Commutativity anyway! – TonyK Jan 25 '14 at 11:26

"Specifically, the axioms don't mention anything about doing something to both sides of an equation simultaneously." Because is a logical axiom. If you have two equal things and do the same with both things the results are equal. Search "first order logic with identity".

• See also en.wikipedia.org/wiki/…, for when we don't have two equal things but have two things that behave the same way under some operations, and we still want to have 'substitution'. – user21820 Jan 25 '14 at 11:29


text:
# Thread: Solving for X

1. ## Solving for X

Sorry I am getting errors with latex so ill post in text form, I am getting an answer but I do not think it is right hopefully someone can tell me where I went wrong.

2 * (0.1)^(x+1) = 25

to clarify 2 times 0.1 to the power of x +1 equals 25

I got :

2 * x + 1 * log 0.1 = 25

2 * x * log 0.1 = 24

x * log 0.1 = 12

x = 12 / log 0.1

x = -12

Any input would be appreciated. Thanks

2. 2 * (0.1)^(x+1) = 25

First divide both sides by 2.

(0.1)^(x+1) = 25/2

Now take logs of both sides

3. Hello, maca404!

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

QUOTE

2*(0.1)^{x+1} .= .25

I got: .2 * x + 1 * log 0.1 .= .25
. . Wow ... This is really wrong!

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

We have: . . .2(0.1)^{x+1} .= .25

Divide by 2: . .(0.1)^{x+1} .= .12.5

Take logs: .log(0.1)^{x+1} .= .log(12.5)

. . . . . . . . . . (x+1)log(0.1) .= .log(12.5)

. . . . . . . . . . . . . . . . . . . . . . . log(12.5)
. . . . . . . . . . . . . . . . x + 1 .= .----------
. . . . . . . . . . . . . . . . . . . . . . . .log(0.1)

. . . . . . . . . . . . . . . . . . . . . . . log(12.5)
. . . . . . . . . . . . . . . . . . . x .= .---------- - 1
. . . . . . . . . . . . . . . . . . . . . . . .log(0.1)

4. Tattoo this on your wrist: if a^p = b, then p = log(b) / log(a)


text:
2016 Census Data - Part 1

A first look at the 2016 census.

Finally the first batch of 2016 census data has arrived on Tuesday AM and CensusMapper was updated with the new census numbers by mid-morning.

Dissemination Block data was a little harder to find, but with the help of some friendly StatCan people I finally managed to locate the data and add that too this afternoon.

Time for writing up some observations. I am hoping to find time to do this regularly as more data gets released.

The first batch of data only comes with three variables: Population, dwellings and households. And two more, a data quality flag indicating areas with incomplete enumeration and the area of each geographic region. Area itself is more tricky than it seems at first, one has to make decisions what to count. Lakes? Rivers? National or Regional Parks?

Next to these variables, we also got the corresponding 2011 population for all geographic regions at the CT/CSD level and above to aid the comparison, but these were not available at the DA or DB level.

The variables seem straight forward, but nothing is simple when it comes to big projects like a census, so it might we worthwhile to spend a little bit of time looking at them.

Population

The quintessential census variable counts the number of people in each census region. With the exception of people that have a primary residence elsewhere in Canada or abroad. There are several reasons for this, the simples one is to avoid the double-counting of people.

Dwellings

“Dwellings” is short for “private dwellings”, this does not count collective dwellings like prisons, student dorms, hospitals or nursery homes or even some coops. This can lead to interesting situation where there are zero private dwellings (and zero households) but non-zero population. Metro Vancouver has 45 such dissemination blocks. But these people are only counted if they don’t have a primary residence somewhere else, which often is the case for students in dorms. But not for all students, as the Dissemination Block on UBC campus that’s wedged between NW Marine, University, Lower Mall and Agronomy shows. It has zero dwellings, zero households, but a population of 890 people.

Households

The “dwellings, occupied by usual residents” is also called “households”. It refers to a private dwelling that is used as a primary residence, and the inhabitants make up a household. If inhabitants of a dwelling only live there temporarily and/or has a primary residence somewhere else in Canada or abroad, then they are not counted in the population nor the household counts.

Unoccupied Dwellings

The difference between dwellings and households is “dwellings, not occupied by usual residents”. Essentially, that’s dwellings that are not used as primary residences. It’s a fun variable to look at, and it is available at the very fine Census Block level. In some cases, a Census Block can contain just one apartment building.

Mixing Variables

The fun starts when we mix these variables. And compare them to the previous censuses. And there are lots of ways to do that, here are a few:

Population Change

The most immediate variable to look at is population change. We have complete Canada-wide data at the CT level or above, but if we are really interested we can also view this data for DAs and DBs that stayed the same across the census years. The issue with doing that is that some regions will have not data, and one has to be very careful not to read too much into an incomplete dataset. Which is why I usually don’t like giving out maps that contain incomplete data like this. But this is great for diving into specific regions to get more information.

Dwelling Change

This is a great way to see where more dwellings got built. This only measures net changes, so even if a region shows zero dwelling increase, there could have been quite a bit of construction in the area. In particular, if houses with secondary suites get torn down and replaced by houses without secondary suites, it will show up as a decline in the number of dwelling units.

Non-primary residence dwellings

More formally, these are “dwellings not occupied by usual residents”, it’s the difference between dwellings and households and the object of continued scrutiny in Vancouver. And a good portion of these are the target of the upcoming empty home tax to either monetize non-primary resident homes or nudge them into the rental market.

Household size change

A big part of population change is the change in household size. Canada wide the trend to smaller households is continuing. That means that if the number of dwellings and the rate of unoccupied dwellings in a region remain unchanged, then the population in the area will decline if it follows the national trend to smaller household size.

Population Change Null Sum Game

From looking at CensusMapper, the variable that got by far the most attention nationally in the past three days is Population Change. It’s great to see where population grew or declined. But almost immediately people wonder why population change was different in one region compared to another.

The first step to this is the Population Null Sum Game. You need the

• Dwelling Change
• Change in Unoccupied Dwellings
• Change in Household size

to play. The game is then to express Population Change in terms of those three, and thus “explaining” population change in terms of these variables. There are of course other ways to split up the Population Change variable, but I find this a useful one.

Nathaniel Lauster kicked the game off with this great post. Let’s follow up his inter-municipal level analysis with some intra-municipal numbers.

We will focus on the City of Vancouver only. People are welcome to use CensusMapper to repeat this for whatever region they are interested in. Vancouver has the nice advantage that at the dissemination area geography only on change was made. A 2011 downtown DA got split into two for 2016. That makes it very easy to carry this out at the DA level.

Components of Population Change

First we refine our variables a little bit it seems more interesting to use the rate of unoccupied builings as a variable, rather than the number of these. We want to express population change Δpop as a linear combination of

• Dwelling change Δdw
• Change in ratio of unoccupied dwellings Δur
• Change in household size Δhs

More formally:

Δpop = hs₁₁ * (1-ur₁₁) * Δdw - hs₁₁ * dw₁₆ * Δur +  hh₁₆ * Δhs

where hs₁₁=pop₁₁/hh₁₁ is the household size in 2011 as computed by dividing the population by the number of households, ur₁₁ is the rate of unoccupied dwellings in 2011, dw₁₆ is the number of dwellings in 2016 and hh₁₆ is the number of households in 2016.

It is simple algebra to check that the identity holds.

The first term gives the contribution to population growth due to the growth in dwellings, assuming that household size and the rate of unoccupied dwellings are unchanged from 2011.

The second term give the population growth due to the change in the rate of unoccupied dwellings and the third term gives the population growth due to a change in household size.

Great, all that’s left to do is to type the formula into CensusMapper and graph the relative contribution of each of these terms. To make this work we will have to make due with using only the magnitude of each term, but we can visualize the sign in the bar graph widget when we hover over an area.

This makes it very easy to compare different areas and see how the different components contribute to the change in population in each area.


text:
## Algebra 1: Common Core (15th Edition)

Length (ft)= y Area (square ft)=$y^{2}$ $430= 3\times y^{2}$ $430\div3= 143.33...$ $y^{2}=143.33...$ $y^{2}=143 \frac{1}{3}$ $y= \sqrt (143 \frac{1}{3})$ $y=11.972$ $y\approx12$


text:
## anonymous 5 years ago I am studying radical equations, how can I solve sqrt(x+16) - sqrt(x) = 2 I was shown that squaring each side of the equation will eliminate the radical, but even when I move one radical to the right side of the equation I end up cancelling x.

1. anonymous

$\sqrt{x+16} - \sqrt(x) = 2$

2. anonymous

Try squaring both sides twice.


text:
Binary Tree Preorder Traversal

What is the best way to move _add and _preorder methods in class Node to add_node and preorder methods in class BinaryTree such that they have the below class structure:

class Node:
__init__
__repr__

class BinaryTree:
__init__
preorder

Complete Code::

class Node(object):

def __init__(self, item, left=None, right=None):
self.item = item
self.left = None
self.right = None

def __repr__(self):
return '{}'.format(self.item)

new_node = Node(value)

if not self.item:
self.item = new_node
elif not self.left:
self.left = new_node
elif not self.right:
self.right = new_node
else:
return self

def _preorder(self):
print(self.item)
if self.left:
self.left._preorder()
if self.right:
self.right._preorder()

class BinaryTree(object):

def __init__(self):
self.root = None

if not self.root:
self.root = Node(value)
else:

def preorder(self):
if self.root:
return self.root._preorder()

if __name__ == '__main__':

binary_tree = BinaryTree()
print( "Adding nodes 1 to 10 in the tree...")
for i in range(1, 11):

print()
print( "Printing preorder...")
binary_tree.preorder()

class Node(object):

def __init__(self, item, left=None, right=None):
self.item = item
self.left = None
self.right = None

The parameters left and right are not used in the constructor! Remove them, or actually use them.

    def _add(self, value):
new_node = Node(value)

if not self.item:
self.item = new_node
...

Given self.item is unconditional set in the constructor, this first test seems unnecessary.

        elif not self.left:
self.left = new_node
elif not self.right:
self.right = new_node

Your binary tree does not seem to have any ordering imposed on the left/right nodes. If there is no left node, you create one even if the new value is larger than the current node. Similarly, if there is a left node, but no right node, you create a right node even if the value is smaller than the current node.

        else:
return self

Finally, if both left and right exist, you unconditionally add the new node to the left sub tree, which will create a very unbalanced tree. Moreover, the newly created new_node is discarded, to be recreated by the _add() method one level down, so is wasteful. And the sole purpose of return self seems to be so that there is a return value to assign to self.left, which results in the the original value self.left being assigned to itself, so again useless busy work.

A binary tree does not have any ordering imposed - nodes are added in the following preference: root -> left -> right. Ordering is imposed i[sic] a binary search tree. – Saurabh

With your sample code, adding the values 1 to 10 to your BinaryTree, you get the following "tree":

                           1
/ \
2   3
/ \
4   5
/ \
6   7
/ \
8   9
/
10

This is not really a binary tree; it is a stick with leaves. It could be represented as a list of tuples: [(1,3), (2,5), (4,7), (6,9), (8,), (10,)].

If you wish to create a general binary tree, which does not impose an ordering, you need to include methods for building the desired tree, such as finding the "5" node, and explicitly adding to the right branch. A generic add_node() doesn't have enough detail to control how the tree is built.

• A binary tree does not have any ordering imposed - nodes are added in the following preference: root -> left -> right. Ordering is imposed i a binary search tree. Feb 17 '20 at 23:43

First, some general notes:

1. Eliminate unused complexity. A couple of examples of this are your node constructor, which takes two optional arguments that you never use, and your __repr__, which specifies a format string but doesn't add any extra formatting -- if code is "dead" (i.e. no part of your program uses it), get rid of it so that human readers don't need to read it.

2. You don't strictly need typing in Python code, but it's a good habit to build early since it makes your code easier to check for correctness and it makes it easier for a reader to understand quickly what it does -- for example, in your __main__ function I see that you build a tree with integers in it, but could we pass other types of things as items? Using a TypeVar lets you define what sorts of types it's okay to put in your container (or, if it's only supposed to hold one type, you could just annotate item with that type in order to make that explicit).

3. preorder doesn't seem like a good name for this function, since I don't see that it's "ordering" anything (usually a method name is a verb that says what you're doing, not how you're doing it); the actual effect is to print out the tree. I'd call it something more obvious like print.

Now, as to your question of whether it makes sense to move logic from the Node to the BinaryTree -- IMO when you're working with trees it feels a lot more natural to have the nodes be "smart" so your top level methods can just figure out which subtree should handle a particular task and then delegate it. Here's what your tree might look like with more of the logic moved toward the top; you can judge for yourself whether having the logic in BinaryTree is any better than having it in Node:

from typing import Generic, Optional, TypeVar

# These are the kinds of values that can go in our tree.
V = TypeVar('V', int, float, str)

class Node(Generic[V]):
"""A node in a binary tree."""
def __init__(self, item: V):
self.item: V = item
self.left: Optional['Node'] = None
self.right: Optional['Node'] = None

def __repr__(self) -> str:
return repr(self.item)

class BinaryTree(Generic[V]):
"""A binary tree."""
def __init__(self):
self.root: Optional[Node[V]] = None

def add_node(self, value: V) -> None:
"""Add the given value to the tree."""
if not self.root:
# This is the first node; make it the root.
self.root = Node(value)
return

child = Node(value)
# Find a spot under the root to add the new child node.
node = self.root
while node:
if value < node.item:
if node.left:
node = node.left
else:
node.left = child
return
elif value > node.item:
if node.right:
node = node.right
else:
node.right = child
return
else:
return

def print(self):
"""Print out the tree."""
def print_node(node: Optional[Node[V]]) -> None:
if not node:
return
print_node(node.left)
print(node)
print_node(node.right)
print_node(self.root)

• Preorder traversal of a tree is a well-known and well-defined term. I don't see anything wrong with it, although I do agree that the printing functionality is unnecessarily hard-coded. Your reimplementation prints the tree in-order, which is not what OP wanted. No offense intended, but I suggest you do some studying on basic algorithms. Feb 17 '20 at 2:08
• Made that comment a little clearer. Generally you want to name a function by what it does rather than how, why, or where it does it -- function names like recursive and helper and iterate show up a lot in sample code (and code written by new grads) but they're bad habits to get into. :) Feb 17 '20 at 2:33
• You have completely changed the behaviour of add_node(). The OP’s code did not enforce a less-than/greater-than ordering to the left/right children. Probably a bug in the OP’s implementation, but you’ve altered the behaviour without even mentioning it. Additionally, your implementation does not allow the tree to contain duplicate values. Finally, the __repr__ function is not “dead” code; it changes the representation of a node into the string of the value contained that node. Feb 17 '20 at 6:58
• I agree with all your points, but the add_node method in your answer is for a binary search tree and NOT a binary tree. Also, the print method is inorder and NOT preorder. Feb 17 '20 at 23:08