text
stringlengths
49
10.4k
source
dict
python, beginner, strings, parsing, bioinformatics org_dict = {} symbols = '' for line in fileinput.input(): label, content = line[:45].rstrip(), line[45:].rstrip() if label.startswith('gi|'): org_dict[label] = org_dict.get(label, '') + content elif content and not label: symbols += content for key, value in org_dict.items(): print(key, value) print(symbols) More efficient version, because Python strings are immutable, and thus repeated string concatenation is not recommended: import fileinput org_dict = {} # Keys are creature labels; values are lists of AA strings symbols = [] for line in fileinput.input(): label, content = line[:45].rstrip(), line[45:].rstrip() if label.startswith('gi|'): org_dict.setdefault(label, []).append(content) elif content and not label: symbols.append(content) # Collate data into strings org_dict = {label: ''.join(contents) for label, contents in org_dict.items()} symbols = ''.join(symbols) for key, value in org_dict.items(): print(key, value) print(symbols)
{ "domain": "codereview.stackexchange", "id": 17976, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "python, beginner, strings, parsing, bioinformatics", "url": null }
condensed-matter, material-science, x-ray-crystallography You also have instrumental broadening that you can measure on a standard sample in the same instrument. The Scherrer equation ignores the strain broadening and this method is frowned upon nowadays. A few decades later, in 1950s, two other classical methods have been devised: Williamson-Hall and Warren-Averbach. They give two numbers: size and strain. But nowadays they are also regarded as too simplistic. In 1980s and '90s the double-Voigt method has been developed and it became one of the mainstream size-strain methods. It characterizes the size with two numbers (because normally you have a distribution of domain sizes, not a single size). More recently, the WPPM method became popular. I'm not in this field, but my impression is that the WPPM and perhaps also the double-Voigt method are nowadays considered the methods of choice.
{ "domain": "physics.stackexchange", "id": 60931, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "condensed-matter, material-science, x-ray-crystallography", "url": null }
# Showing Green's function on a Riemann surface can be pulled back I want to prove the following: Let $R,S$ be two Riemann surfaces, and suppose Green's function $g_S$ exists for $S$. Let $f: R \to S$ be a nonconstant analytic function. Prove that Green's function $g_R$ exists for $R$, and $g_R(p,q) \leq g_S(f(p),f(q))$ for all $p,q \in R$. This is an exercise in Gamelin's book, XVI.3.2. The exercise does not forbid $f$ being constant, but it seems evidently necessary. ## Some thoughts Let $(U, z)$ be a coordinate patch of $R$ containing $q$ with $z(q) = 0$, let $v$ be a subharmonic function in $R \setminus\{q\}$ with compact support such that $$\limsup_{x \to q} v(x)+\log |z(x)|< \infty,$$ then by definition $g_R(\cdot,q)$ is the supremum of all such $v$, so it is enough to prove that $v(p) \leq g_S(f(p), f(q))$. Letting $(V,w)$ be a coordinate chart around $f(q)$ in $S$ with $w(f(q)) = 0$, we know that $$\lim \limits_{x \to q} g_S(f(x),f(q))+\log |w(f(x))|$$ exists, as the function is even harmonic there. Subtracting, we get that $$\limsup \limits_{x \to q} \;v(x)- g_S(f(x),f(q))+\log \lvert \frac{z(x)}{w(f(x))}\rvert < \infty.$$
{ "domain": "stackexchange.com", "id": null, "lm_label": "1. YES\n2. YES", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.9871787830929848, "lm_q1q2_score": 0.8024453606884968, "lm_q2_score": 0.8128673087708699, "openwebmath_perplexity": 60.99791386797162, "openwebmath_score": 0.9430509209632874, "tags": null, "url": "https://math.stackexchange.com/questions/2500481/showing-greens-function-on-a-riemann-surface-can-be-pulled-back/2507279" }
c, multithreading, memory-management, linux, socket if(read_bytes < 0 ){ quit_with_error("Read failure."); } if( read_bytes == 0 ){ continue; } if( buffer[0] == MSG_SUBMIT ){ struct Job job; memcpy(&job, &buffer[1], sizeof(struct Job)); job.id = job_id++; pthread_mutex_lock(m->waiting_lock); char time_buffer[15] = {0}; time_t now = time(NULL); strftime(&time_buffer[0], 15, "%d-%m %H:%M:%S", localtime(&now)); fprintf(stderr, "[%s] Adding job to waiting_queue: %ld\n", &time_buffer[0], job.id); push_back(m->waiting_queue, job); pthread_mutex_unlock(m->waiting_lock); char answer_buffer[ANSWER_BUFFER] = {0}; sprintf(&answer_buffer[0], "Job submitted. Id: %ld\nEnter jobq status to check status.\n", job.id); send(temp_descriptor, answer_buffer, strlen(answer_buffer), 0); } if( buffer[0] == MSG_STOP ){ char answer_buffer[ANSWER_BUFFER] = {0}; struct Job job; memcpy(&job, &buffer[1], sizeof(struct Job)); int found_job = 0; { pthread_mutex_lock(m->running_lock); struct Node *r_node = m->running_queue->first; while( r_node != NULL) { if( r_node->job.id == job.id ) { found_job = 1; if( r_node->job.user_id != job.user_id ) {
{ "domain": "codereview.stackexchange", "id": 43581, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "c, multithreading, memory-management, linux, socket", "url": null }
python, json, gui, tkinter, ftp def start_live_db_reading(self, ms_between_readings=None): """Start live tracking and outputting of decibel readings.""" if ms_between_readings is None: ms_between_readings = self.delay self.event = 'something' self.live_display() def clear(self): """Remove existing bars from the visualizer and redraw the frame.""" self.Canvas.delete('all') self.draw_frame() def stop_reading(self, filename=None): """Stop tracking decibel input and save all results.""" if filename is None: filename = self.fname_save self.use_ftp = False self.event = None self.save_json(obj=self.all_dbs, filename=filename, overwrite=False) def main(): root = Tkinter.Tk() root.geometry('570x330+30+30') if len(sys.argv) == 2: if sys.argv[1] == '--ftp': g = DecibelVisualizer( root, use_ftp=True, ftp_host=FTP_HOST, ftp_username=FTP_USERNAME, ftp_password=FTP_PASSWORD, ftp_dir=FTP_DIR) else: g = DecibelVisualizer(root, use_ftp=False) g.draw_frame() # have the app open with some nice-looking bars on the screen g.draw_multiple_bars( [(105, 20), (115, 50), (125, 80), (121, 110), (120, 140), (119, 170), (118, 200), (115, 230), (112, 260), (108, 290)] ) root.mainloop()
{ "domain": "codereview.stackexchange", "id": 17237, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "python, json, gui, tkinter, ftp", "url": null }
for Engineers If you want to learn vector calculus (also known as multivariable calculus, or calcu-lus three), you can sign up for Vector Calculus for Engineers. Engineering Mathematics. For example, the position of a rigid body is specified by six parameters, but the configuration of a fluid is given by the continuous distribution of several parameters, such as the temperature, pressure, and so forth. For example, ⋅ (" s dot") denotes the first derivative of s with respect to t, and (" s double dot") denotes the second derivative of s with respect tot. Euler's method may be primitive but it works OK for some equations and it's simple enough that you might give it a try. 2 At some places, I have added supplementary information that will be used later in the. Scientific Computing and Differential Equations: An Introduction to Numerical Methods, is an excellent complement to Introduction to Numerical Methods by Ortega and Poole. Second order ordinary differential equations via Laplace transforms and series solutions; Fourier series; three archetypical partial differential equations; boundary value problems; Sturm-Liouville theory. ential equations, or shortly ODE, when only one variable appears (as in equations (1. The laws of physics are generally written down as differential equations. E solution methods a year that is said to mark the inception for D. The book begins with the basic definitions, the physical and geometric origins of differential equations, and the methods for solving first-order differential equations. Applications Of Partial Differential Equations Sri Vidya College of Engineering and Technology www. Engineering Differential Equations: Theory and Applications guides students to approach the mathematical theory with much greater interest and enthusiasm by teaching the theory together with applications. DIFFERENTIAL EQUATIONS FOR ENGINEERS This book presents a systematic and comprehensive introduction to ordinary differential equations for engineering students and practitioners. in which differential equations dominate the study of many aspects of science and engineering. knowledge and capability to formulate and solve partial differential equations in one- and two-dimensional engineering systems. Physical Problem for Ordinary Differential Equations: Electrical Engineering 08. We are familiar with the solution of differential equations (d. If you are an Engineer, you will be integrating and differentiating hundreds of equations throughou. Differential Equations Applications. It extends the classical finite element method by enriching the solution space for solutions to differential equations with discontinuous functions. , which contain much material on Laplace transforms. And Differential equations pop up everywhere in all fields of
{ "domain": "vievimilano.it", "id": null, "lm_label": "1. YES\n2. YES\n\n", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.9763105314577313, "lm_q1q2_score": 0.8156913821326103, "lm_q2_score": 0.8354835432479661, "openwebmath_perplexity": 628.559223201776, "openwebmath_score": 0.4513215720653534, "tags": null, "url": "http://jfbx.vievimilano.it/applications-of-differential-equations-in-engineering.html" }
beginner, haskell, functional-programming, hangman updateWord and hasWon I didn't really change these. I used a guard to simplify your helper for updateWord and renamed a few things. You can see the changes in the full code. Full code Feel free to ask about anything that I didn't comment on, whether it be my revised code or your initial code. Full disclaimer: I made pretty big changes and didn't write tests, so our versions may differ! {-# LANGUAGE MultiWayIf #-} {- A simple gameLoop of hangman.-} module Hangman where import qualified Data.Set as Set import qualified System.IO as IO import qualified System.Random as Rand import Control.Monad.State import Control.Monad.IO.Class(liftIO) -- | Letters comprising a hangman word. data Letter = Hidden Char | Revealed Char deriving (Eq) -- | A hangman word in a game. type Term = [Letter] -- | Guessed characters in a game. type Guessed = Set.Set Char -- | A Hangman game. data Hangman = Hangman { word :: Term -- ^ Guessed word so far. , lives :: Int -- ^ Number of lives. , guessedChars :: Guessed -- ^ Guessed characters. } -- Helper type alias for the Hangman monad stack. type HangmanM a = StateT Hangman IO a -- | Smart constructor to make a hangman game with a fully hidden word and a -- certain number of lives. mkHangman :: String -> Int -> Hangman mkHangman word lives = Hangman (map Hidden word) lives Set.empty -- | Hangman game status. data Status = Playing -- ^ Game in progress. | Defeat | Victory | Repeat -- ^ Repeat a turn. deriving (Show) letterToChar :: Letter -> Char letterToChar (Hidden _) = '_' letterToChar (Revealed char) = char instance Show Hangman where show (Hangman word lives guessedChars) = unwords [ shownWord , " Lives: " , show lives , "\nGuesses so far: " , shownGuessedChars ] where shownWord = map letterToChar word shownGuessedChars = Set.elems guessedChars
{ "domain": "codereview.stackexchange", "id": 38776, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "beginner, haskell, functional-programming, hangman", "url": null }
quantum-mechanics, optics, quantum-electrodynamics $$\boxed{\tilde{\omega}_a\tilde{\omega}_\sigma=g^2}$$ On the other hand, the condition for the UPB can be obtained by quantum interference from two paths that lead to a two photon state. If the probabilities of both paths are equal and opposite, the two photon state will be blockaded and therefore only one photon states can exist on the system. On the Jaynes Cummings models, this paths are $\text{Path 1:}|0,g\rangle\xrightarrow[]{\Omega_a}|1,g\rangle\xrightarrow[]{\Omega_a}|2,g\rangle$ and $\text{Path 2:}|0,g\rangle\xrightarrow[]{\Omega_a}|1,g\rangle\xrightarrow[]{g}|0,e\rangle\xrightarrow[]{\Omega_a}|1,e\rangle\xrightarrow[]{g}|2,g\rangle$. The analytical condition for UPB is a little harder (and longer) to obtain than for the CPB case, but the solution is $$\boxed{(\tilde{\omega}_\sigma+\tilde{\omega_a})\tilde{\omega}_\sigma+g^2=0}$$ The result for both mechanisms can be visualized for the numerical solution of the second order correlation function. Refer to Fig 7a in [4] for an example. I hope to have clarified a little bit your view on photon blockade. References [1] K. M. Birnbaum, A. Boca, R. Miller, A. D. Boozer, T. E. Northup, and H. J. Kimble. Photon blockade in an optical cavity with one trapped atom. Nature, 436(7047):87–90, July 2005. [2]T. C. H. Liew and V. Savona. Single Photons from Coupled Quantum Modes. Physical Review Letters, 104(18):183601, May 2010
{ "domain": "physics.stackexchange", "id": 92846, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "quantum-mechanics, optics, quantum-electrodynamics", "url": null }
classical-mechanics, hamiltonian-formalism, chaos-theory, complex-systems, ergodicity What about the presence of regular islands where the chaotic sea cannot penetrate? Do they shrink as $D$ increases? Are they always present? There are systems which are fully chaotic so, no, islands are not always present. As for higher-dimensional systems, the KAM surfaces don't separate the phasespace into distinct regions, allowing for phenomena such as the Arnold diffusion mentioned above to occur, so one could say that the regular regions become less influential in higher-dimensional systems.
{ "domain": "physics.stackexchange", "id": 50061, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "classical-mechanics, hamiltonian-formalism, chaos-theory, complex-systems, ergodicity", "url": null }
special-relativity, speed-of-light, physical-constants Title: What is the mechanism responsible for the value of the speed of light in vacuum? First of all, I've read almost all of the similar questions and duplicates given under them. And the question is never answered properly in any of them so please don't just share duplicates and leave it at that. The question is, is there a theoretical mechanism that explains why $c$ has the value it has? Is there a mechanism (even a proposed one) to explain this? Before anyones says it, yes I would still ask this if $c$ was $1\frac{lightseconds}{second}$ ie. described in natural units. Regardless of the numbers and units we assign to it, speed of light has some intrinsic value. Whatever we define it to be, it takes 4 full rotations of Earth around the Sun for a beam we send to reach Proxima Centauri, which is about 4 lightyears away. Yes, I know that speed of light isn't something unique about light or photons and that any massless particle in our universe travels in this speed. This doesn't answer anything about the question, just a fancy way of saying "it just is". I don't even know why some users gave this as an answer in other threads. $c^2 = \frac{1}{\mu_0*\epsilon_0}$ is not a proper explanation because any massless particle has a speed of $c$, not just photons. this relation is just a consequence of special relativity in its core, which has no mechanism explaining the origin of $c$.
{ "domain": "physics.stackexchange", "id": 89150, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "special-relativity, speed-of-light, physical-constants", "url": null }
bash, linux, unix, sh if [ $? != 0 ] ; then echo "Argument parsing fail; terminating..." >&2 ; exit 1 ; fi eval set -- "$TEMP" usage() { cat <<EOF inventory - create or verify an inventory of a directory, typically for backup verification -h --help - output usage information -c --check - read inventory file and verify directory -v --verbose - verbose output -o --output <file> - output to <file> -x --exclude <file> - exclude filenames matching expressions in <file> -i --input <file> - use <file> for input (as an inventory file), together with -c EOF } OFILE="" IFILE="" XFILE="" CHECK="false" VERBOSE="false" while true ; do case "$1" in -h|--help) usage; exit 0;; -c|--check) CHECK="true" ; shift ;; -v|--verbose) VERBOSE="true" ; shift ;; -o|--output) if [ "" != "$OFILE" ] then echo "Only one output file allowed. Terminating" >&2 exit 1 fi OFILE=$2; shift 2 ;; -i|--input) if [ "" != "$IFILE" ] then echo "Only one input file allowed. Terminating" >&2 exit 1 fi IFILE=$2; shift 2 ;; -x|--exclude) if [ "" != "$XFILE" ] then echo "Only one exclude file currently allowed. Terminating" >&2 exit 1 fi XFILE=$2; shift 2 ;; --) shift ; break ;; *) echo "Internal error!" ; exit 1 ;; esac done if [ "" = "$1" ] then echo "must have at least one directory argument to run inventory on" >&2 exit 1 fi if [ "false" = "$CHECK" ] then if [ "" != "$IFILE" ] then echo "cannot give input file when generating inventory" >&2 exit 1 fi fi
{ "domain": "codereview.stackexchange", "id": 21284, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "bash, linux, unix, sh", "url": null }
## 3 Answers We can use the following identity: $$\frac{1}{n(n+1)(n+2)(n+3)}=\frac{1}{3}\left(\frac{1}{n(n+1)(n+2)}-\frac{1}{(n+1)(n+2)(n+3)}\right).$$ Thanks to this identity, if we want to compute $$\sum_{k=1}^n\frac{1}{k(k+1)(k+2)(k+3)}=\frac{1}{3}\sum_{k=1}^n\left(\frac{1}{k(k+1)(k+2)}-\frac{1}{(k+1)(k+2)(k+3)}\right),$$ we only have to subtract $1/(n+1)(n+2)(n+3)$ from $1/(1\cdot2\cdot3)$ and then devide it by 3, because all other terms cancel out. This gives us the result: $$\frac{1}{18}-\frac{1}{3(n+1)(n+2)(n+3)}.$$ • Ah, much easier, and probably generalizes to handle $\sum_{n=k}^{\infty} \frac{1}{\binom{n}{k}}$. – lhf Feb 19 '16 at 11:57 Hint: Use partial fractions: $$\frac1{(n-3)(n-2)(n-1)n}=-\frac1{2(n-2)}+\frac1{2(n-1)}-\frac1{6n}+\frac1{6(n-3)}$$ and note that it telescopes, so that you can find the partial sums. HINT: The $r(\ge1)$th term
{ "domain": "stackexchange.com", "id": null, "lm_label": "1. YES\n2. YES", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.9859363725435202, "lm_q1q2_score": 0.8037673566924162, "lm_q2_score": 0.8152324826183822, "openwebmath_perplexity": 269.62491063334227, "openwebmath_score": 0.7775856256484985, "tags": null, "url": "https://math.stackexchange.com/questions/1662784/finding-the-sum-to-n-terms-of-series-frac11-cdot-2-cdot-3-cdot-4-frac1" }
ros, buildfarm Title: buildfarm fails for noetic with KeyError: libcurlpp-dev We are trying to release the packages in pf_lidar_ros_driver for melodic and noetic. We have been able to release for melodic successfully in the past and even the latest job was successful. However the job for noetic failed with the error: Looking for the '.dsc' file of package 'ros-noetic-pf-driver' with version '1.2.0-1' Traceback (most recent call last): File "/usr/lib/python3/dist-packages/apt/cache.py", line 297, in __getitem__ rawpkg = self._cache[key] KeyError: 'libcurlpp-dev' During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/tmp/ros_buildfarm/scripts/release/create_binarydeb_task_generator.py", line 216, in <module> main() File "/tmp/ros_buildfarm/scripts/release/create_binarydeb_task_generator.py", line 92, in main apt_cache, debian_pkg_names) File "/tmp/ros_buildfarm/ros_buildfarm/common.py", line 175, in get_binary_package_versions pkg = apt_cache[debian_pkg_name] File "/usr/lib/python3/dist-packages/apt/cache.py", line 299, in __getitem__ raise KeyError('The cache has no package named %r' % key) KeyError: "The cache has no package named 'libcurlpp-dev'" Build step 'Execute shell' marked build as failure Since libcurlpp-dev is not a ROS package and is present in rosdistro, I am wondering what went wrong in case of noetic. Edit 1: Among all the builds, looks like it fails only for debian buster.
{ "domain": "robotics.stackexchange", "id": 37655, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "ros, buildfarm", "url": null }
13. Dec 15, 2014 ### Staff: Mentor Do you know how to solve two simultaneous linear algebraic equations in two unknowns? We learned this in 1st year algebra in 8th grade. Chet Last edited: Dec 15, 2014 14. Dec 15, 2014 ### Vector1962 Some people don't have the benefit of a formal high school or college education. I just get a math book every once in a while and work some problems. Math is not that hard. I get stuck every once in a while and need a "pointer" to get me out of the rut. Thanks so much for the help. Following both of your leads I arrive at: $$u(x)=\frac{T}{ch+2}(hx+1)$$ 15. Dec 15, 2014 ### Staff: Mentor Sorry. I wasn't aware. You seemed to have some good math skills beyond HS, and I was surprised at your difficulty with algebra. Chet
{ "domain": "physicsforums.com", "id": null, "lm_label": "1. YES\n2. YES", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.9770226247376171, "lm_q1q2_score": 0.8323771590590728, "lm_q2_score": 0.8519527982093666, "openwebmath_perplexity": 657.4696448459437, "openwebmath_score": 0.6919170618057251, "tags": null, "url": "https://www.physicsforums.com/threads/heat-equation-boundary-conditions.787519/" }
the values of a variable. \begin{align*} T_{n} &= a + (n-1)d \\ &= 31 + (n-1)(-7) \\ &= 31 -7n + 7 \\ &= -7n + 38 \end{align*}. Checking our work, if we substitute in our x values we have … A simple method for indicating the sum of a finite (ending) number of terms in a sequence is the summation notation. $$\overset{\underset{\mathrm{def}}{}}{=}$$, $$= \text{end index} – \text{start index} + \text{1}$$, Expand the formula and write down the first six terms of the sequence, Determine the sum of the first six terms of the sequence, Expand the sequence and write down the five terms, Determine the sum of the five terms of the sequence, Consider the series and determine if it is an arithmetic or geometric series, Determine the general formula of the series, Determine the sum of the series and write in sigma notation, The General Term For An Arithmetic Sequence, The General Term for a Geometric Sequence, General Formula for a Finite Arithmetic Series, General Formula For a Finite Geometric Series. Sigma notation is a very useful and compact notation for writing the sum of a given number of terms of a sequence. Rules for sigma notation. Your browser seems to have Javascript disabled. For any constant $$c$$ that is not dependent on the index $$i$$: \begin{align*} \sum _{i=1}^{n} (c \cdot {a}_{i}) & = c\cdot{a}_{1}+c\cdot{a}_{2}+c\cdot{a}_{3}+\cdots +c\cdot{a}_{n} \\& = c ({a}_{1}+{a}_{2}+{a}_{3}+\cdots +{a}_{n}) \\ & = c\sum _{i=1}^{n}{a}_{i} \end{align*}, \begin{align*} \sum
{ "domain": "bialystok.pl", "id": null, "lm_label": "1. YES\n2. YES\n\n", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.9664104972521579, "lm_q1q2_score": 0.8135491481125685, "lm_q2_score": 0.8418256532040707, "openwebmath_perplexity": 421.2340501097442, "openwebmath_score": 0.9950852990150452, "tags": null, "url": "https://ckp.bialystok.pl/n6k4i/sigma-notation-formula-1dd7ec" }
ros Title: How to play a wav content with the bitrate of 256kbps by audio_play? Hi every one, we provide a wav content with the bitrate of 16kbps for the audio_play to play, it is ok. Now, if the bitrate is another one, for example 256kbps, what shoud we do? Should we change the bitrate of the wav content? Should some one help me? thanks I have do some test like this: I have put the test source codes to the github, every one can git them from : test bite rate for audio play. My enviroment is: ubuntu 14.04 LTS, ros indigo. First you should install the audio_common: sudo apt-get install ros-indigo-audio-common Secondly, open the test_bite_rate_audio_play_server/src/test_bite_rate_audio_play_server.cpp, you will see the two lines codes: *FILE fp_test = fopen("/home/turtlebot/catkin_ws/src/test_bite_rate_audio_play_server/res/test2.wav", "r"); // this is no sound, it's bite rate is 256kbps *//FILE fp_test = fopen("/home/turtlebot/catkin_ws/src/test_bite_rate_audio_play_server/res/test1.wav", "r"); // this is ok, the bite rate is 16kbps you should replace the file path for your local environment. Then build the packages. Third, open a terminal and run : roscore the next few new tap, you may be run the source: source /home/turtlebot/catkin_ws/devel/setup.bash open a new tap and run: rosrun audio_play audio_play audio:=audio_content_publisher open a new tap and run: rosrun audio_server audio_content_publish_server open a new tap and run: rosrun test_bite_rate_audio_play_server test_bite_rate_audio_play_server
{ "domain": "robotics.stackexchange", "id": 25443, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "ros", "url": null }
## Tuesday, December 30, 2014 ### Mathematical Recreations : Ramanujan's Nested Radical Srinivasa Ramanujan posed the following puzzle to the Journal of Indian Mathematical Society in April 1911. What is the value of the following? $$\sqrt{1+2\sqrt{1+3\sqrt{1+4\sqrt{\cdots}}}}$$ He waited over six months, and when nobody replied he gave his solution. The result he provided was 3. The algebraic solution provided by Ramunujan: Consider the identity $$(x+n)^2 = n^2 + 2nx + x^2 = n^2 + x[(x+n)+n]$$ Take square roots to get $$[x+n] = \sqrt{n^2+x[(x+n)+n]}$$ Now inside the brackets you have (something + n), so you can substitute in the same equation with (x+n) replacing (x) to get $$x+n = \sqrt{n^2+x\sqrt{n^2+(x+n)[(x+2n)+n]}}$$ and repeat the process to get $$x+n = \sqrt{n^2 + x\sqrt{n^2+(x+n)\sqrt{n^2+(x+2n)\sqrt{\cdots}}}}$$ If you now set n = 1, x = 2 you get $$3 = \sqrt{1+2\sqrt{1+3\sqrt{1+4\sqrt{\cdots}}}}$$ An alternate way of calculating the equation reveals some interesting behavior.
{ "domain": "blogspot.com", "id": null, "lm_label": "1. YES\n2. YES", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.9802808759252646, "lm_q1q2_score": 0.8125928548958392, "lm_q2_score": 0.8289388019824946, "openwebmath_perplexity": 770.9832882174834, "openwebmath_score": 0.6919801235198975, "tags": null, "url": "http://the-biologist-is-in.blogspot.com/2014/12/mathematical-recreations-ramanujans.html" }
# Generalised eigenvectors Find the general solution of the homogeneous ordinary differential equation $\dot{\mathbf{x}}=A\mathbf{x}$. $$A=\begin{pmatrix} 2 & 1 & 1 \\ 1 & 2 & 1 \\ 1 & 1 & 2 \end{pmatrix}$$ I know how to answer these kind of questions, but the specific example above I am struggling with because I'm not sure I'm finding the correct geometric multiplicity for the repeated eigenvalue. I have the eigenvalues $\lambda=4,1,1$. Hence the eigenvalue $\lambda=1$ has algebraic multiplicity of 2, so I need to find the geometric multiplicity. I have $$A-\lambda I=\begin{pmatrix} 1 & 1 & 1 \\ 1 & 1 & 1 \\ 1 & 1 & 1 \end{pmatrix}$$ Now, normally I would spot the number of independent rows/columns and conclude the geometric multiplicity from this. But it seems this matrix has 0 independent rows/columns, which would make the geometric multiplicity 3, but this violates the fact that the geometric multiplicity can not be greater than the algebraic multiplicity. Where is my thinking going wrong? $$A-\lambda I=\begin{matrix} 1 & 1 & 1 \\ 1 & 1 & 1 \\ 1 & 1 & 1 \end{matrix}$$ Now, normally I would spot the number of independent rows/columns and conclude the geometric multiplicity from this. But it seems this matrix has 0 independent rows/columns, which would make the geometric multiplicity 3, but this violates the fact that the geometric multiplicity can not be greater than the algebraic multiplicity. Where is my thinking going wrong? Why do you think this matrix has $0$ independent rows? Clearly the first row "on its own" is independent... Subtract the first row from the second and third to get:
{ "domain": "stackexchange.com", "id": null, "lm_label": "1. YES\n2. YES", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.9830850892111574, "lm_q1q2_score": 0.8014429111421639, "lm_q2_score": 0.8152324960856175, "openwebmath_perplexity": 158.51006350801848, "openwebmath_score": 0.9049903750419617, "tags": null, "url": "https://math.stackexchange.com/questions/2093094/generalised-eigenvectors" }
inorganic-chemistry, quantum-chemistry, atoms, electronic-configuration, atomic-radius Title: Atomic number $Z$ If electrons were spin-$\frac {3}{2}$ instead of spin-$\frac {1}{2}$ , what would be the atomic number $Z$ for the first noble gas ? The spin multiplicity will be $2S+1=4$. This means that the first atomic orbital can hold $4$ electrons with four different quantum numbers. So, the atomic number for the first noble gas is $4$.
{ "domain": "chemistry.stackexchange", "id": 3210, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "inorganic-chemistry, quantum-chemistry, atoms, electronic-configuration, atomic-radius", "url": null }
python, object-oriented, python-3.x, library Note: you don't need to pass executable explicitly since it's already a part of your cmd param. So in the end what we have is this: import os import platform import subprocess class Speaker: """ Speaker class for differentiating different speech properties. """ def __init__(self, voice='en', wpm=120, pitch=80): self.prevproc = None self.voice = voice self.wpm = wpm self.pitch = pitch executable = 'espeak.exe' if platform.system() == 'Windows' else 'espeak' self.executable = os.path.join(os.path.dirname(os.path.abspath(__file__)), executable) def generate_command(self, phrase): cmd = [ self.executable, '--path=.', '-v', self.voice, '-p', self.pitch, '-s', self.wpm, phrase ] cmd = [str(x) for x in cmd] return cmd def say(self, phrase, wait4prev=False): cmd = self.generate_command(phrase) if self.prevproc: if wait4prev: self.prevproc.wait() else: self.prevproc.terminate() self.prevproc = subprocess.Popen(cmd, cwd=os.path.dirname(os.path.abspath(__file__)))
{ "domain": "codereview.stackexchange", "id": 23664, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "python, object-oriented, python-3.x, library", "url": null }
· Equations and amount spent on television. ) Exponential Growth and Decay Word Problems. If the bacteria doubled every six hours, then there would be 200 in six hours, 400 in twelve hours, How Do You Solve a Word Problem with Exponential Growth? If something increases at a constant rate, you may have exponential growth on your hands. Author: Admin General formulae for exponential growth and decay. The two types of exponential functions are exponential growth and exponential decay. than l, is the growth factor. From 1990 to 1997, the number of cell phone subscribers S (in thousands) in the US can be modeled by, S = 5535. Growth, because of 7. • If you’re given a growth rate as a percent: multiplier = 1 + (growth rate as a decimal). Overview Solving Problems Using the Exponential Decay Model — Solving Word Problems Using the Exponential Decay Model. Example: Atmospheric pressure (the pressure of air around you) decreases as you go higher. Model solving convex optimizations solving them, you can fix that problem to solve various equations logarithmic and exponential equations – general solutions; solve various equations. Examples: 1. What is the population after 5 years. If you look for word problems about exponential growth or decay, in text books or on the internet, certain settings arise again and again: bank accounts, populations of animals, people or bacteria, and. take a screenshot of your final IXL daily 10 score, be sure it includes the last question, number of questions answered, total time and smart score. The order of magnitude is the power of ten when the number is expressed in scientific notation with one digit to the left of the decimal. 2. exponential decay: a decrease whose rate is proportional to the size of the population. 14days. Apr 3, 2007 #1 1) "Solve the equation: The Jun 18, 2018 · Truly, we have been noticed that 11 Exponential Growth And Decay Word Problems Worksheet Answers is being just about the most popular subject on document template sample at this time. A couple of other practice! Exponential growth and decay. In real-life situations we use x as time and try to find out how things change exponentially over time. If the city had . Predict the bacteria population at the end of two hours. Exponential Word Problems DRAFT. a. a) Exponential growth or decay: b) Identify the initial amount: c) Identify the growth/decay factor: d) Write an
{ "domain": "thebuildsuccess.com", "id": null, "lm_label": "1. YES\n2. YES\n\n", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.9790357567351325, "lm_q1q2_score": 0.8470853127300599, "lm_q2_score": 0.8652240808393984, "openwebmath_perplexity": 853.2557488221838, "openwebmath_score": 0.5186667442321777, "tags": null, "url": "http://thebuildsuccess.com/lw8kc/how-to-do-exponential-growth-and-decay-word-problems.html" }
navigation, ros-melodic, joystick Title: Fine joystick library control I am leaning the ROSLiB library and I am using the NG-Joystick virtual joystick library to issue twist instructions to a TurtleSim robot. My problem is when I use the joystick to move the robot, it lurches around widely which is not acceptable for the TurtleSim and certainly not acceptable for moving a real robot. Below is a screen shot of the effects I'm experiencing. If you look at the console area on the left of the image, you would see the raw X & Y coordinates I am directly publishing to turtle1/cmd_vel. The right side part of the image shows the erratic effect of those coordinates. The section of my code for publishing those coordinates are simple enough but I thought I'd include it below: this.joystickComp.joystickMove$.subscribe(d => { console.log(d); console.log('X: ' + d.pointerPos.x + ', Y: ' + d.pointerPos.y); console.log('sending cmd_vel ...'); this.rosService.move(d.pointerPos.x, d.pointerPos.y); console.log('cmd_vel sent'); }); Can anyone advice how I can get better control ? Originally posted by sisko on ROS Answers with karma: 247 on 2020-08-04 Post score: 0 If you are really sending a twist message, you should work on your units. Note that ROS uses SI-units. You are asking (at least according to the log) for 450+ m/s translational velocity and 310+ rad/s rotational velocity. Originally posted by mgruhler with karma: 12390 on 2020-08-04 This answer was ACCEPTED on the original site Post score: 1
{ "domain": "robotics.stackexchange", "id": 35363, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "navigation, ros-melodic, joystick", "url": null }
ros, rqt-gui The perspective file in turn looked similar to the following: ..., "mainwindow": { "keys": { "geometry": { "type": "repr(QByteArray.hex)", "repr(QByteArray.hex)": "QtCore.QByteArray('01d9d')", "pretty-print": " : I : I " }, "state": { "type": "repr(QByteArray.hex)", "repr(QByteArray.hex)": "QtCore.QByteArray('000000ff')", "pretty-print": " Lrqt_topic__TopicPlugin__1__TopicWidget Xrqt_publisher__Publisher__1__PublisherWidget 6MinimizedDockWidgetsToolbar " } }, .... We are interested in the key-value pairs looking similar to the following: "repr(QByteArray.hex)": "QtCore.QByteArray('000000ff')", and change it to the following: "repr(QByteArray.hex)": "b'000000ff'", I.e. after replacing the value with only byte content, like b'000000ff' and removing QtCore.QByteArray() creation, the rqt_gui is able to start without errors. No patching of noetic code required. Hope this helps! Originally posted by selyunin with karma: 96 on 2021-01-06 This answer was ACCEPTED on the original site Post score: 7 Original comments Comment by M Usamah Shahid on 2021-01-29: This worked perfectly for me. Thanks a lot
{ "domain": "robotics.stackexchange", "id": 35738, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "ros, rqt-gui", "url": null }
bond, ionic-compounds, transition-metals, covalent-compounds Title: Is pyrite (FeS₂) an ionic or a covalent compound? I have searched all over the web and found a lot of diverse explanations, but none of them are concluding exactly whether $\ce{FeS2}$ (solid - pyrite) is a covalent or an ionic compound. From electronegativity, it should be covalent as the $\Delta\chi=0.7$ which is less than $1.5$ and thus said to make covalent bonds and therefore be a covalent compound. From the definition of ionic bonds, which are bonds between a metal and a non-metal element (whereas covalent bonds are bonds between non-metal elements), it should be an ionic compound. Does someone know which of those is 'true', or better, if there is another, more detailed explanation? You seem to have fallen into the trap of thinking that ionic and covalent bonds are fundamentally different. They are not - they are just two ends of a spectrum, which has an arbitrary division somewhere in the middle into an ionic and covalent regime. This is explained in the answers to this question. In the case of pyrite we have a relatively hard cation, with a small ionic radius and charge of +2, and a rather large anion, with a charge of -2. Therefore there will be a significant degree of covalent character in the Fe-S bonds due to the polarising effect of the cation on the anion. This is confirmed by experimental results and theoretical calculations which suggest that the charge on Fe is about +2/3 and the charge on S is about -1/3. This is significantly less than the expected charges of +2 and -1 from a purely ionic model and so indicates that there is significant sharing of electrons. This is supported by measurements and calculations of the electron density, which show significant electron density between the atoms. Reference: http://pubs.rsc.org/en/content/articlepdf/2014/sc/c3sc52977k
{ "domain": "chemistry.stackexchange", "id": 5619, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "bond, ionic-compounds, transition-metals, covalent-compounds", "url": null }
human-biology, reproduction, reproductive-biology Also condom is not a modern mechanism it was used in ancient times, but the usage was to protect oneself from sexually transmitted diseases, but an unknown chemical used which is a spermicide and this resulted in contraception. Records of condom use dates back to 3000 B.C. where King Minos of Crete, son of Zeus and Europa, utilized the bladders of goats to protect himself during intercourse. In the 1500s, a syphilis epidemic spread across Europe. It was at this time that Gabriel Fallopius,created a linen condom as a means to protect from the continuing spread of disease . This proved especially effective when soaked in an unknown chemical solution acting as a spermicide. Reference The medieval contraception methods includes, Condoms Female Barrier Methods Herbs and Rituals Intrauterine devices Male methods The Pill These methods are widely described in this article.
{ "domain": "biology.stackexchange", "id": 3130, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "human-biology, reproduction, reproductive-biology", "url": null }
SQUARES We’ll show later that this indeed gives the minimum, not the maximum or a saddle point. If the system is underdetermined one can calculate the minimum norm solution. Thread starter Math100; Start date Nov 20, 2020; Nov 20, 2020 #1 Math100 . Linear Algebra and Least Squares Linear Algebra Blocks. However, the converse is often false. Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. Table of Contents. Problems and Solutions. The minimum norm least squares solution is always unique. What led NASA et al. Applied Linear Algebra Vectors, Matrices, and Least Squares Stephen Boyd Department of Electrical Engineering Stanford University Lieven Vandenberghe Department of Electrical and Computer Engineering University of California, Los Angeles. Recall that the usual way to compute the unrestricted OLS solution is the solve the "normal equations" (X*X)*b = X*Y for the parameter estimates, b. Integer literal for fixed width integer types.$$ $$Next, we want to show that every solution to the normal equation is a least square solution. 3 Linear Algebra From a linear algebra point of view, regression cannot simply be found by using a A~x= ~bequation. Consider a linear system of equations Ax = b. Use MathJax to format equations. Stack Exchange network consists of 176 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share … The optimize option ( opt ) determines how the result is returned in the case when the coefficient Matrix is not full rank (so that there are an infinite number of solutions). to decide the ISS should be a zero-g station when the massive negative health and quality of life impacts of zero-g were known? Linear least squares (LLS) is the least squares approximation of linear functions to data. the null space is trivial. Introduction to Applied Linear Algebra – Vectors, Matrices, and Least Squares : Introduction to Applied Linear Algebra – Vectors, Matrices, and Least Squares Stephen Boyd and Lieven Vandenberghe Cambridge University Press. Solving Linear Systems; LeastSquares. Browse other questions tagged linear-algebra matrices numerical-linear-algebra least-squares or ask your own question. However, if A doesn't have full column rank, there may be infinitely many least squares solutions. 6Constrained least squares Constrained least squares refers to the problem of
{ "domain": "kezklinika.hu", "id": null, "lm_label": "1. YES\n2. YES\n\n", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.9825575157745541, "lm_q1q2_score": 0.8078481160038832, "lm_q2_score": 0.8221891370573388, "openwebmath_perplexity": 977.894354635926, "openwebmath_score": 0.7075470685958862, "tags": null, "url": "https://kezklinika.hu/6siwd8v1/zb71a.php?e7ea89=least-squares-solution-linear-algebra" }
+ i sin(θ) ) , Polar form z = a + ib = r e iθ, Exponential form The exponential form of a complex number is: (r is the absolute value of the Convert a Complex Number to Polar and Exponential Forms - Calculator. complex numbers exponential form. Because our angle is in the second quadrant, we need to Viewed 48 times 1 $\begingroup$ I wish to show that $\cos^2(\frac{\pi}{5})+\cos^2(\frac{3\pi}{5})=\frac{3}{4}$ I know … Traditionally the letters zand ware used to stand for complex numbers. An easy to use calculator that converts a complex number to polar and exponential forms. They are just different ways of expressing the same complex number. This is a quick primer on the topic of complex numbers. Modulus or absolute value of a complex number? Apart from Rectangular form (a + ib ) or Polar form ( A ∠±θ ) representation of complex numbers, there is another way to represent the complex numbers that is Exponential form.This is similar to that of polar form representation which involves in representing the complex number by its magnitude and phase angle, but with base of exponential function e, where e = 2.718 281. apply: So -1 + 5j in exponential form is 5.10e^(1.77j). With Euler’s formula we can rewrite the polar form of a complex number into its exponential form as follows. A complex number in standard form $$z = a + ib$$ is written in, as The exponential notation of a complex number z z of argument theta t h e t a and of modulus r r is: z=reiθ z = r e i θ. The exponential form of a complex number is: r e j θ. Privacy & Cookies | Topics covered are arithmetic, conjugate, modulus, polar and exponential form, powers and roots. Hi Austin, To express -1 + i in the form r e i = r (cos() + i sin()) I think of the geometry. where Getting things into the exponential function and the trigonometric functions Classroom Facebook Twitter ( exponential form of complex numbers exponential form ⋅. - 5j s s I n in exponential form are explained through examples and through. Multiplied and divided
{ "domain": "digiloopdesigns.com", "id": null, "lm_label": "1. YES\n2. YES\n\n", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.9755769049752756, "lm_q1q2_score": 0.8212656594744931, "lm_q2_score": 0.8418256472515683, "openwebmath_perplexity": 908.6045495790235, "openwebmath_score": 0.7954952120780945, "tags": null, "url": "http://nitrous.digiloopdesigns.com/kristine-cofsky-rae/pt5uzlr.php?tag=09e9e4-exponential-form-of-complex-numbers" }
machine-learning, classification, multiclass-classification, model-evaluations, confusion-matrix Title: Suitable metric choice for imbalanced multi-class dataset (classes have equal importance) What type of metrics I should use to evaluate my classification models, given that I have two imbalanced multi-class datasets (21 and 16 classes, respectively) where all classes have equal importance? I am somehow convinced with macro-averaged-based metrics choice such as macro F1 and macro TNR, ...etc. Are macro-averaged-based metrics suitable for my problem based on the aforementioned inputs? Yes, a macro-average measure is the standard choice in this context: a macro-average score is simply the mean of the individual score for every class, thus it treats every class equally. With an strongly imbalanced dataset, this means that a small class which has only a few instances instances in the data is given as much weight as the majority class. Since the former is generally harder for a classifier to correctly identify, the macro-average performance value is usually lower than a micro-average one (this is normal of course).
{ "domain": "datascience.stackexchange", "id": 9317, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "machine-learning, classification, multiclass-classification, model-evaluations, confusion-matrix", "url": null }
ros, rosbag, ubuntu, rqt-bag ~/.local/share/applications/bag.desktop [Desktop Entry] Type=Application Name=RqtBag # Exec=bash -c "source ~/catkin_ws/devel/setup.bash; rqt_bag %f" Exec=bash -c "source ~/catkin_ws/devel/setup.bash; ROS_HOME=`pwd` roslaunch rqt_bag_launch rqt_bag.launch bag:=%f" MimeType=application/x-bag StartupNotify=true Terminal=true Then: update-desktop-database ~/.local/share/applications update-mime-database ~/.local/share/mime The commented out Exec that runs rqt_bag directly works only if there is an already running roscore (does rqt_bag really need a roscore if it isn't going to publish anything, just inspect the bag within the gui? Maybe it could have a mode where publishing is disabled and no roscore required -> short answer: no https://github.com/ros-visualization/rqt_common_plugins/issues/238). In order to make it more usable rqt_bag can be wrapped in a launch file, so roslaunch will start a roscore if no other is available: rqt_bag_launch/launch/rqt_bag.launch: <?xml version="1.0"?> <launch> <arg name="bag" default="" doc="bag file to load"/> <node name="rqt_bag" pkg="rqt_bag" type="rqt_bag" args="$(arg bag)"/> </launch> If I set Terminal to false in the bag.desktop then the roslaunch and rosmaster processes are still running after exiting rqt_bag, but it looks cleaner without the terminal- is there something different to be done in the Exec to make sure exiting is handled correctly? Originally posted by lucasw with karma: 8729 on 2017-03-03 This answer was ACCEPTED on the original site Post score: 0
{ "domain": "robotics.stackexchange", "id": 27189, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "ros, rosbag, ubuntu, rqt-bag", "url": null }
c, game, hash-map, collision, openmp for (i = 1 ;i <= grid->sectionsTouched[entity][0];i++) { for (j = 0;j < grid->sections[grid->sectionsTouched[entity][i]].entityCount;j++) { if (grid->sections[grid->sectionsTouched[entity][i]].entities[j] == &grid->entities[entity]) { grid->sections[grid->sectionsTouched[entity][i]].entities = (p_Entity**)remove_elementv((void**)grid->sections[grid->sectionsTouched[entity][i]].entities,j,grid->sections[grid->sectionsTouched[entity][i]].entityCount); grid->sections[grid->sectionsTouched[entity][i]].entityCount--; break; } } } grid->sectionsTouched[entity][0] = 0; for (j = 0;j < 8;j++) { int gridIndex = fn_worldToGrid(grid,points[j]); if (gridIndex < 0 || gridIndex >= grid->sectionCount) { printf("%s\n","Spatial hash Not big enough!" ); } if (!contains(grid->sectionsTouched[entity],gridIndex)) {
{ "domain": "codereview.stackexchange", "id": 27237, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "c, game, hash-map, collision, openmp", "url": null }
homework-and-exercises, electromagnetism, tensor-calculus As you pointed out, this isn't quite what we started with because we have an additional term of the form $$(\epsilon^{\mu\nu\alpha\beta}A_{\nu }\partial_{\mu}\partial_{[\alpha}A_{\beta ]}) $$ However the total antisymmetry of the epsilon symbol means we can treat the $\mu$ $\alpha$ $\beta$ contribution as $$\partial_{[\mu}F_{\alpha\beta]} $$ which vanishes due to the Maxwell equations. Hence the anzatz (1) holds. (The vector whose divergence we take looks like the abelian Chern Simons current).
{ "domain": "physics.stackexchange", "id": 6111, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "homework-and-exercises, electromagnetism, tensor-calculus", "url": null }
c#, wpf, mvvm public ClientSearchSection() { InitializeComponent(); DataContextChanged += ClientsSearchSection_DataContextChanged; } void ClientSearchSection_DataContextChanged(object sender, DependencyPropertyChangedEventArgs e) { _viewModel = e.NewValue as IViewModel; } This allows me to implement the command code in the ViewModel, for example: public bool CanExecuteAddSelectionCommand() { return SelectedClients.Count > 0; } public void OnExecuteAddSelectionCommand() { // whatever needs to happen here, I can access my model as needed } The trick that allows the SelectedItems to work is with this property, exposed by the IClientsSearchSectionCommands interface implemented by the ViewModel: public IList<ClientViewModel> SelectedClients { get; set; } ...and the fact that I'm setting them in the commands' CanExecute and Executed handlers. This works beautifully... but is it weird in any way? [How] could it be done better? I don't want to dive into behaviors at this point, firstly because I have no clue about them, second, because I'm dragging a more junior developper into WPF & MVVM, coming from WinForms and inline-SQL-in-the-form's-code-behind, so I'd like to know if this code is easy enough to follow... Your approach looks fine to me. Except i would probably use prefix-casting, to get cast exceptions straigt away if something goes wrong, instead of using as. This can be achieved without modifying code-behind tho. You can bind container's IsSelected property to appropriate item's viewmodel property. <ListView.ItemContainerStyle> <Style TargetType="ListViewItem" > <Setter Property="IsSelected" Value="{Binding IsSelected}"/> </Style> </ListView.ItemContainerStyle>
{ "domain": "codereview.stackexchange", "id": 4625, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "c#, wpf, mvvm", "url": null }
14, NCERT Solutions For Class 9 Maths Chapter 15, NCERT Solutions for Class 9 Science Chapter 1, NCERT Solutions for Class 9 Science Chapter 2, NCERT Solutions for Class 9 Science Chapter 3, NCERT Solutions for Class 9 Science Chapter 4, NCERT Solutions for Class 9 Science Chapter 5, NCERT Solutions for Class 9 Science Chapter 6, NCERT Solutions for Class 9 Science Chapter 7, NCERT Solutions for Class 9 Science Chapter 8, NCERT Solutions for Class 9 Science Chapter 9, NCERT Solutions for Class 9 Science Chapter 10, NCERT Solutions for Class 9 Science Chapter 12, NCERT Solutions for Class 9 Science Chapter 11, NCERT Solutions for Class 9 Science Chapter 13, NCERT Solutions for Class 9 Science Chapter 14, NCERT Solutions for Class 9 Science Chapter 15, NCERT Solutions for Class 10 Social Science, NCERT Solutions for Class 10 Maths Chapter 1, NCERT Solutions for Class 10 Maths Chapter 2, NCERT Solutions for Class 10 Maths Chapter 3, NCERT Solutions for Class 10 Maths Chapter 4, NCERT Solutions for Class 10 Maths Chapter 5, NCERT Solutions for Class 10 Maths Chapter 6, NCERT Solutions for Class 10 Maths Chapter 7, NCERT Solutions for Class 10 Maths Chapter 8, NCERT Solutions for Class 10 Maths Chapter 9, NCERT Solutions for Class 10 Maths Chapter 10, NCERT Solutions for Class 10 Maths Chapter 11, NCERT Solutions for Class 10 Maths Chapter 12, NCERT Solutions for Class 10 Maths Chapter 13, NCERT Solutions for Class 10 Maths Chapter 14, NCERT Solutions for Class 10 Maths Chapter 15, NCERT Solutions for Class 10 Science Chapter 1, NCERT Solutions for Class 10 Science Chapter 2, NCERT Solutions for Class 10 Science Chapter 3, NCERT Solutions for Class 10 Science Chapter 4, NCERT Solutions for Class 10 Science Chapter 5, NCERT Solutions for Class 10 Science Chapter 6, NCERT Solutions for Class 10 Science Chapter 7, NCERT Solutions for Class 10 Science Chapter 8, NCERT Solutions for Class 10 Science Chapter 9, NCERT Solutions for Class 10 Science Chapter 10, NCERT Solutions for Class 10 Science Chapter 11, NCERT Solutions for Class 10 Science Chapter 12, NCERT Solutions for Class 10 Science Chapter 13, NCERT Solutions for Class 10 Science Chapter 14, NCERT Solutions for Class 10 Science Chapter 15, NCERT Solutions for Class 10 Science Chapter 16, CBSE Previous
{ "domain": "circat.cat", "id": null, "lm_label": "1. Yes\n2. Yes\n\n", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.9848109507462227, "lm_q1q2_score": 0.8051562972061073, "lm_q2_score": 0.8175744761936437, "openwebmath_perplexity": 3144.103889761295, "openwebmath_score": 0.3905906677246094, "tags": null, "url": "https://circat.cat/journal/37tsmk.php?54ad59=find-the-area-of-the-following-quadrilateral" }
# Homework Help: Probability of choosing stale donuts out of 24 Tags: 1. Sep 2, 2016 ### TheSodesa 1. The problem statement, all variables and given/known data There are 6 stale donuts in a set of 24. What is the probability of: a) there being no stale donuts in a sample of 10? b) there being 3 stale donuts in a sample of 10? c) What is the chance of a stale doughnut being found? 2. Relevant equations $N \, permutations = N!$ 3. The attempt at a solution Let $X$ denote the number of stale donuts in a set of 10. a) I used the idea of permutations like so: $$P(X = 0) = \frac{\frac{18!}{8!}}{\frac{24!}{15!}} \approx 0.335$$ This was incorrect, according to the testing software b) Here I followed the same idea: $$P(X=3) = \frac{\frac{18!}{11!} \times \frac{6!}{3!}}{\frac{24!}{15!}} \approx 0.041$$ c) This is just the complement of part $a$: $$P(X \, is \, at \, least \, 1) = 1 - 0.061 = 0.665$$ Parts $a$ and $b$ (and $c$ as a consequence of $a$ being wrong) are apparently wrong and I'm not sure whats wrong with my reasoning. Last edited: Sep 2, 2016 2. Sep 2, 2016 ### TheSodesa I was completely wrong. I was supposed to use combinations instead: a) $$P(X = 0) = \frac{18 \choose 10}{24 \choose 10} =39/1748 \approx 0.22$$ b) $$P(X = 3) = \frac{{18 \choose 7} \times {6 \choose 3}}{{24 \choose 10}} =1560/4807 \approx 0.325$$
{ "domain": "physicsforums.com", "id": null, "lm_label": "1. YES\n2. YES", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.9688561667674652, "lm_q1q2_score": 0.8031224804094124, "lm_q2_score": 0.8289388125473628, "openwebmath_perplexity": 1533.540870045084, "openwebmath_score": 0.7766064405441284, "tags": null, "url": "https://www.physicsforums.com/threads/probability-of-choosing-stale-donuts-out-of-24.883929/" }
computability, loops I will show where I got stuck in my own attempt. First a summary of the proof. (If my notation differs from Hofstadter's it is because I am translating back to English from a translated version of the book) BLUEPROGRAMS is a list of all Bloop programs that take one integer input and have one integer output for each input. The programs on the list are sorted by length and within that alphabetically so that there is no ambiguity about the order. BLUEPROGRAMS{N} denotes the Nth entry on this list. BLUEPROGRAMS{N}[M] denotes the output of the program BLUEPROGRAMS{N} when fed the input M. The function BLUEDIAG is defined by BLUEDIAG[N] = BLUEPROGRAMS{N}[N] + 1. Now if BLUEDIAG were computable by a Bloop program then this program should appear somewhere on the list BLUEPROGRAMS, say at position $X$. We then get the strange situation that BLUEPROGRAMS{X}[X] = BLUEDIAG[X] = BLUEPROGRAMS{X}[X] + 1, where the first equality represents the assumption that BLUEPROGRAMS{X} calculates BLUEDIAG and the second comes from the definition of BLUEDIAG. Since no number Y satisfies Y = Y + 1 the number BLUEPROGRAMS{X}[X] cannot exist, hence the program BLUEPROGRAMS{X} does not exist. So far so good. As far as proofs go this is really easy, but at the price of obfuscating what about all this is special to Bloop. Now for the quest of making a program that computes BLUEDIAG. My plan of attack is to make three programs. Program 1 takes as input a natural number and as output the code of the Nth blueprogram. Program 2 takes as in put the code of a blueprogram B and a number M and outputs the same number this program B would produce when given the input M Program 3 takes as input a number K and outputs the number K + 1.
{ "domain": "cs.stackexchange", "id": 19235, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "computability, loops", "url": null }
Given external point, there only five different Congruence postulates that will work proving! Image to the three sides of a traingle are congruent. trianglesare triangles that have the same and... Prove that these triangles are said to be similar if they have the same size and shape exothermic... Both right angles, B and E are congruent if they have the same length as corresponding... Of two triangles are congruent. the SAS Postulate a proof used for right triangl… Postulate 17 ∠ACB... Angle Side example proof quantities, the transition state is closer to the three of... All 3 sides are congruent if they have the same size and shape a few examples were for... Means that the corresponding sides in one triangle are congruent to triangle CDA by the Postulate... Postulate to postulates of Euclidean geometry DeLay are too incompetent to enter into courtroom. If what you Postulate is used to derive the other, then the are... Side-Side-Side ): if three pairs of sides of a traingle are to... Guessed it parts are congruent… we just need three Angle-Side-Angle ( ASA to! About identifying the accurate Side and Angle relationships to the three sides of another triangle, they. Into triangle Congruence postulates and Theorems - Concept - Solved examples are five ways you can replicate the Congruence. Said to be the same length as the corresponding sides of a traingle congruent... Them, the transition state is closer to the reactants than to the audio pronunciation in the image, will. And Angle-Angle-Side ( AAS ) postulates the Division Postulate: if equal,. Similar and write a Similarity statement presupposition, condition, or premise of a are! Of an acute, right, we prove triangle congruency B D E F there a... Congruence Theorems quantities are added to equal quantities are added to equal quantities, the state! A given line subtropical front east of New Zealand based on alkenone unsaturation and. F there is at most one line Parallel to a given external point, there five. ¯Pn ⊥ ¯MQ and ¯MN ~= ¯NQ ) ΔABD ≅ ΔACD ii ) is! Are five ways you can prove triangle congruency are satisfied Math is Fun accurately
{ "domain": "oopsconcepts.com", "id": null, "lm_label": "1. Yes\n2. Yes", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.9822877007780707, "lm_q1q2_score": 0.8602747888049067, "lm_q2_score": 0.8757869900269366, "openwebmath_perplexity": 1223.4144715405948, "openwebmath_score": 0.4419773519039154, "tags": null, "url": "http://www.oopsconcepts.com/freight-train-qpjqp/1wm0k.php?15357d=sss-postulate-examples" }
electrochemistry, redox Please help me understand this. I have asked experts -> I am right. The common convention is to label the physical electrodes as cathode/anode based on discharge even though that will be backwards when the battery is charging. That is a poor, confusing, and illogical naming convention, but it is what it is. The more clear and logical naming convention would be to name the physical electrodes either positive or negative since those labels apply in both charge/discharge directions. Some people use this logical naming convention, but the illogical convention seems more prevalent.
{ "domain": "chemistry.stackexchange", "id": 1225, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "electrochemistry, redox", "url": null }
ros, overlay, roboearth, roswtf Comment by Amal on 2012-11-21: but I have 3 work space in my home :D , so I try to remove any but it seem that it remove the entries not the hole folders. how ti remove it at all Tanks :) Comment by Amal on 2012-11-21: I want to delete fuerte_workspace http://i.imgur.com/HkaEj.png and That is ros which I want to be my workspace http://i.imgur.com/Dyv61.png I mean it is already exist and linked to ros in file system but I want to make it an overlay so can edit not just a user . I need clarification please.thanks Comment by dornhege on 2012-11-21: I don't really understand what you mean/want. You can create a new ros workspace from any folder and add things to it via rosws. To enable a specific one for using it, just source it's setup.bash. Likewise removing any workspace is just removing that folder. Comment by Amal on 2012-11-22: Ok thanks I will try it Comment by dornhege on 2012-11-22: If you get permission denied errors, something with the permissions is wrong. What do you get for ls -l with the files that error? Did you check that out as another user? Comment by Amal on 2012-11-23: that is what I have when try "ls -l" drwxrwxr-x 5 amal amal 4096 Nov 22 20:53 fuerte_workspace Comment by dornhege on 2012-11-23: This is the directory. The errors you get are from other files. Comment by Amal on 2012-11-23: I am really sorry for long inconvenience, I am not understand what you want to say ?! simply I want to remove the work space, but It does not want to be removed I do not know why? . can I skip this and create another one, mean not to asign a path to this that doesnot want to be removed ?!! Comment by dornhege on 2012-11-23:
{ "domain": "robotics.stackexchange", "id": 11673, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "ros, overlay, roboearth, roswtf", "url": null }
splines such as ppform, B-form, tensor-product, rational, and stform thin-plate splines. 2, Symbolic math, optim, spline, stats)% 1. The general expression for the trilinear interpolation is given in Eq. The recursive B-spline basis formula tells you how to do that. matlab curve-fitting procedures. , zero tension. Consider two equally sized sets of 2D-points, A being the vertices of the original shape and B of the target shape. For this ex ample, the data is stored in the file census. is there a possibility to do a 2d-spline interpolation with scattered data in matlab?. DSTOOLS - Descriptor System Tools for MATLAB DSTOOLS is a collection of MATLAB functions for the operation on and manipulation of rational transfer-function matrices via their generalized state-space (or descriptor) system representations. Unlike the other methods, this interpolation is not based on a triangulation. B-spline registration of two 2D / 3D images or corrsp. Matlabe uno dei programmi scientifici di maggior diffusione, grazie alle sue numerose applicazioni in campi quali l’elettronica, la controllistica, l’analisi dei segnali, l’elaborazione di immagini, la chimica, la statistica e numerosi altri. pp = spline(x,Y) yy = spline(x,Y,xx) Description. A MATLAB toolbox for the time-domain simulation of Focussed 2D Array With Directional Elements Number of spline segments used in the smoothing spline if. The simplest spline is something very familiar to you; it is obtained by connecting the data with lines. a MATLAB library which finds a polynomial interpolant to data z(x,y) of a 2D argument by setting up and solving a linear system for the polynomial coefficients, involving the Vandermonde matrix. As points are placed in the axes, the B-spline of specified order is drawn progressively. 13, 09-jan-2016: Removed XTAL regression package which truned out to contain proprietary code. TEST_INTERP_2D, a MATLAB library which defines test problems for interpolation of data
{ "domain": "otticamuti.it", "id": null, "lm_label": "1. YES\n2. YES\n\n", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.97241471777321, "lm_q1q2_score": 0.8165696750288508, "lm_q2_score": 0.8397339736884711, "openwebmath_perplexity": 1972.3408258527913, "openwebmath_score": 0.5017431378364563, "tags": null, "url": "http://qxm.otticamuti.it/2d-spline-matlab.html" }
approximation-algorithms FWIW, I've noticed that, historically, Chernoff bounds tended to be stated in terms of additive error (where "error" = deviation from the mean). Perhaps that's because Chernoff bounds generally concern sums of $[0,1]$ random variables. But when used in TCS they tend to be stated multiplicatively, probably for the reasons outlined above.
{ "domain": "cstheory.stackexchange", "id": 4950, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "approximation-algorithms", "url": null }
error-correction, stabilizer-code In terms of parity-check matrices, this means that from an $m\times n$ matrix of a base code we get an $\ell m\times \ell n$ block matrix of its lift, where $\ell\times\ell$ blocks correspond to permutations from $\mathbf{S}_\ell$, which can also be considered as an $m\times n$ matrix over a group ring $R=\mathbb{F}_2[G]$ when these permutations are actions $x\mapsto gx$ of a group $G$ of size $\ell$ on itself (e.g., look here). In fact, allmost all classical LDPC codes currently used in practice are constructed as large lifts of small base codes (the Tanner code of the base code is often called a protograph). Since in the lifted Tanner graph we have $\ell$ times more bit and check nodes, then for a base code of rate $\rho$, the rate of all its possible lifts is at least $\rho$. This gives us an infinite family of LDPC codes of rate at least $\rho$ obtained from just one base code. Unfortunately, not every LDPC code in this family has large minimal distance. However, if you take a random lift (e.g., assign random elements from $\mathbf{S}_\ell$), then on average you get a very good minimal distance that grows linearly with the code length. This is an example of a more general phenomenon, first noticed by Shannon, that a random code on average tends to have a very large distance. One can derandomize this (i.e., choose the base code and the permutations from $\mathbf{S}_\ell$ explicitly) using the Sipser-Spielmann construction. The main idea of lifted product codes is to extend these very powerful methods from classical LDPC to quantum LDPC codes. Ideally, we would like to use any small base quantum CSS code and obtain its random lifts (i.e., lifts of its Tanner graph). Since the obtained quantum LDPC code looks like a random one, it is quite natural to expect that on average its distance is large, as it was in the classical case discussed above.
{ "domain": "quantumcomputing.stackexchange", "id": 5320, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "error-correction, stabilizer-code", "url": null }
homework-and-exercises, forces, waves This model of a rope and a ring and a pole is perhaps not completely realistic. However Neumann boundary conditions have applications to lots of other oscillators. In particular, in electromagnetism, we have the boundary condition that the electric field is always perpendicular to the surface of a conductor — or equivalently, that the component of the electric field parallel to the surface of a conductor is always zero — which has the same sort of counterfactual justification: if there were an electric field parallel to the surface of a conductor, the free charges on the conductor would feel pushed around and move, until the field was cancelled out.
{ "domain": "physics.stackexchange", "id": 13934, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "homework-and-exercises, forces, waves", "url": null }
thermodynamics, energy, first-law-of-thermodynamics Title: Is it right that Enthalpy can only be used to calculate Q for isobaric processes? I made a little derivation for the Enthalpydifference $\Delta H$. I got as a solution: $\Delta U+\underbrace{\Delta p\cdot V_{1}+p_{2}\cdot\Delta V}_{a}$ Now I do want to compute the transferred heat of the process by using the 1st law of thermodynamics: $Q=\Delta U+\Delta E_{kin}+\Delta E_{pot}+W_{rest}+W_{vol}$ Where I divided Work $W$ in to $W_{rest}$ and $W_{vol}=\int_{1}^{2}p\left(V\right)\cdot dV$ So for the case that $\Delta V=0$ I can easily calculate $Q$ with the a table for $U$, if I know $\Delta E_{kin}$, $\Delta E_{pot}$ and $W_{rest}$: $Q=\Delta U+\Delta E_{kin}+\Delta E_{pot}+W_{rest}$ because $W_{vol}=0$ It is similar for the case $\Delta p=0$: Although $W_{vol}=p \cdot \Delta V \neq 0$, $a$ does simplify to $a=p \cdot \Delta V$ and therefore I can write $\Delta H = \Delta U + W_{vol}$ $Q=\Delta H+\Delta E_{kin}+\Delta E_{pot}+W_{rest}$.
{ "domain": "physics.stackexchange", "id": 45690, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "thermodynamics, energy, first-law-of-thermodynamics", "url": null }
c++, performance, time-limit-exceeded, mathematics, complexity Title: Can I further optimize this solution for HackerRank's “Making Candies”? My C++ solution for HackerRank's "Making Candies" problem, reproduced below, is as optimized as I can make it and appears similar to what others say are optimal solutions. However, six of the test cases still fail due to timing out. I would be interested to know if there are any significant opportunities to optimize my code that I missed. I'm guessing that I'm either missing some way to simplify the computation (perhaps part of it can be precomputed and stored in a lookup table?), or there's some way to compute the answer without using a loop. std::ios::sync_with_stdio(false); long m, w, p, n; std::cin >> m >> w >> p >> n; for (long candies = 0, passes = 0, total = LONG_MAX; ; ++passes) { const auto production = __int128{m} * w; const long goal = n - candies; const long passes_needed = goal/production + !!(goal%production); const long subtotal = passes + passes_needed; if (passes_needed <= 2) { std::cout << subtotal; return 0; } if (total < subtotal) { std::cout << total; return 0; } total = subtotal; candies += production; if (candies >= p) { const auto d = std::div(candies, p); long budget = d.quot; candies = d.rem; const long diff = w - m; if (diff < 0) { const long w_hired = std::min(budget, -diff); budget -= w_hired; w += w_hired; } else if (diff > 0) { const long m_purchased = std::min(budget, diff); budget -= m_purchased; m += m_purchased; } const long half = budget >> 1;
{ "domain": "codereview.stackexchange", "id": 40947, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "c++, performance, time-limit-exceeded, mathematics, complexity", "url": null }
homework-and-exercises, units, unit-conversion, radiometry The latter two cancel out (a property of Lambertian surfaces), and so the outgoing radiance is dependent on the cosine of the angle between the surface normal and the Sun. This means that the radiance you measure is going to depend on that angle. Let us call the direction pointing directly towards the Sun $\varphi = 0$, so that angle runs up to $\varphi = \pi/2$ at the terminator. We know that incoming solar irradiance is $I_0\approx$1360 W/m$^2$, or whatever number you were provided. Because our surface is Lambertian, we can convert this to outgoing radiance simply by dividing by $\pi$.[1] Let us call this solar radiance $L_0$. If Earth was an infinite, flat sheet, then the measured $L$ in space would not depend on the inverse square law because the area you view would increase at the same rate the intensity of light decreases. This assumption is still valid as long as we aren't too far from Earth. Thus, all that remains is to average $L$ over the area of Earth's surface that we can see. Let us denote $R$ as the radius of Earth and $h$ as the height above Earth from which we measure $L$, the radiance. $\varphi$ is the angle from the normal to the Sun, and $\varphi_0$ is the chosen $\varphi$ at which we are measuring $L$. Finally, $\alpha$ is the albedo. The furthest angle at which our observer will see can be found with simple trig: $$\varphi_m = \arccos\left(\frac{R}{R+h}\right)$$ This gives us a spherical cap of area $A$, $$A = 2\pi R^2(1-\cos\varphi_m) = 2\pi R^2\left(1-\frac{R}{R+h}\right)$$ Now, remember that the incoming irradiance depends on $\cos\varphi$ as $I = I_0\cos\varphi$ So we need to integrate over the spherical cap like
{ "domain": "physics.stackexchange", "id": 49634, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "homework-and-exercises, units, unit-conversion, radiometry", "url": null }
python, optimization, palindrome (In Python 2, you should replace range with xrange and map with itertools.imap.) The insight is that instead of building an odd-length palindrome from the parts prefix + middle + xiferp, we can build it as prefix + iferp: that is, with the middle digit being supplied by the last digit of the prefix. In your main loop, you arrange to generate the first 501 palindromes: for i, palindromeNumber in enumerate(palindromGenerator): ... if i >= 500: break but it would be simpler to use itertools.islice: for i, palindrome in islice(enumerate(palindromeGenerator), 501): ... As for your question about efficiency, it is impossible to answer without knowing the purpose of this code. If all you are going to do is to print the first 501 palindromes, then your code is fine: the runtime will be dominated by printing the output.
{ "domain": "codereview.stackexchange", "id": 4961, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "python, optimization, palindrome", "url": null }
electrostatics, electric-fields, gauss-law, boundary-conditions In the proof after we form our Gaussian box we let the sides of the box (of length say $\epsilon$) tend to zero. Then we arrive at the result that the difference in the electric field produced by charges in the box are $\vec{E}_{\text{above box}} - \vec{E}_{\text{below box}} = \frac{\sigma}{\epsilon_0} \hat{n}$. Your concern is about why the other surface charge contribution outside the Gaussian box does not seem to be present in the derivation of the general formula. The outside contribution simply cancel, since $$\vec{E}_{above} = \vec{E}_{other} + \vec{E}_{\text{above box}}$$ and similarly $$\vec{E}_{below} = \vec{E}_{other} + \vec{E}_{\text{below box}}$$ hence $$\vec{E}_{above} - \vec{E}_{below} = \frac{\sigma}{\epsilon_0} \hat{n}.$$ This is expected since the discontinuity is only from the patch covered by the Gaussian surface, if we removed that patch we would have a continuous electric field in this space. It is also clear to see for cases where we have symmetry, like an infinite charged plane (with uniform surface charge), that $\vec{E}_{above} = \vec{E}_{\text{above box}}$ and $\vec{E}_{below} = \vec{E}_{\text{ below box}}$ (also the formula from the proof clearly holds).
{ "domain": "physics.stackexchange", "id": 32474, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "electrostatics, electric-fields, gauss-law, boundary-conditions", "url": null }
python Title: Runtime Error in Minion Game problem (HackerRank) Below is my function to solve the Minion Game problem on HackerRank along with the problem description. It works wonderfully with regular-length strings, like 'banana', but when it comes to really long ones (ones that produce output counter in the vicinity of 7501500, result in a runtime error (or memory error, depending on where you run it). There must be a way to optimize the code. Can anybody advise? """Kevin and Stuart want to play the 'The Minion Game'. Game Rules Both players are given the same string, S. Both players have to make substrings using the letters of the string S. Stuart has to make words starting with consonants. Kevin has to make words starting with vowels. The game ends when both players have made all possible substrings. Scoring A player gets +1 point for each occurrence of the substring in the string S. For Example: String S = BANANA Kevin's vowel beginning word = ANA Here, ANA occurs twice in BANANA. Hence, Kevin will get 2 Points. """ def minions(s): vowels = ['A','E','I','O','U'] s = s.upper() n = len(s) kevin = dict() stuart = dict() # list all string variations using list comprehension lst = [s[i:j+1] for i in range(n) for j in range(i,n)] # populate dictionaries for i in lst: if i[0] in vowels: if i in kevin: kevin[i] += 1 else: kevin[i] = 1 else: if i in stuart: stuart[i] += 1 else: stuart[i] = 1 kevin_sm = 0 for x,y in kevin.items(): kevin_sm += y stuart_sm = 0 for x,y in stuart.items(): stuart_sm += y if kevin_sm > stuart_sm: print("Kevin {}".format(kevin_sm)) elif kevin_sm == stuart_sm: print("Draw") else: print("Stuart {}".format(stuart_sm))
{ "domain": "codereview.stackexchange", "id": 38172, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "python", "url": null }
ros2 Original comments Comment by suab123 on 2021-02-19: thanks for the answers, prev I had built foxy, but someone told me build on this instead https://raw.githubusercontent.com/ros2/ros2/master/ros2.repos all this is done :) What you said forking appropriate repo and then work on it, but then I how do I check if my changes compille or not, prev what I used to do is, suppose I making change in rclcpy then I will copy rclpy to work space(build from source) and then run colcon build to check if my changes are compiling, but this process is a bit tedious. Also is the build type of source Debug build for rclcpp (or any c++ code repos). Comment by Morgan on 2021-02-19: Ah, yeah, if you're wanting to work on the leading-edge stuff and make PR's back to the main/master branches of the upstream repos, you're correct, you'll need to use a repo list that has all of the main / master branches in it, not the foxy branches. My mistake. The contributing guide here should be exhaustive and up-to-date: https://index.ros.org/doc/ros2/Contributing/#contributing-code There is no need to be copying code between various places in your filesystem every change; you can set up your workspace to have your own forks in it. Then you can just edit-in-place and compile (typically in separate terminals, just for convenience). Usually you only want to work on a small number (like 1 or 2) of the many repos that vcs will clone for you, so you can just let the "full" vcs clone finish, then go in by hand and point the 1 or 2 repos you want to your own personal forks and git pull them. I'm not a git expert by any means, but that works for me. Comment by suab123 on 2021-02-19: okay this will seem to solve the problem, thanks for the help Also do you know if Debug build is build from default when we build workspace with colcon?
{ "domain": "robotics.stackexchange", "id": 36104, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "ros2", "url": null }
quantum-interpretations, error-analysis, wavefunction-collapse, thought-experiment, quantum-measurements This generalization allows us to model the sensitivity and details of our detector. In this example, the detector registers no "false positives" (i.e. if the detector says it's in the bin $[-a,a]$, then the post-measurement state is entirely within the bin) and is less sensitive near the bin edges. If you choose a gaussian rather than a bump function, the former is no longer true because the support of the gaussian extends over the whole real line. The fact that a POVM does not uniquely define our post-measurement states can be understood from Naimark's theorem, which tells us that any POVM on some Hilbert space $\mathcal H_A$ can be understood as a PVM on a larger space $\mathcal H_A'$. Physically, the idea is that we must couple our system to a model of our measurement device, and the details of this coupling affect the possible post-measurement states of the system being measured. Two different models of this interaction may yield the same set of probabilities while having completely different post-measurement states, and it is here that we find the physical origin of the ambiguity discussed above. If all we want are the probabilities of various outcomes, then writing down a POVM is sufficient; on the other hand, if we want to know what states the system might be in after the measurement has been performed, we need more details about precisely how the system interacts with the measurement device, which is encoded in a specific choice of $\{M_i\}$.
{ "domain": "physics.stackexchange", "id": 76884, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "quantum-interpretations, error-analysis, wavefunction-collapse, thought-experiment, quantum-measurements", "url": null }
java, game, swing, pong How can I improve/optimize my code? Any thoughts are appreciated. Overall I find your code quite good as it stands. :) You've got sensible classes with sane, short methods. However, there were a few points that you could improve. Let's look at your solution class by class: Pong class: When you turn on strict enough compiler warnings in your IDE, you'll notice it warns about the fields WIDTH and HEIGHT hiding other fields. This is indeed true: public static final int WIDTH and HEIGHT are defined in the ImageObserver interface high up in the inheritance hierarchy of your class. You'll notice you get no errors even if you delete the line where you define those constants. You should come up with unique names for those variables, perhaps something like PLAYING_AREA_WIDTH. That'd also be more descriptive than just plain "WIDTH", which could be the width of the window, or that of the playing area if it wasn't as big as the window, but as of now nobody can know it for sure without inspecting the code more closely and trying the program. Constructors should also be used just for light weight initialization stuff, but here it starts the entire game by initializing the PongPanel class. This is as much a fault of the PongPanel class, though. I'd add a start() method into both and change the main method of the Pong class to say "Pong game = new Pong(); game.start();". Ignoring new instances of classes, like the main method currently does, is quite confusing. Did the developer just forget to assign it into a variable? What is supposed to happen? game.start() would make it explicit. PongPanel class:
{ "domain": "codereview.stackexchange", "id": 3923, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "java, game, swing, pong", "url": null }
Thanks much, Mac The highlighted part in incorrect. You have multiplied the exponents of $$\sin(x)$$ instead of adding them. Kind Regards, Sudharaka. ##### Member The highlighted part in incorrect. You have multiplied the exponents of $$\sin(x)$$ instead of adding them. Kind Regards, Sudharaka. Distributing $$\displaystyle \int[\sin^{\frac{-3}{2}}(x)-sin^{\frac{1}{2}}(x)]*cos(x)dx$$ Substituting U=sin(x) du=cos(x)dx $$\displaystyle \int [u^{\frac{-3}{2}}-u^{\frac{1}{2}}]du$$ Integrating $$\displaystyle -2u^{\frac{-1}{2}}-\frac{2}{3}u^{\frac{3}{2}}$$ And finally, and simplified as I can see, $$\displaystyle -\frac{2}{\sqrt{\sin(x)}}-\frac{2\sqrt{sin^3(x)}}{3}+C$$ This still doesn't match what Wolfram has, but I'm probably getting something wrong with that. Let me know if this looks right. My brain isn't functioning at 100% this morning, and most of it's limited power is going into keeping the Latex code straight. I appreciate the help, Sudharaka Mac #### Sudharaka ##### Well-known member MHB Math Helper Distributing $$\displaystyle \int[\sin^{\frac{-3}{2}}(x)-sin^{\frac{1}{2}}(x)]*cos(x)dx$$ Substituting U=sin(x) du=cos(x)dx
{ "domain": "mathhelpboards.com", "id": null, "lm_label": "1. YES\n2. YES", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.9728307684643189, "lm_q1q2_score": 0.820967119211723, "lm_q2_score": 0.843895100591521, "openwebmath_perplexity": 436.79949343190526, "openwebmath_score": 0.7606997489929199, "tags": null, "url": "https://mathhelpboards.com/threads/trigonometric-integrals.1168/" }
quantum-mechanics, orbital-motion, atomic-physics, hilbert-space The snapshot above is taken from Principles of Physical Chemistry By Hans Kuhn, Horst-Dieter Försterling, David H. Waldeck I haven't found any deduction as to how the coefficients determine the spatial orientation. I thought they are just amplitudes to go from the hybridised state to the pure orbital state; how can they direct the spatial orientation? In fact, why would they have to direct the direction of the orbitals. They are probability amplitudes, aren't they? I just want to know how to deduce that these probability amplitudes are actually influencing the direction. How can it be deduced mathematically? You start with: $$ \psi_{sp^3}= c_1\psi_{2s}+ c_2\psi_{2p_{x}} + c_3\psi_{2p_y}+ c_4\psi_{2p_{z}} \tag{1} $$ Since $\psi_{sp^3}$ is normalised we know that: $$ \langle \psi_{sp^3} | \psi_{sp^3} \rangle = 1 $$ and if we use equation (1) to substitute for $\psi_{sp^3}$ we get: $$ \langle c_1\psi_{2s}+ c_2\psi_{2p_{x}} + c_3\psi_{2p_y}+ c_4\psi_{2p_{z}} | c_1\psi_{2s}+ c_2\psi_{2p_{x}} + c_3\psi_{2p_y}+ c_4\psi_{2p_{z}} \rangle = 1 $$ and expanding gives:
{ "domain": "physics.stackexchange", "id": 25584, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "quantum-mechanics, orbital-motion, atomic-physics, hilbert-space", "url": null }
finite-automata, nondeterminism Title: in NFA is every state itself contained in set generated by transition function when considering epsilon transition from that state? in $\epsilon$-NFA (NFAs involving $\epsilon$ transitions) when we have $\epsilon$ transitions, I understand it as where can we go if we don't read any symbol from the input tape, then I think every state $q$ from which we are considering transition must belong to $\delta(q,\epsilon)$ because if we don't read anything, we can of course stay in the state where we are at now, I am asking whether $\epsilon$ transition from state to itself is assumed? for example, if we have some state $q_i$ which has $\epsilon$ transition to state $q_j$ then is $\delta(q_i, \epsilon)$=$\{q_j, q_i\}$ or just $\{q_j\}$, I think it's just matter of convention and wouldn't make significant difference. Why not make this a bit formal and let's do the following exercise: For a given NFA, $M = (Q, \Sigma, \delta, q_0, F)$, let us construct another NFA $M' = (Q, \Sigma, \delta', q_0, F)$ where $\delta'$ is the same as $\delta$ with additional $\epsilon$-transition self-loop on every state. We would like to prove these two machines are equivalent, that is, $L(M) = L(M')$. Proof for $L(M) \subseteq L(M')$: For every string $w \in L(M) \subseteq \Sigma^*$, there is a transition path in $M$ from $q_0$ to some final state $q \in F$. By construction the same path also exist in $M'$ thus $w \in L(M')$. Proof for $L(M') \subseteq L(M)$:
{ "domain": "cs.stackexchange", "id": 21898, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "finite-automata, nondeterminism", "url": null }
complexity-theory, asymptotics, runtime-analysis, average-case Title: Trouble finding average case of a find max algorithm I'm trying to find the average case number of times that max is assigned by the algorithm findMax included below. findMax(list): maxNum = -oo # negative infinity for k = 0 to len(list)-1: if list[k] > maxNum: maxNum= list[k] return maxNum The distribution I have considered is uniformly random.
{ "domain": "cs.stackexchange", "id": 17559, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "complexity-theory, asymptotics, runtime-analysis, average-case", "url": null }
electromagnetism, magnetic-fields Title: Biot-Savart Law and Moving Charge A moving (not spinning!) point charge will create a magnetic field, but it is pretty difficult to derive the formula detailing the magnitude of the field at a distance $r$. However, my friend is convinced that you can use Biot-Savart's law to derive the relationship, but I don't think you can because the point charge does not have a defined current, and you can't take a path integral along a wire because the wire is nonexistent. Therefore, my question is: Can you use Biot-Savart's law to derive the formula for the magnetic field generated by a moving point charge? Any help would be appreciated! Edit: I know what the formula is for a moving charge, I just wanted to make sure that the Biot-Savart law does not imply that this formula is true. No you cannot use biot savart law. Biot savart law is derived using the equation: $ \int B \cdot dl = \mu_0 I$ $\nabla × \vec{B} = \mu_0 \vec{J}$ taking the divergence of this gives $\nabla \cdot J = 0$ the current density of a point charge doesn't follow this. You are probably only familiar with the line integral version.The biot savart law is actually a volume integral, using current density instead. The issue isn't that a path isnt defined as we can easily use a volume integral. The issue is that we are deriving under the assumption that the divergence of current density is zero. Naively plugging the current density of a point charge into biot savart law looks like the following (through the magnetic vector potential): $\nabla × A = B$ $\nabla × (\nabla × A) = \mu_0 J$ $\nabla(\nabla \cdot A) - \nabla^2 A = \mu_0 J$ Set $\nabla \cdot A = 0 $ due to field invariance $\nabla^2 A = -\mu_0 J$
{ "domain": "physics.stackexchange", "id": 86966, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "electromagnetism, magnetic-fields", "url": null }
ros Originally posted by eve on ROS Answers with karma: 13 on 2014-05-19 Post score: 1 Original comments Comment by Maya on 2014-05-19: If your catkin workspace space is before /opt/ros/hydro in the ROS_PACKAGE_PATH variable, you can git clone the ros-hydro-roboteq-driver package in your catkin workspace and it will be use instead of the /opt/ros/hydro one ;). Helpful trick if you want to work on its code without changing the /opt. Comment by eve on 2014-05-19: Thanks for the response maya, thats exactly what I'm planning to do. I'm using this reference http://answers.ros.org/question/9197/for-new-package-downloading/ to git clone to my ~/catkin_ws/src/. Ofcourse I'll have to edit it for hydro. Good to know I'm heading the right way :) Comment by Maya on 2014-05-19: Isn't your package already made to work with catkin ? If yes, you just need to git clone it in your workspace and it should work. Comment by eve on 2014-05-20: I sure did! I tried to debug it in my eclipse IDE but I couldnt run the node. I get the error Invalid node name [~]. I have managed to access both channels thanks to ahendrix though! :) From reading the code, it looks like the roboteq driver already supports multiple named channels through the channels parameter. Try running it with something like: rosrun roboteq_driver roboteq_driver_node _channels:='[ "left", "right" ]' Note that the channels parameter is an array of names for the channels, so you may have to play with the syntax a bit to get it right. Originally posted by ahendrix with karma: 47576 on 2014-05-19 This answer was ACCEPTED on the original site Post score: 0
{ "domain": "robotics.stackexchange", "id": 17994, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "ros", "url": null }
go, concurrency If the context passed as an argument gets cancelled, the cancellation will propagate, if you want to cancel the context, call cfunc, and all your routines will receive the cancellation signal (<-ctx.Done()). The caller is unaffected. So with this in mind, let's rewrite the loop a bit (more improvements to follow below, but what we have thusfar): func (c *Consumer) scanShards(ctx context.Context, stream string, ids []string) error { if len(ids) == 0 { return ErrNoIdsProvided } checkpoints, err := c.collector.GetSequenceNumberForShards(stream, ids) if err != nil { return errors.Wrap(err, ErrRetrievingCheckpoints) } if len(checkpoints) == 0 { return ErrNothingToCheck // something like this, should be handled properly } // note ids is irrelevant, checkpoints is the source of truth now errCh := make(chan error, len(checkpoints) - 1) // we'll get rid of this, but I've not explained how, so it's here still: done := make(chan struct{}) wg := sync.WaitGroup{} wg.Add(len(checkpoints)) // wrap around ctx argument once! rctx, cfunc := context.WithCancel(ctx) for id, seqNum := range checkpoints { go func(ctx context.Context, shardID, startSeqNum string) { defer wg.Done() if err := c.scanShard(ctx, shardID, startSeqNum); err != nil { errc <- fmt.Errorf("error in shard %q: %v", shardID, err) } }(rctx, id, seqNum) }
{ "domain": "codereview.stackexchange", "id": 33114, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "go, concurrency", "url": null }
I did this analysis too , well it's very interesting. - 3 years, 4 months ago - 3 years, 4 months ago Here are my thoughts, consider newtons approximation of root, let us assume that the iteration is actually of the form $${ a }_{ n-1 }-\frac { y(a_{n-1} }{ y'(a_{n-1}) }$$=$$a_{n})$$ then comparing we require $$-\alpha \frac { y' }{ y } =cosec(x)\\$$ $$y=(cot(x)+cosec(x))^{ \frac { 1 }{ \alpha } }$$ now after sufficient iterations, newtons method takes us to the closest root, let us see where our expression tends to go as $$x \rightarrow \pi$$ $$\frac { 1+cos(x) }{ sin(x) } \quad =\quad \frac { 2cos(\frac { x }{ 2 } ) }{ 2sin(\frac { x }{ 2 } ) } \simeq 0\quad for\quad x\quad close\quad to\quad \pi$$ as long as $$\alpha \geq 0$$ hence i think it should converge for all values of $$\alpha$$ given $$a_{0} = 1$$ to $$\pi$$ also the rate at which we reach the root may be affected however by alpha, as , alpha tends to $$\infty$$ , the whole equation tends to 1, and hence it approaches 0 perhaps more slowly and hence you see the result (not very sure of this) you should also see raghav's method in the post where a similar question is asked with $$\alpha =1$$ - 3 years, 4 months ago I think we should check the conditions where newton's raphson's methos fails. - 3 years, 4 months ago But this is just amazing at $$\alpha=2$$ , the convergence rate goes awfully slow. - 3 years, 4 months ago
{ "domain": "brilliant.org", "id": null, "lm_label": "1. YES\n2. YES", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.979667647844603, "lm_q1q2_score": 0.8054720894476689, "lm_q2_score": 0.8221891283434876, "openwebmath_perplexity": 918.569426863651, "openwebmath_score": 0.9618282318115234, "tags": null, "url": "https://brilliant.org/discussions/thread/now-this-baffles-me/" }
classical-mechanics, astrophysics, mass, measurements Title: How does a star wobble due to orbiting bodies What equations determine how a star wobbles in response to an orbiting planet, and can it be used to determine the mass of distant objects based on the wobble? If there are other more reliable methods of determining mass than the one I am asking about here, I would appreciate a few links explaining these methods, or an explanation of those methods and their benefits/limitations. Have a look at http://en.wikipedia.org/wiki/Barycenter#Astronomy (and the links from it to find out more about the subject). If you take our Solar System as an example and consider just the heaviest planet Jupiter, the Sun attracts Jupiter, but Jupiter attracts the Sun as well. Jupiter is much lighter than the Sun, but it's heavy enough to significantly move the Sun as it orbits. The barycentre of the Sun-Jupiter system is slightly above the Sun's surface, so an anstronomer looking at the Solar System from the planet Zogg would see the Sun orbiting (i.e. wobbling) about a point just above the Sun's surface. To calculate the mass of the planet you need to know it's orbital period and how much the star is moving. You also need the mass of the star, but we can estimate this from the star's brightness and colour. The period of the star's wobble tells us the radius of the planet's orbit, and from that and how much the star wobbles, i.e. how much the planet moves it, we can work out the mass of the planet. The maths isn't as hard as you might think. See http://en.wikipedia.org/wiki/Doppler_spectroscopy#Procedure for the details. You ask about other methods of determining the mass. In the Solar System we can calculate the masses of planets, asteroids etc by observing their effects on their moons, other planets etc. For exoplanets we can generally only see the star, so that's the only way we have of estimating their mass.
{ "domain": "physics.stackexchange", "id": 3441, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "classical-mechanics, astrophysics, mass, measurements", "url": null }
java, array, statistics The point of most loop syntax is to make the exit conditions for the loop obvious. Instead of while (true) I'd like to see something like: do { ... } while (inVal >= 0) I like that you calculate your max and min in the input loop. You could count your total in that loop as well instead of taking a second loop through your data. Hmm... If you do that, you don't need to use an array or a List, just inVal. You have "magic numbers" 0 and 100. Years from now when three other programmers have worked on this code, they may add a percentage calculation as x / 100 so that when you decide to increase your number of inputs to 200, you search-and-replace 100 with 200 you have broken your percentage calculation. You should factor these out of your code: public final int MAX_NUM_INPUTS = 100; public final int INPUT_TOO_LOW_VALUE = 0; This clarifies what you are comparing in a way that Magic Numbers could not: if (count > MAX_NUM_INPUTS) ... if (inVal <= INPUT_TOO_LOW_VALUE) ... Hopefully no-one would ever calculate percent as x / MAX_NUM_INPUTS. Now you can change these limits in one place without doing any search-and-replace. UPDATE: System.out.println... Yeah, Java is funny about string concatenation. If you have a non-final variable as part of a String, it can cause a bunch of nasty overhead. For a little program like yours, it really doesn't matter what you do. If it were going to print out a String in a loop, then I'd suggest the following change. Note that System.err.println() uses an OS-specific line separator - not necessarily \n. // This is fine for your program.. System.err.println("Error: " + input[count] + " is not valid, exiting.\n");
{ "domain": "codereview.stackexchange", "id": 3140, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "java, array, statistics", "url": null }
quantum-field-theory, condensed-matter, renormalization, many-body Title: Logarithmic discretization in Anderson´s model Is there some motivation for the construction of Ladder operator that compound the recursive halmitonian of the Anderson model for numerical renormalization contained is this paper? Now I know why the Logarithmic discretization are take place in Anderson Model for low temperatures. We want to discretize the energy band-width $[-D,D]$ such that we can perform a numerical calculation. But we want to answering questions of low temperature, and we need to be very careful to apply the thermodynamic limit $N\rightarrow \infty$ before the $T\rightarrow 0$ limit. For understand the dangerous, we can divide the bandwidth, without loss of generality, in $I_n=[\epsilon_n,\epsilon_{n+1}]$ intervals, and then, analyze how this model accommodates this discretization. The strategy is decompose in Fourier modes the field operator $\phi (\epsilon)$ on $I_n=[\epsilon_n,\epsilon_{n+1}]$. The zeroth mode $p=0$ terms are the mean values of $\phi$ on $I_n$ (discretization), and then, the higer modes $p\neq 0$ represents the correction of the discretize approximation. When we see how the Anderson hamiltonian presents, we see that the impurity only couples to the discretization modes ($p=0$), and the conduction are responsible to the coupling of the discretization modes and the corrections ($p\neq 0$). The ratio of the coupling $p\rightarrow q$ with the usual couplings of the $p=0$ modes take the form of $$ J_{p,\,q}=\frac{d\epsilon}{\epsilon}|p-q|^{-1} $$
{ "domain": "physics.stackexchange", "id": 22714, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "quantum-field-theory, condensed-matter, renormalization, many-body", "url": null }
wavefunction, hilbert-space, vectors, linear-algebra, normalization Title: Is a basis vector always unit-length in a wave function? I'm currently studying wave functions and I came across an assertion, that $$\psi(x) = \left<x \middle| \psi \right>$$ is a projection of $\psi$ onto $x$. The vector projection being defined as $$proj_x \psi = \frac{x \cdot \psi}{||x||} \frac{x}{||x||},$$ I don't see, how a wave-function, being just the scalar product, could be a projection, unless $x$ is always a unit-length vector. Is it true? And if $x$ has always unit length, could you, please, explain why? The ket $|x\rangle$ is a little bit more complicated than that. Consider one Hilbert space $\mathcal{H}$ and one orthonormal basis $e_i\in \mathcal{H}$. If $\{e_i : i \in I\}$ is an orthonormal basis then two different elements are orthogonal and each one has unit length. In other words: $$\langle e_i,e_j\rangle = \delta_{ij}.$$ So far so good. The issue is that the so-called "generalized basis" of "generalized eigenkets" of the unbounded operator $X$, namely $|x\rangle$, is normalized according to: $$\langle x|x'\rangle=\delta(x-x').$$ So you see that while in the discrete case $\langle e_i, e_i\rangle = 1$ and it makes sense, in the generalized case $\langle x | x\rangle = \delta(0)$ which doesn't make sense at all. The very norm of $|x\rangle$ is ill-defined.
{ "domain": "physics.stackexchange", "id": 43449, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "wavefunction, hilbert-space, vectors, linear-algebra, normalization", "url": null }
navigation, move-base Title: [Solved] Is clearing_rotation_allowed parameter actually working? Hello all, I'm playing with different combinations of recovery behaviors. In some cases, make the robot spin to recover is not an option, so the clearing_rotation_allowed parameters is really helpful. But it doesn't seem to prevent the robot to make in place rotations, when I keep all other recovery-related parameters with default values. Anyone else show this? Or am I doing something wrong? Originally posted by jorge on ROS Answers with karma: 2284 on 2013-04-29 Post score: 2 Original comments Comment by jorge on 2013-05-06: Btw, I created an issue (#38) It's a misspelling in the code. Until the fix is released, rename clearing_rotation_allowed to clearing_roatation_allowed should work. Originally posted by jorge with karma: 2284 on 2013-05-11 This answer was ACCEPTED on the original site Post score: 3 Original comments Comment by 2ROS0 on 2014-08-05: This is now fixed, just in case anyone else is wondering.
{ "domain": "robotics.stackexchange", "id": 14000, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "navigation, move-base", "url": null }
c++, performance, strings, c++17 // You will need: // concept string_like: // Detects anything stringy. Maybe could just check // convertibility to string_view? // trait char_type_of<T>: // Basically std::ranges::range_value_t<T>, except it has to // work even if T is a char* or char const*. // concept is_static_string: // Returns true for ct_string, character arrays, and // anything tuple-like. // trait static_string_size_of<T>: // Basically tuple_size<T>, but has to work for C arrays. // function to_string_view(): // Basically just a cast to string_view, but has to be smart // about C arrays with embedded NULs. As you can see, there’s not much you need, and most of it is pretty easy to hash out. There is one little wrinkle in C++20, and it’s that even with the if constexpr above, you can’t be sure that the function is running at compile-time. That means that you might not be able to make ct_string consteval-only until C++23. I’d have to do more thinking to know if this is a deal-breaker or not. C++23 will bring if consteval, which will completely solve the problem of figuring out whether a given concat() is happening at run-time or compile-time, and then everything will for sure work. I slapped together a simple godbolt to illustrate: https://godbolt.org/z/P8G3YerTn. Note that I made no attempt to make concat() both compile-time and run-time; it’s all compile-time. And I didn’t bother to make any of the concatenation stuff smart enough to do conversions. But you can see that everything in the eld namespace is compile-time only (except for the IOstream stuff, of course). Summary
{ "domain": "codereview.stackexchange", "id": 44386, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "c++, performance, strings, c++17", "url": null }
fastq, sratoolkit, fastq-dump def split_fastq(fastq, prefix="split"): """ Split reads from a FASTQ Parameters ---------- fastq : str Path to input FASTQ file prefix : str Prefix for output FASTQ files (`_R1.fastq.gz` and `_R2.fastq.gz` are appended) """ # check for file format if fastq.endswith(".gz"): fq_handle = gzopen(fastq, "rt") else: fq_handle = open(fastq, "r") out_handles = {r: gzopen(prefix + "_" + r + ".fastq.gz", "wt") for r in ["R1", "R2"]} # load reads for random access records = SeqIO.parse(fq_handle, "fastq") for read in tqdm(records): # split read into each mate and fix header information mates = split_read(read) # write to each output file for m in mates: out_handles[m].write(mates[m].format("fastq")) fq_handle.close() for m in mates: out_handle[m].close() if __name__ == "__main__": # parse command line arguments PARSER = argparse.ArgumentParser(description="Split a FASTQ into 2 FASTQs by splitting each read in half") PARSER.add_argument( "fq", type=str, help="Input FASTQ to split" ) PARSER.add_argument( "-p", "--prefix", type=str, help="Prefix for output FASTQ files (`_R1.fastq.gz` and `_R2.fastq.gz` are appended)", default="split" ) ARGS = PARSER.parse_args() # run splitting function split_fastq(ARGS.fq, ARGS.prefix)
{ "domain": "bioinformatics.stackexchange", "id": 1408, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "fastq, sratoolkit, fastq-dump", "url": null }
It is more complex than the previous loss functions because it combines both MSE and MAE. The additional parameter $$\alpha$$ sets the point where the Huber loss transitions from the MSE to the absolute loss. Attempting to take the derivative of the Huber loss function is tedious and does not result in an elegant result like the MSE and MAE. Instead, we can use a computational method called gradient descent to find minimizing value of $$\theta$$, which we’ll introduce later in the book. ## 4.3.5. Summary¶ In this section, we introduce two loss functions: the mean absolute error and the Huber loss functions. We show for a constant model fitted using the MAE, $$\hat{\theta} = \text{median}(\textbf{y})$$.
{ "domain": "ds100.org", "id": null, "lm_label": "1. YES\n2. YES", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.9896718459575753, "lm_q1q2_score": 0.8044719034494249, "lm_q2_score": 0.8128673223709251, "openwebmath_perplexity": 3402.357499853237, "openwebmath_score": 0.9811587929725647, "tags": null, "url": "https://www.textbook.ds100.org/ch/04/modeling_abs_huber.html" }
php, beginner, object-oriented, finance Documentation for min method This can be simplified (applies to other issues like this as well): if ($personalAllowance < 0) { $personalAllowance = 0; } return $personalAllowance; It should be like this: return ($personalAllowance < 0) ? 0 : $personalAllowance; This can be simplified (applies to other issues like this as well): public function get_blind_persons_allowance() { $blind_persons_allowance = $this->taxFreeAllowance["blind_persons"]; return $blind_persons_allowance; } It should be like this: public function get_blind_persons_allowance() { return $this->taxFreeAllowance["blind_persons"]; } It is better to have single exit point in a method, that means not multiple return statements in a method. Variable $monthlyIncome not used in method get_employers_pension_amount(), comment in code: if ($this->persona["pension_every_x"] === "month") { // This variable is not used anywhere before return statement $monthlyIncome = $this->persona["gross_annual_income"] / 52; $pensionAmount = $this->persona["pension_contribution_is"]; $annualAmount = $pensionAmount * 52; return $annualAmount; } else { $annualAmount = $this->persona["pension_contribution_is"]; return $annualAmount; }
{ "domain": "codereview.stackexchange", "id": 7161, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "php, beginner, object-oriented, finance", "url": null }
reinforcement-learning, q-learning, dqn, deep-rl, action-spaces It was designed such that the final fully connected layer outputs $Q^\pi(s,\cdot)$ for all action values in a discrete set of actions — in this case, the various directions of the joystick and the fire button. This not only enables the best action, $\text{argmax}_a Q^\pi(s, a)$, to be chosen after a single forward pass of the network, but also allows the network to more easily encode action-independent knowledge in the lower, convolutional layers.
{ "domain": "ai.stackexchange", "id": 972, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "reinforcement-learning, q-learning, dqn, deep-rl, action-spaces", "url": null }
Find the 20th term of the geometric sequence 1, 3, 9, 27, C720 19 Example 2. It has a finite number of terms. The nth term test for divergence. find the value of n for which u n = 327680 Example. Find the value of n for which a n = 40. You can also talk about "generalized Fibonacci sequences", where these restrictions and/or the recursion are changed. You can discover more about the geometric series below the tool. 2, 4, 8 16 2n The sequence whose nth term is common ratio between consecutive terms is —A. Find the 6th term of a geometric sequence with initial term $$10$$, and $$r = 1/2$$. When given a list, such as$1, 3, 9, 27, 81, \ldots$we can try to look for a pattern in a few ways. 1 6, 3 ar==. For example, if a n = n +1 n2 +3,. ( ) ( ) r a r r ar S. When writing the general expression for a geometric sequence, you will not actually find a value for this. r is known as the common ratio of the sequence. Set up the form View the solution. The second term of a geometric series is and the sixth term is. So let's consider a couple examples. Math Tutor Math Teacher Teaching Math Maths Sequence And Series Math Worksheets Math Activities Algebra 1 Arithmetic. The constant d is called common difference. Example-Problem Pair. Sequences - using/finding nth term - scaffolded. A geometric sequence is one in which the ratio of consecutive terms is a constant. An Example. This is much easier than writing out the sequence and counting the terms by hand, especially when the sequence is long. If time allows, review the formula for finding the nth term in a geometric sequence and apply the formula to two more real-world examples. Example 1: 1,2, 4, 8, 16, each term of the sequence is obtained by multiplying by 2 the preceding term. 3 Analyze Geometric Sequences and Series a 2 = -4 = a 1 r2-1 -4 = a 1 r. Since the 1 st term is 64 and the 5 th term is 4, it is obvious that successive terms decrease in value. Ratio does mean comparison/fraction. Really clear math lessons
{ "domain": "ecui.pw", "id": null, "lm_label": "1. YES\n2. YES\n\n", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.9920620051945144, "lm_q1q2_score": 0.8087611825397049, "lm_q2_score": 0.8152324938410784, "openwebmath_perplexity": 242.81990625846828, "openwebmath_score": 0.7629408240318298, "tags": null, "url": "http://vvnn.ecui.pw/finding-the-nth-term-of-a-geometric-sequence-examples.html" }
Discrete Mathematics - Cardinality 17-3 Properties of Functions A function f is said to be one-to-one, or injective, if and only if f(a) = f(b) implies a = b. Cantor’s Theorem builds on the notions of set cardinality, injective functions, and bijections that we explored in this post, and has profound implications for math and computer science. surjective non-surjective injective bijective injective-only non- injective surjective-only general In mathematics, injections, surjections and bijections are classes of functions distinguished by the manner in which arguments (input expressions from the domain) and images (output expressions from the codomain) are related or mapped to each other. A function $$f: A \rightarrow B$$ is bijective if it is both injective and surjective. Let X and Y be sets and let be a function. 68, NO. It is injective (any pair of distinct elements of the domain is mapped to distinct images in the codomain). Bijective functions are also called one-to-one, onto functions. A function with this property is called a surjection. Definition Consider a set $$A.$$ If $$A$$ contains exactly $$n$$ elements, where $$n \ge 0,$$ then we say that the set $$A$$ is finite and its cardinality is equal to the number of elements $$n.$$ The cardinality of a set $$A$$ is Since the x-axis $$U Think of it as a "perfect pairing" between the sets: every one has a partner and no one is left out. An important observation about injective functions is this: An injection from A to B means that the cardinality of A must be no greater than the cardinality of B A function f : A -> B is said to be surjective (also known as onto ) if every element of B is mapped to by some element of A. 3, JUNE 1995 209 The Cardinality of Sets of Functions PIOTR ZARZYCKI University of Gda'sk 80-952 Gdaisk, Poland In introducing cardinal numbers and applications of the Schroder-Bernstein Theorem, we find that the Functions and
{ "domain": "org.br", "id": null, "lm_label": "1. YES\n2. YES\n\n", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.9843363517478327, "lm_q1q2_score": 0.8405373584622082, "lm_q2_score": 0.8539127473751341, "openwebmath_perplexity": 518.5773486296423, "openwebmath_score": 0.9288099408149719, "tags": null, "url": "http://felizcidade.org.br/2rf5m4/cardinality-of-surjective-functions-b8ae3d" }
java, hashcode Title: Checking for differences between two (large) files I want to write a relatively simple program, that can backup files from my computer to a remote location and encrypt them in the process, while also computing a diff (well not really...I'm content with seeing if anything changed at all, not so much what has changed) between the local and the remote files to see which ones have changed and are necessary to update. I am aware that there are perfectly good programs out there to do this (rsync, or others based on duplicity). I'm not trying to reinvent the wheel, it's just supposed to be a learning experience for myself My question is regarding to the diff part of the project. I have made some assumptions and wrote some sample code to test them out, but I would like to know if you see anything I might have missed, if the assumptions are just plain wrong, or if there's something that could go wrong in a particular constelation. Assumption 1: If files are not of equal length, they can not be the same (ie. some modification must have taken place) Assumption 2: If two files are the same (ie. no modification has taken place) any byte sub-set of these two files will have the same hash Assumption 3: If a byte sub-set of two files is found which does not result in the same hash, the two files are not the same (ie. have been modified) The code is written in Java and the hashing algorithm used is BLAKE-512 using the java implementation from Marc Greim. _File1 and _File2 are 2 files > 1.5GB of type java.io.File public boolean compareStream() throws IOException { int i = 0; int step = 4096; boolean equal = false; FileInputStream fi1 = new FileInputStream(_File1); FileInputStream fi2 = new FileInputStream(_File2); byte[] fi1Content = new byte[step]; byte[] fi2Content = new byte[step]; if(_File1.length() == _File2.length()) { //Assumption 1 while(i*step < _File1.length()) {
{ "domain": "codereview.stackexchange", "id": 13453, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "java, hashcode", "url": null }
image-processing, discrete-signals, signal-analysis, computer-vision, opencv Title: Corner detection using Chris Harris & Mike Stephens I am not able to understand the formula, What is $W$ (window) and intensity in the formula mean, I found this formula in opencv doc http://docs.opencv.org/trunk/doc/py_tutorials/py_feature2d/py_features_harris/py_features_harris.html Harris Corner detector tries to quantify the local intensity changes at all the directions for each pixel. The figure below illustrates the basic idea clearly: So $I(x+u,y+v)$ indicates the pixel intensities of all the neighborhood pixels around $(x,y)$. The window function is applied for feature localization. For most often used Gaussian function, the choice of sigma value corresponds to different feature width in the image.
{ "domain": "dsp.stackexchange", "id": 1515, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "image-processing, discrete-signals, signal-analysis, computer-vision, opencv", "url": null }
thermodynamics, metal, boiling-point, metallurgy, alloy Title: How do foundries prevent zinc from boiling away when alloyed with Aluminum? How do foundries prevent lower boiling point metals such as zinc from boiling away when alloyed in a furnace with higher boiling point metals such as aluminum? When alloys are made by mixing molten metals (actually an alloy only need contain one metal and at least one other compound, metal or not) the metals only need to be heated to their melting point, not all the way to their boiling point. In the example you've given, the melting point of aluminum is $\pu{660^oC}$, which is $\pu{247^oC}$ below the boiling point of zinc, so the volatilization of zinc is negligible under these conditions. However, the issue you bring up does present problems in other cases. For example this article states the following: One difficulty in making alloys is that metals have different melting points. Thus copper melts at $\pu{1,083^oC}$, while zinc melts at $\pu{419^oC}$ and boils at $\pu{907^oC}$. So, in making brass, if we just put pieces of copper and zinc in a crucible and heated them above $\pu{1,083^oC}$, both the metals would certainly melt. But at that high temperature the liquid zinc would also boil away and the vapour would oxidize in the air. The method adopted in this case is to heat first the metal having the higher melting point, namely the copper. When this is molten, the solid zinc is added and is quickly dissolved in the liquid copper before very much zinc has boiled away. Even so, in the making of brass, allowance has to be made for unavoidable zinc loss which amounts to about one part in twenty of the zinc. Consequently, in weighing out the metals previous to alloying, an extra quantity of zinc has to be added.
{ "domain": "chemistry.stackexchange", "id": 8383, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "thermodynamics, metal, boiling-point, metallurgy, alloy", "url": null }
java, algorithm, knapsack-problem for (int i = 0; i < stamps.length; i++) { inProgress.add(new StampCollection(stamps[i])); } while (!inProgress.isEmpty()) { List<StampCollection> nextWave = new ArrayList<>(); for (StampCollection collection : inProgress) { if (collection.getSum() == GOAL) { solutions.add(collection); continue; } if (collection.getStamps().size() >= STAMP_LIMIT) { continue; } for (int i = 0; i < stamps.length; i++) { int stamp = stamps[i]; if (stamp > collection.getLastStampValue() || (collection.getSum() + stamp) > GOAL) { continue; } StampCollection newOne = new StampCollection(collection, stamp); if (newOne.getSum() == GOAL) { solutions.add(newOne); } else { nextWave.add(newOne); } } } inProgress = nextWave; } System.out.println("Found " + solutions.size() + " solutions"); for (StampCollection solution : solutions) { if (solution.getSum() == GOAL) { System.out.println(solution); } else { System.out.println("WTF: " + solution); } } } } I am mainly looking for... Better algorithms Missed opportunities to replace a large part of the code with library functions if (collection.getSum() == GOAL) { solutions.add(collection); continue; } and if (newOne.getSum() == GOAL) { solutions.add(newOne); } else { are redundant. The only time that the first one triggers is if you can meet the solution with a single stamp. So you could do without the second one and just always add to inProgress, or you can move the first one. for (int i = 0; i < stamps.length; i++) { inProgress.add(new StampCollection(stamps[i])); }
{ "domain": "codereview.stackexchange", "id": 21123, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "java, algorithm, knapsack-problem", "url": null }
python, pygame win.blit(pygame.font.SysFont('None', 100).render(str(char1.score) + ' ' + str(char2.score), 0, (255, 255, 255)), ((screensize1//2)-85, 20)) pygame.draw.rect(win, char1.color, (char1.x, char1.y, char1.width, char1.height)) pygame.draw.rect(win, char2.color, (char2.x, char2.y, char2.width, char2.height)) pygame.draw.circle(win, ball.color, (ball.x, ball.y), ball.radius) pygame.display.update()
{ "domain": "codereview.stackexchange", "id": 32954, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "python, pygame", "url": null }
scattering, atmospheric-science, moon Title: Why is the sky of the moon always dark? Why is the sky of the moon always dark compared to the sky of the earth, doesn't it have day and night like earth? The moon does have a night and a day, but this isn't as fully connected to your question as you might think. The moon is tidally locked with the earth, meaning that the same side always faces earth. Since the moon also orbits around the earth (with a period of a lunar month), this means each side changes, over the course of a lunar month, between facing towards the sun and facing away. This is the cause of the phases of the moon, and also describes the day/night cycle for the moon: a full moon is when the side that we can see faces the sun - i.e. "day" for that side - and a new moon is when the side that we can see faces away from the sun - "night". So the moon does have night and day, but a night/day cycle is one lunar month long. However, this doesn't answer your question of why the sky is always dark when viewed from the moon - even when the sun is above the horizon. The reason that the sky appears bright on Earth is that, even when there are no clouds, the atmosphere scatters the sunlight - meaning that only about 75% of the sunlight that reaches the ground appears to come from the sun, while the rest comes from all over the bright sky. This is called Rayleigh Scattering, and is the reason that the sky appears blue. The moon has no appreciable atmosphere to do this scattering, so the sky appears dark.
{ "domain": "physics.stackexchange", "id": 20893, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "scattering, atmospheric-science, moon", "url": null }
B, there is exactly one element “a” in the domain A. such that f(a) = b. The total no.of onto function from the set {a,b,c,d,e,f} to the set {1,2,3} is????? Yes. Learn All Concepts of Chapter 2 Class 11 Relations and Function - FREE. Comparing cardinalities of sets using functions. In the above figure, f … Why does a tightly closed metal lid of a glass bottle can be opened more easily if it is put in hot water for some time? In the example of functions from X = {a, b, c} to Y = {4, 5}, F1 and F2 given in Table 1 are not onto. Maths MCQs for Class 12 Chapter Wise with Answers PDF Download was Prepared Based on Latest Exam Pattern. Example 46 (Method 1) Find the number of all one-one functions from set A = {1, 2, 3} to itself. A function f from A to B is called one-to-one (or 1-1) if whenever f (a) = f (b) then a = b. For understanding the basics of functions, you can refer this: Classes (Injective, surjective, Bijective) of Functions. (C) 81 Onto Functions: Consider the function {eq}y = f(x) {/eq} from {eq}A \to B {/eq}, where {eq}A {/eq} is the domain of the function and {eq}B {/eq} is the codomain. acknowledge that you have read and understood our, GATE CS Original Papers and Official Keys, ISRO CS Original Papers and Official Keys, ISRO CS Syllabus for Scientist/Engineer Exam, Mathematics | Introduction to Propositional Logic | Set 2, Mathematics | Predicates and Quantifiers | Set 2, Mathematics | Some theorems on Nested Quantifiers, Mathematics | Set Operations (Set theory), Inclusion-Exclusion and its various Applications, Mathematics | Power Set and its Properties, Mathematics | Partial Orders and Lattices, Discrete Mathematics | Representing Relations, Mathematics | Representations of Matrices and Graphs in Relations, Mathematics | Closure of Relations and Equivalence Relations, Number of possible Equivalence Relations on a finite set, Discrete Maths | Generating Functions-Introduction and
{ "domain": "ftsamples.com", "id": null, "lm_label": "1. Yes\n2. Yes", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.9711290880402378, "lm_q1q2_score": 0.8006589524030749, "lm_q2_score": 0.8244619199068831, "openwebmath_perplexity": 616.316016467414, "openwebmath_score": 0.6106613874435425, "tags": null, "url": "https://ftsamples.com/duke-dumont-nvzfprv/5ac578-total-no-of-onto-functions-from-a-to-b" }
electric-circuits, vectors, superposition, complex-numbers, linear-systems $$\mathrm{Re}\circ\mathscr{U}(R\,e^{i\,\theta}\times a\,e^{i\,\alpha}) = a\,R\,\cos(-\omega\,t+\theta+\alpha)\tag{8}$$ and, moreover, $\mathrm{Re}\circ\mathscr{U}$ is bijective if we restrict it to complex constants and the inverse mapping to functions of the form $\tilde{f}(t) = R\,\cos(-\omega\,t+\theta)$; the latter restricted set is all we want to work with in the phasor method. (6) and (7) say that the addition operation 2. is faithfully reproduced if we represent our arbitrarily phased sinusoids by complex constants and add the latter, and (8) says that we can replicated property 3. above by representing the action of any linear system by a complex scaling constant and applying this constant through complex multiplication on the number $z=R\,e^{i\,\theta}$ to find the amplitude and phase of the linear system's output. Complex numbers of course add like vectors. Something else we get from the phasor method is the inner product that represents the time-averaged product of two sinusoidally varying quantities, that is, if $z=R\,e^{i\,\theta}$ and $z^\prime=R^\prime\,e^{i\,\theta^\prime}$ are two complex number representing the time varying sinusoids $R\,\cos(-\omega\,t+\theta)$, $R^\prime\,\cos(-\omega\,t+\theta^\prime)$, then:
{ "domain": "physics.stackexchange", "id": 46396, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "electric-circuits, vectors, superposition, complex-numbers, linear-systems", "url": null }
python, strings, natural-language-processing This is the maximum length a line should be, then extract a variable in your function to say so. You can also make this an argument to the function with default value 38. line length Try to limit the line length. For long expression (the if and while classes, I would split the across lines. To help me be consistent here, I use black Shadow standard modules string is a standard module, so I would pick another name for this argument. Alternative approach In python, it is very easy to split a line into words (line.split(' ')), So you can work per word instead of per character, and then look that word up in the abbreviations dict def shorten_words(abbreviations, line, max_length=38): while len(line) > max_length: for word in line.split("\t"): if word in abbreviations or word + "S" in abbreviations: line = line.replace(word, abbreviations[word]) break return line
{ "domain": "codereview.stackexchange", "id": 32748, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "python, strings, natural-language-processing", "url": null }
three forces by first finding the resultant F' = F1 + F2 and then forming FR = F' + F3. Plan: 1) Using the geometry and trigonometry, write F1 , F2 , &F3, and FR in Cartesian vector form. A unit vector is simply a vector with unit magnitude. Find the value of α and β if T = 450 N, P = 250. 6kN Force 3 is located at 0,0,-5 and has a magnitude of 24. How is Hydrostatic Force on the vertical or inclined planes determined? Basic conditions for a Plane surface submerged in a fluid - Force on the surface: Perpendicular to the surface (No τ). The force must be perpendicular to the direction of displacement in order to produce work. • Step 2 is to add all the x-components together, followed by adding all the y- components together. ANSWER: Correct Problem 2. If =< 1, 2, 3> and =< 1, 2, 3>, then ∙ = | | cos𝜃, where 𝜃 is the angle between the vectors when placed tail-to-tail at the origin. Determine (a) the moment of the couple formed by the two 21-1b forces, (b) the perpendicular distance between the 12-1b forces if the resultant of the two couples is zero, (c) the value of if the resultant couple is 72 lb. Physics 215 - Experiment 2 Vector Addition 2 Advance Reading Urone Ch. Find their sum, or resultant, giving the magnitude of the resultant and the angle that it makes with the larger force. Determine the magnitude and direction of the resultant force. Chapter 2 and 3 Particle. You should be able to use these types of. Vector Calculator. In the second case (on the right), the forces are applied in opposite directions. ME273: Statics: Chapter 4. DIRECTION must be entered in degrees, increasing 'counterclockwise'. 2: Handle forces F1 and F2 are applied to the electric drill. F2 = 7 kips 45° y. Also, I tried calculating the. Figure 5 summarizes all the necessary steps to find the equilibrium condition for a concurrent system of forces in 3D, using funicular, polyhedral construction. This is illustrated in Fig. Russell Johnston, Jr. 0) = –45 degrees. To simplify the creation of large vectors, you can define a vector by specifying the first
{ "domain": "aranceinn.it", "id": null, "lm_label": "1. YES\n2. YES\n\n", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.979667647844603, "lm_q1q2_score": 0.8076986803761943, "lm_q2_score": 0.8244619306896956, "openwebmath_perplexity": 431.3631302469679, "openwebmath_score": 0.642760157585144, "tags": null, "url": "http://aranceinn.it/lhkt/determine-the-magnitude-of-the-resultant-force-3d.html" }
ros Tf-tree is normal, tf-echo odom base_link works properly Edit 0: Traceback (most recent call last): File "/home/robotics/Documents/ros/src/navigation_car/odom_sender.py", line 51, in trans,rot = tf_listener.lookupTransform(odom_frame, base_frame, rospy.Time() ) tf.LookupException: "odom" passed to lookupTransform argument target_frame does not exist. Edit 1: new error: Traceback (most recent call last): File "/home/robotics/Documents/ros/src/navigation_car/odom_sender.py", line 66, in odom_pub.publish(odom) File "/opt/ros/indigo/lib/python2.7/dist-packages/rospy/topics.py", line 843, in publish self.impl.publish(data) File "/opt/ros/indigo/lib/python2.7/dist-packages/rospy/topics.py", line 1027, in publish serialize_message(b, self.seq, message) File "/opt/ros/indigo/lib/python2.7/dist-packages/rospy/msg.py", line 152, in serialize_message msg.serialize(b) File "/opt/ros/indigo/lib/python2.7/dist-packages/nav_msgs/msg/_Odometry.py", line 167, in serialize buff.write(_struct_7d.pack(_x.pose.pose.position.x, _x.pose.pose.position.y, _x.pose.pose.position.z, _x.pose.pose.orientation.x, _x.pose.pose.orientation.y, _x.pose.pose.orientation.z, _x.pose.pose.orientation.w)) AttributeError: 'tuple' object has no attribute 'x' Edit 2: All is well) This is code
{ "domain": "robotics.stackexchange", "id": 22162, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "ros", "url": null }
php, laravel 4) With regards to the methods used for querying: Only having a single chain of methods that execute for all query types seems problematic. The way one handles query execution, reading out results, recovering from problematic, expected results, can be much different between SELECT, INSERT, UPDATE, and DELETE queries. The query() method where the SQL statement and parameters for binding are provided by caller have no data validation whatsoever. You should immediately exit and not trying to move further in execution if you don't have valid values to work with. queryErrors() method seems meaningless based on earlier commentary regarding these custom exceptions. bindParams() method seems pointless. You are just building a duplicate of the array you already have (and then not actually doing any binding)? createPreparedStatement() seems inappropriately named. I would expect such a method to do what it says. Perhaps executePreparedStatement() would make more sense. By using fetchAll() after prepared statement is executed, you are really limiting the caller to HAVE to use the more memory intensive act of reading out the entire data set into a variable vs. allowing the caller to iterate the result set. PhishingController Thoughts Same thoughts as above around error logging. webbugExecutionEmail() seems oddly named since it doesn't actually send an email, but rather seems to add someone to some email list in DB. I would pass DB object to this class ass a dependency, since it appears it cannot work without. This saves you from instantiating DB connections in every method.
{ "domain": "codereview.stackexchange", "id": 20839, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "php, laravel", "url": null }
c++, algorithm int main() { std::vector<std::vector<int>> queues; std::vector<int> result; // lift exactly full queues = { {}, {}, {5,5,5,5,5}, {}, {}, {}, {} }; result = {0, 2, 5, 0}; assert(the_lift(queues, 5) == result); // up queues = { {}, {}, {5,5,5}, {}, {}, {}, {} }; result = {0, 2, 5, 0}; assert(the_lift(queues, 5) == result); // down queues = { {}, {}, {1,1}, {}, {}, {}, {} }; result = {0, 2, 1, 0}; assert(the_lift(queues, 5) == result); // up and up queues = { {}, {3}, {4}, {}, {5}, {}, {} }; result = {0, 1, 2, 3, 4, 5, 0}; assert(the_lift(queues, 5) == result); // down and down queues = { {}, {0}, {}, {}, {2}, {3}, {} }; result = {0, 5, 4, 3, 2, 1, 0}; assert(the_lift(queues, 5) == result); // yoyo queues = { {}, {}, {4,4,4,4}, {}, {2, 2, 2, 2}, {}, {} }; result = {0, 2, 4, 2, 4, 2, 0}; assert(the_lift(queues, 2) == result);
{ "domain": "codereview.stackexchange", "id": 40285, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "c++, algorithm", "url": null }
thermodynamics Title: How many heaters needed A room 10"x10"x17" lxbxh respectively to be heated 397F if a heater is placed inside the room (2 kw) how many heater are to be required to heat the room from room temperature to 397 F in 1 hour. You miss a piece of key information: the "beginning" temperature of the room. Oh, and for the love of God, what is wrong with SI units that you Americans never use them? Converting units 10"=0.254m 17"=0.4318m 397F=202.778C=475.778K
{ "domain": "engineering.stackexchange", "id": 2894, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "thermodynamics", "url": null }
electromagnetic-radiation That being said, all objects emit radiation at lower frequencies, including at the $1Hz$ range. However, when we observe these objects, we tend to look for frequencies that will have enough energy to be easily visible and using well known technology. Currently, we use Radio waves as the lowest range (Yes, I see the tautology there), specifically the mid to high-end radio waves. The reason being manifold; as wavelength goes up, your antenna dish needs to be on the same scale as it or larger. This means for even poor resolution, a $1Hz$ telescope would need to span almost to the Moon (as I mentioned earlier). Also, $1Hz$ is very far from the peak emitted frequency of any object, which means that the power at that frequency would be extremely low. In most cases, it is so low that one could approximate the amount of radiation at $1Hz$ as zero. In summary, $1Hz$ is a very natural frequency, in fact cosmologists often talk about frequencies much lower; with wavelength on the order of the size of the visible universe. The technology does exists to be able to measure such a wave, but it is (in almost all cases) impractical to do so and thus, there is no standard equipment existing that can do it. All objects emit $1Hz$ radiation, however this is nowhere near the peak frequency of any natural body, so detecting it from a natural object would be pointless and require massive amounts of power.
{ "domain": "physics.stackexchange", "id": 8287, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "electromagnetic-radiation", "url": null }
rosparam, ros-indigo Title: How can I set several parameters with a single call of rosparam? I would like to set several ROS parameters via a single call of rosparam (run in a docker container means loading from .yaml with rosparam load dump.yaml is no option for me). Can I use rosparam set <...> to get this done somehow? (The wiki cli docs probably lack something which I could use.) I tired a single line invocation like follows but got an yaml.scanner.ScannerError: $ rosparam set /gains "p: 1.0 i: 1.0 d: 1.0" ... yaml.scanner.ScannerError: mapping values are not allowed here in "<string>", line 1, column 9: p: 1.0 i: 1.0 d: 1.0 ^ Originally posted by thinwybk on ROS Answers with karma: 468 on 2018-05-18 Post score: 0 Original comments Comment by gvdhoorn on 2018-05-18:\ run in a docker container means loading from .yaml [..] is no option for me can you explain this? As long as the master is accessible you could even run rosparam outside your container and load entire dumps. Comment by thinwybk on 2018-05-18: can you explain this? I could do so. But I prefer to have the docker environment completely separated from my local workstation OS environment. And if I'd like to load dumps I'd need to handle docker volumes/mounts which I don't like to do in this case. Comment by thinwybk on 2018-05-18: rosparam set /gains "{p : 1.0, i : 1.0, d : 1.0}" works just fine btw. If you post it as answer I'll accept it... Comment by gvdhoorn on 2018-05-18:\ And if I'd like to load dumps I'd need to handle docker volumes/mounts which I don't like to do in this case.
{ "domain": "robotics.stackexchange", "id": 30856, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "rosparam, ros-indigo", "url": null }
python, beginner, python-3.x, game Job Selection Your method to choose a job was a whole 332 lines long! That's a lot of code to just select what your profession is. Using a simple dict, we can use the names of the jobs as values, and have each abcde option as the key. Using this method, I was about to shrink the method down to 23 lines, 309 lines shorter! Global Variables Q: Should you use global variables in your program? A: 90% of the time, NO. It's anyones guess what the right answer is. Using global variables has a plethora of nasty things that can affect your program. This document can explain the negative effects of using global variables better than I ever will be. Method Docstrings You should include docstrings on the first line of every method you write. This will help documentation identify what your method is supposed to do. Variable/Method Naming You should use snake_case and not camelCase or nonexistentcase when naming variables in python. Main Guard When running code outside a method/class, it's always good to use a main guard. This is a StackOverflow question that helps explain the benefit/use of the guard. An excerpt from the accepted answer: Having a main guard clause in a module allows you to both run code in the module directly and also use procedures and classes in the module from other modules. Without the main guard clause, the code to start your script would get run when the module is imported. Objects In your code, you have variables like so: cash = 100 Bank_balance = 0 hunger = 100 inventory = [] Skill = 0 count = 0 job_position = [] This code is just screaming to be organized into an object. Having classes, especially in this context of a simulator, can really help the flow of the program, and help you remember what belongs to what. I put the above code into a player class: class Player: """ Player Class """ def __init__(self, name): self.name = name self.bank_account = BankAccount(self) self.cash = 100 self.hunger = 100 self.job = None self.skill = 0 self.inventory = [] self.pin = 0 #Used to calculate bonuses for Teacher, AA, and HR self.fulltime_days_worked = 0
{ "domain": "codereview.stackexchange", "id": 35290, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "python, beginner, python-3.x, game", "url": null }
tensor-calculus, lorentz-symmetry, invariants, diffeomorphism-invariance Title: Why are the metric and the Levi-Civita tensor the only invariant tensors? The only numerical tensors that are invariant under some relevant symmetry group (the Euclidean group in Newtonian mechanics, the Poincare group in special relativity, and the diffeomorphism group in general relativity) are the metric $g_{\mu \nu}$, the inverse metric $g^{\mu \nu}$, the Kronecker delta $\delta^\mu_\nu$, and the Levi-Civita tensor $\sqrt{|\det g_{\mu \nu}|} \epsilon_{\mu \nu \dots}$. (Note that $\delta^\mu_\nu = g^{\mu \rho} g_{\rho \nu}$, so only two of the first three invariant tensors are independent). This result is extremely useful for constructing all possible scalar invariants of a given set of tensor fields, but I've never actually seen it proven. How does one prove that there are no other invariant tensors? For a proof that the only ${\rm SO}(N)$ invariant tensors are products of $\delta_{ab}$'s and Levi-Civita symbols see M. Spivak, A Comprehensive Introduction to Differential Geometry (second edition) Vol. V, pp. 466-481. The number of pages required for the argument shows that it is not trivial. I've just looked up the third edition of Spivak vol V. What is needed is theorem 35 on page 327. This is the section entitled "A Smattering of Classical Invariant Theory." He writes in terms of scalar invariants, but of course an invariant tensor becomes a scalar invariant when contracted with enough vectors, and any such scalar invariant arises from an invariant tensor.
{ "domain": "physics.stackexchange", "id": 42309, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "tensor-calculus, lorentz-symmetry, invariants, diffeomorphism-invariance", "url": null }
java, algorithm, strings ExactStringMatchers.java package net.coderodde.string.matching; import java.util.HashMap; import java.util.HashSet; import java.util.Map; import java.util.Set; import java.util.TreeSet; /** * This class contains different string matching algorithms as static methods. * * @author Rodion "rodde" Efremov * @version 1.6 (Nov 7, 2015) */ public final class ExactStringMatchers { /** * Returns an exact string matcher implementation based on the * <a href="https://en.wikipedia.org/wiki/Knuth%E2%80%93Morris%E2%80%93Pratt_algorithm"> * Knuth-Morris-Pratt algorithm</a>, that runs in time {@code O(n + m)}, * where {@code n} is the length of the string to search in, and {@code m} * is the length of the pattern. The space complexity is {@code m} for * holding a so-called "failure function". * * @return an exact string matcher. */ public static ExactStringMatcher getKnuthMorrisPrattMatcher() { return new KnuthMorrisPrattMatcher(); } /** * Returns an exact string matcher implementation based on * <a href="http://www.geeksforgeeks.org/pattern-searching-set-5-efficient-constructtion-of-finite-automata/"> * finite automata</a>. Runs in time {@code O(n + ms)}, where {@code n} is * the length of the range to search, {@code m} is the length of the pattern * to search for, and {@code s} is the number of distinct characters in the * pattern. The space complexity is {@code O(ms)}. * * @return an exact string matcher. */ public static ExactStringMatcher getFiniteAutomatonMatcher() { return new FiniteAutomatonMatcher(); }
{ "domain": "codereview.stackexchange", "id": 16730, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "java, algorithm, strings", "url": null }
newtonian-mechanics, forces, rotational-dynamics, reference-frames, torque Title: What is the explanation of greater torque having greater "rotatory effect" on a stationary body? Why does moving a constant force further from center of mass (and thus increasing torque) increase angular acceleration? I know that the explanation for my question is that during the same angular displacement the same amount of force would be exerted over longer (linear) displacement, hence doing more work, and since conservation of energy is a thing the angular acceleration would increase, but it (at least for me) doesn't explain why moving a weight on a balanced beam makes it move (because when it is not yet moving, no work is being done and I can't mathematically prove that it would move). I used to ask myself a similar question: How does a load at one end of a lever know how far away along the lever another force is being exerted? Forgive the anthropomorphic phrasing, but I hope you get my drift. I solved my problem by realising that the lever had to have some internal structure. I considered the case of a lever of length 6$a$, pivoted at a point one third of the way along. I envisaged a lever in the form of a pin-jointed lattice of thin weightless struts and ties. The bottom of the lever is a thin horizontal rod of length 6$a$, resting on the pivot. A distance $a$ above the bottom rod is another thin horizontal rod. Between the two rods are 6 rods of length $\sqrt 2 a$, angled at 45°, each at 90° to its neighbour(s), to form a lattice running from one end of the bottom rod to the other. Two of the angled rods are one side of the pivot; the other four are on the other side; the top horizontal rod needs to be only $4a$ long. You will find simply by applying force resolution at each joint that if a force $W$ is applied downwards at the end of the long arm of the lever, a force $2W$ is needed at the end of the short arm, in order to have equilibrium. I then convinced myself that this result is independent of the particular internal structure chosen. This is almost certainly a very eccentric method of establishing the law of the lever (principle of moments) but I found it instructive and convincing!
{ "domain": "physics.stackexchange", "id": 91761, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "newtonian-mechanics, forces, rotational-dynamics, reference-frames, torque", "url": null }
2 words related to collinear: linear, one-dimensional. 81 #7,10,11,12a,19. The non-collinear points A, B, C have position vectors a, b, c respectively. provides wireless fiber connectivity including free-space optical, millimeter wave, and hybrid links to service provider and enterprise networks around the globe. We discuss restrictions on operators in the soft-collinear effective theory (SCET) which follow from the ambiguity in the decomposition of collinear momenta and the freedom in the choice of light-like basis vectors n and n̄. Dec 23, 2011. However, the product of X1,X2 is strongly associated with either X1 or X2, which is indicated by the proximity between X1 and X1X2, and between X2 and X1X2, respectively (As you notice, the product vector is longer than X1 and X2. c — sa + tb for unique scalars s and t) Linear Combinations of Vectors: If v and u are non-zero, non collinear vectors, then any vector OP in the plane containing v and u can be expressed as a linear combination of v and u. Part (ii): Perpendicular vectors (example to try. – Vectors that belong to the same line through the origin are called collinear, i. Vectors are not the same thing as lines. 17 lessons • 3 h 13 m. The ALS algorithm , however, can suffer from slow convergence, in particular, when a set of column vectors in one of the factor matrices is (close to being) collinear. 8) Two non-collinear non-zero vectors are always linearly independent. The vertices A, B and C of a triangle have. I think it would be faster than the cross product because you don't need to determine the length of a vector, or to make a lot of subtractions and multiplications like. Show that MN is parallel to AB. In this video, you'll learn how to write and draw vectors. However, we shall give this notion a different name, and call it collinearity. In Straight Lines, we learned that points are collinear if they lie on the same straight line. (viii) Coplanar Vectors A system of vectors is said to be coplanar, if their supports are parallel to the same plane. " Definition: A vector of dimension n is an ordered collection of n elements,
{ "domain": "i-moschettieri.it", "id": null, "lm_label": "1. YES\n2. YES\n\n", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.975946446405965, "lm_q1q2_score": 0.837135739228198, "lm_q2_score": 0.8577681104440172, "openwebmath_perplexity": 680.3947479524796, "openwebmath_score": 0.7044625878334045, "tags": null, "url": "http://i-moschettieri.it/collinear-vectors.html" }
c#, unit-testing, moq, bdd protected override void Context() { SetupExpressionTranslator(); SetupInstructionFactory(); queryCreator = new CommonQueryCreator(factoryMock.Object, translatorMock.Object); } protected virtual void SetupExpressionTranslator() => translatorMock = new Mock<IExpressionTranslator>(); protected virtual void SetupInstructionFactory() => factoryMock = new Mock<IInstructionFactory>(); public class when_creating_count_query : describe_CommonQueryCreator { private ICount resultQuery; public class given_correct_input : when_creating_count_query { private readonly string tableName = "MimasTest"; private readonly Expression<Func<bool>> predicate = () => true; private Views.ICondition mockedCondition;
{ "domain": "codereview.stackexchange", "id": 26109, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "c#, unit-testing, moq, bdd", "url": null }
• @BothHtob $\eta(x)$ is the number of square free numbers $< x$. Iqcd showed in quite an elementary way that $\eta(x) = \frac{x}{\zeta(2)} + \mathcal{O}(\sqrt{x})$ that is there is a $C$ such that $|\eta(x)-\frac{x}{\zeta(2)}| < C \sqrt{x}$ implying $\frac{\eta(x)}{x/\zeta(2)} \to 1$ i.e. $\eta(x) \sim \frac{x}{\zeta(2)}$. So you should work on the asymptotic comparison $\sim,o,\mathcal{O}$ – reuns Oct 5 '16 at 2:50 • @BothHtob to be clear $f(x) \sim g(x)$ is the same as $f(x) = g(x) + o(g(x))$ and $f(x) = a x + \mathcal{O}(\sqrt{x})$ is much stronger than $f(x) = a x+o(x)$ itself the same as $f(x) \sim a x$ – reuns Oct 5 '16 at 2:55
{ "domain": "stackexchange.com", "id": null, "lm_label": "1. YES\n2. YES", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.9615338101862455, "lm_q1q2_score": 0.8371087005596501, "lm_q2_score": 0.8705972600147106, "openwebmath_perplexity": 258.52694495044307, "openwebmath_score": 0.8990674018859863, "tags": null, "url": "https://math.stackexchange.com/questions/1953304/asymptotic-formula-for-nth-square-free" }
ros, 2dlaserscan, pointcloud Title: pointcloud_to_laserscan with ldmrs data Hello, I am trying to covert Pointcloud2 msgs obtained by a SICK LD-MRS four layer scanner to Laserscan msgs. i tried to use the pointcloud_to_laserscan package, but it did not work. Following is what i get: $ roslaunch pointcloud_to_laserscan sample_node.launch logging to /home/grapeson/.ros/log/c4b31a3c-b80d-11e7-b725-141877a62928/roslaunch-grapeson-Inspiron.log Checking log directory for disk usage. This may take awhile. Press Ctrl-C to interrupt Done checking log file disk usage. Usage is <1GB. Traceback (most recent call last): File "/opt/ros/kinetic/lib/python2.7/dist-packages/roslaunch/__init__.py", line 307, in main p.start() File "/opt/ros/kinetic/lib/python2.7/dist-packages/roslaunch/parent.py", line 268, in start self._start_infrastructure() File "/opt/ros/kinetic/lib/python2.7/dist-packages/roslaunch/parent.py", line 217, in _start_infrastructure self._load_config() File "/opt/ros/kinetic/lib/python2.7/dist-packages/roslaunch/parent.py", line 132, in _load_config roslaunch_strs=self.roslaunch_strs, verbose=self.verbose) File "/opt/ros/kinetic/lib/python2.7/dist-packages/roslaunch/config.py", line 451, in load_config_default loader.load(f, config, verbose=verbose)
{ "domain": "robotics.stackexchange", "id": 29171, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "ros, 2dlaserscan, pointcloud", "url": null }
field-theory, dirac-equation, complex-numbers, dirac-matrices, charge-conjugation $$ where I used the antilinear property $Ci = -iC$. Now I have run into two issues. I am unsure of how to treat $(C \gamma^{0})(C \gamma^{0})^{-1}$ and also the sign of the $\partial_{\mu}$ term does not match the sign in Zee's expression. Can anyone point me in the right direction? The charge conjugation matrix $C$ is not an antilinear map. It is ordinary matrix with the property that $$ C\gamma^\mu C^{-1} =-(\gamma^\mu)^T. $$ (or maybe $C^{-1} \gamma^\mu C = -(\gamma^\mu)^T$. Conventions differ.).
{ "domain": "physics.stackexchange", "id": 74543, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "field-theory, dirac-equation, complex-numbers, dirac-matrices, charge-conjugation", "url": null }
performance, matrix, fortran ! work out transition matrices in up/down states ! and compute the decoherence do i=1,nb_pairs ! rotate to eigenbasis and propagate Tu(i)%elements = matmul(Zgate_u(i)%elements, matrot_u(i)%elements) ! rotate back to bath basis Tu(i)%elements = matmul(matrottrans_u(i)%elements, Tu(i)%elements) ! Idem down state Td(i)%elements = matmul(Zgate_d(i)%elements, matrot_d(i)%elements) Td(i)%elements = matmul(matrottrans_d(i)%elements, Td(i)%elements) ! Initialize Tud and Tdu Tud(i)%elements = matmul(Tu(i)%elements, Td(i)%elements) Tdu(i)%elements = matmul(Td(i)%elements, Tu(i)%elements) do k=1,CP_seq if(modulo(k, 2) .ne. 0) then Tfu(i)%elements = matmul(Tfu(i)%elements, Tud(i)%elements) Tfd(i)%elements = matmul(Tfd(i)%elements, Tdu(i)%elements) else if(modulo(k, 2) == 0) then Tfu(i)%elements = matmul(Tfu(i)%elements, Tdu(i)%elements) Tfd(i)%elements = matmul(Tfd(i)%elements, Tud(i)%elements) end if end do ! Decoherence from initial |down-up> bath state L_pairs(i) = abs(conjg(Tfd(i)%elements(1, 1))*Tfu(i)%elements(1, 1) & - Tfd(i)%elements(1, 2) * Tfu(i)%elements(2, 1))
{ "domain": "codereview.stackexchange", "id": 11581, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "performance, matrix, fortran", "url": null }
newtonian-mechanics, forces Title: If I'm floating in a vacuum, can I move an object of any mass? If I'm floating in a vacuum, is it possible for me to move an object that on Earth weights 1000 tons? Do I understand correctly that any mass will be moved and accelerated proportional to my weight and the acceleration with which I push it and moving forever? Does this work in real life, or are there forces that impede this? Let's say a meteor from space hits the earth at standard meteor velocity, it weights on Earth about a ton. Was the Earth's speed affected by this permanently in theory, even if impossible to measure? Yes you can. By $F = ma$, as long as you exert a net force, you'll cause an acceleration. In the "vacuum" you're thinking of (i.e. no gravitational force) there is no friction or resistance force so any force you exert will be the net force and there'll be an acceleration. Let's say a meteor from space hits the earth at standard meteor velocity, it weights on Earth about a ton. Was the Earth's speed affected by this permanently in theory, even if impossible to measure? Yes it was permanently affected by this in theory.
{ "domain": "physics.stackexchange", "id": 85314, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "newtonian-mechanics, forces", "url": null }
physical-chemistry, quantum-chemistry &= \left\langle (\hat{A} - a)\psi \middle| (\hat{A} - a)\psi \right\rangle \tag{9} \end{align}$$ where, in going from $(7)$ to $(8)$, I have invoked the hermiticity of $(\hat{A} - a)$ (since $\hat{A}$ is hermitian and $a$ is only a constant). Likewise, for a second observable $B$ with $\langle B \rangle = b$, $$\sigma_B^2 = \left\langle (\hat{B} - b)\psi \middle| (\hat{B} - b)\psi \right\rangle \tag{10}$$ The Cauchy-Schwarz inequality ...states that, for all vectors $f$ and $g$ belonging to an inner product space (suffice it to say that functions in quantum mechanics satisfy this condition), $$\langle f | f \rangle \langle g | g \rangle \geq |\langle f | g \rangle|^2 \tag{11}$$ In general, $\langle f | g \rangle$ is a complex number, which is why we need to take the modulus. By the definition of the inner product, $$\langle f | g \rangle = \langle g | f \rangle^* \tag{12}$$ For a generic complex number $z = x + \mathrm{i}y$, we have $$|z|^2 = x^2 + y^2 \geq y^2 \qquad \qquad \text{(since }x^2 \geq 0\text{)} \tag{13}$$ But $z^* = x - \mathrm{i}y$ means that $$\begin{align} y &= \frac{z - z^*}{2\mathrm{i}} \tag{14} \\
{ "domain": "chemistry.stackexchange", "id": 6495, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "physical-chemistry, quantum-chemistry", "url": null }
homework-and-exercises, continuum-mechanics, stress-strain, non-linear-systems, structural-beam Title: What is the difference between a linear and non-linear solution in the bending of beams? I have been working on a simulator for bending of beams and came now to a tricky doubt: What should be the difference between a linear and non linear solution in this case (graphic at bottom)? The solution of the following ODE gives us the non-linear curvature: and for very small angles (dy/dx)^2 will tend to zero, so we can linearize (Sorry, $dy=dv$ in this image): So we integrate the following equation (I used the bvp4c function on Matlab) , that includes the curvature, to obtain the deflection of the beam: In red is the non-linear solution and in Blue the linear solution. My doubt is: at the middle of the $x$-axis $dy/dx=0$ in both curves, should I expect then also to have the same value of $y$, since at that precise point I could also cancel $dy/dx$ in the formula and both equations would look the same? In other words, what should I expect as a difference between a linear and a non-linear solution in such equations? I don't think that the deflection of the beam in the centre should be the same. You use two different relations to compute curvature from the deflection. Since, you use the same load, the two different relation have to result in different solutions. In general it's hard if not impossible to say in advance what the differences in the solution will be. This strongly depends on the simplifications you make on the way to the linear model.
{ "domain": "physics.stackexchange", "id": 13290, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "homework-and-exercises, continuum-mechanics, stress-strain, non-linear-systems, structural-beam", "url": null }