text
stringlengths
1
1.11k
source
dict
machine-learning, neural-network, deep-learning, optimization, gradient-descent Title: Does gradient descent always converge to an optimum? I am wondering whether there is any scenario in which gradient descent does not converge to a minimum. I am aware that gradient descent is not always guaranteed to converge to a global optimum. I am also aware that it might diverge from an optimum if, say, the step size is too big. However, it seems to me that, if it diverges from some optimum, then it will eventually go to another optimum.
{ "domain": "datascience.stackexchange", "id": 7151, "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, neural-network, deep-learning, optimization, gradient-descent", "url": null }
cnn, audio-recognition For a model that takes 2d (time,features) input like a RNN, then it is concatenated on the features axis. For a model that takes 3d (time,features,channels) inputs like a CNN, then the delta coefficients are usually its own plane in the channels dimensions. This ensures that the delta MFCC coefficient is in the same time x feature position as the corresponding MFCC coefficient, which is easiest for the convolutional kernel to exploit.
{ "domain": "datascience.stackexchange", "id": 9852, "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": "cnn, audio-recognition", "url": null }
vb.net, .net-datatable Get the list of all dates in the given time period) Left-Outer-Join this list with the list of given dates Add the missing dates to the original DataTable Dim missingDates = From a in Enumerable.Range(0, Int32.Maxvalue) Let c = startMonth.AddMonths(a) Take While c <= endMonth 'create list of all dates' Group Join d in dtData On c Equals d("MonthDate") Into g = Group Where Not g.Any() 'take only the missing ones' Select c For Each d in missingDates 'and add them to the DataTable' dtData.Rows.Add(d, Nothing) Next Using Union is also fine IMHO, but then the GetHashCode method of your comparer should return the hash code of the value you actually want to compare: Public Function GetHashCode(obj As DataRow) As Integer _ Implements IEqualityComparer(Of DataRow).GetHashCode Return obj("MonthDate").GetHashCode End Function
{ "domain": "codereview.stackexchange", "id": 4192, "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": "vb.net, .net-datatable", "url": null }
sql, vba, vb6, adodb Private Function CalculateNumericScale(ByVal Value As Variant) As Byte CalculateNumericScale = CByte(Len(Split(CStr(Value), ".")(1))) End Function ADO Connection Error's Collection: I opted to pass the Connection.Errors collection alone, instead of the entire Connection Object to each of the sub procedures ValidateConnection and PopulateADOErrorObject: Private Sub ValidateConnection(ByVal ConnectionErrors As ADODB.Errors) If ConnectionErrors.Count > 0 Then If Not this.HasADOError Then PopulateADOErrorObject ConnectionErrors Dim ADOError As ADODB.Error Set ADOError = GetError(ConnectionErrors, ConnectionErrors.Count - 1) 'Note: 0 based collection Err.Raise ADOError.Number, ADOError.Source, ADOError.Description, ADOError.HelpFile, ADOError.HelpContext End If End Sub
{ "domain": "codereview.stackexchange", "id": 35998, "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": "sql, vba, vb6, adodb", "url": null }
ros, opencv, ros-kinetic, camera, camera-info I have worked with wide and fish-eye lenses quite a bit in ROS, I use the OpenCV fish-eye functions directly. Hope this helps.
{ "domain": "robotics.stackexchange", "id": 30713, "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, opencv, ros-kinetic, camera, camera-info", "url": null }
Remark $\$ The point of presenting it like this is to emphasize how exploiting the innate linear structure serves to simplify the calculations (from nonlinear to linear). In less trivial problems this can yield much greater simplifications (e.g. in operator calculus with $q$-difference operators).
{ "domain": "stackexchange.com", "id": null, "lm_label": "1. YES\n2. YES", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.9793540722737478, "lm_q1q2_score": 0.8437509573074417, "lm_q2_score": 0.8615382129861583, "openwebmath_perplexity": 599.7775307576528, "openwebmath_score": 0.8559978604316711, "tags": null, "url": "http://math.stackexchange.com/questions/180781/find-fx-from-f3x-1" }
gravity, gravitational-waves $G$ = 6.67430E-11 $\frac{\mathrm{N \cdot m}^2}{\mathrm{kg}^2}$ Gravitational Constant $m_{\mathrm{you}}$ = 80 kg Approx mass of observer $m_{\mathrm{Earth}}$ = 5.972E+24 kg Approx mass of Earth $m_{\mathrm{Sun}}$ = 1.989E+30 kg Approx mass of the Sun $r_{\mathrm{Sun}}$ = 149.6E+6 km Approx distance to the centre of the Sun $r_{\mathrm{Earth}}$ = 6371 km Approx distance to the centre of Earth $F_1 = \frac{G \cdot ( m_{\mathrm{you}} \cdot m_{\mathrm{Earth}} ) }{r_{\mathrm Earth}^2}$ = 785.598 N Force between you and Earth $F_2 = \frac{G \cdot ( m_{\mathrm{you}} \cdot m_{\mathrm{Sun}} ) }{r_{\mathrm{Sun}}^2}$ = 0.475 N Force between you and the Sun $ \frac{F_1}{F_2} $ = 1655.515 Factor difference between forces You'll notice that the force between you and the Sun is the equivalent of the force exerted by 50 grams of mass on Earth - so not much.
{ "domain": "astronomy.stackexchange", "id": 7123, "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": "gravity, gravitational-waves", "url": null }
interval approaches its desired size. It is natural then to wonder what happens to this definition if. Improper Integrals - Infinity at Upper and Lower Bounds. (iv) Convergence at Interior points. The Euler Integral of the second kind is also known as gamma function. An improper integral is a definite integral which cannot be evaluated using the Fundamental Theorem of Integral Calculus (FTIC). you get: 4*ln(4) - 4 -alna + a. In reality it is shorthand for a limit. An improper integral is a special kind of definite integral, There are basically two ways in which the integral can be improper. (2) The integrand may fail to be de ned, or fail to be continuous, at a point in the. e x dx 1 for example Situation 2) We are integrating a function f(x) over the interval [a, b], but f(x) has a vertical asymptote in that interval. Integral definition, of, relating to, or belonging as a part of the whole; constituent or component: integral parts. In this course, Calculus Instructor Patrick gives 60
{ "domain": "kangalmalakli.it", "id": null, "lm_label": "1. YES\n2. YES\n\n", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.9904406026280905, "lm_q1q2_score": 0.8097589590957879, "lm_q2_score": 0.817574478416099, "openwebmath_perplexity": 604.3811915113284, "openwebmath_score": 0.9631556272506714, "tags": null, "url": "http://kangalmalakli.it/fjie/improper-integral.html" }
quantum-field-theory, operators, renormalization When we integrate out modes with wavenumbers between $\Lambda_H$ and $\Lambda_L$, we're agreeing to consider only correlation functions of operators that have been smeared enough to avoid resolving anything above the scale $\Lambda_L$. The key point is that smearing does not commute with squaring, so inserting $\phi^2(x)$ in a correlation function and then smearing it is not the same as inserting $\phi_L^2(x)$ in a correlation function: $$ \big(\phi^2(x)\big)_L\neq \phi_L^2(x). \tag{3a} $$ More explicitly, $$ \int dx'\ f(x')\phi^2(x+x')\neq \left(\int dx'\ f(x')\phi(x+x')\right)^2 \tag{3b} $$ where the integral with kernel $f$ is designed to eliminate the high-wavenumber modes. The generating function for correlation functions of sufficiently-smeared operators is obtained from (2) by setting $J_H=0$ and $K_H=0$, which prevents us from inserting any high-resolution operators. This leaves $$ Z[J_L,K_L]\propto \int [d\phi]\ \exp\left(-S[\phi] +\int \phi(x) J_L(x)
{ "domain": "physics.stackexchange", "id": 72043, "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, operators, renormalization", "url": null }
python, beginner, caesar-cipher Iterating using for char in code is good. Many Python beginners try to do something complicated, like i = 0; while i < len(code): char = code[i]. Even better would have been to use a list comprehension, so as to avoid creating another immutable string every time you append a character to the result. Here is one possible way to write it: def caesar(ciphertext, shift): def decipher(alpha_start, alpha_size, c, shift): if alpha_start <= ord(c) < alpha_start + alpha_size: return chr((ord(c) - alpha_start + shift) % alpha_size + alpha_start) return ''.join([decipher(ord('A'), 26, c, shift) or decipher(ord('a'), 26, c, shift) or c for c in ciphertext])
{ "domain": "codereview.stackexchange", "id": 10397, "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, caesar-cipher", "url": null }
mass, quantum-chromodynamics, higgs, protons, binding-energy This is sometimes described as "two 'valence' up quarks and one 'valence' down quark, surrounded by a huge 'sea' of quark-antiquark pairs". In my opinion, this description is also misleading, because it implies that there are three specific "valence" quarks that are "real", while the other "sea" quarks are just "virtual" and physically distinct from the valence quarks. In fact, every individual quark is physically on the exact same footing. In particular, I believe that all of the quarks gain a mass contribution from the Higgs mechanism. As Prof. Strassler explains in the link above, the proton mass is best throught of as arising from the sum of three contributing terms:
{ "domain": "physics.stackexchange", "id": 57501, "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": "mass, quantum-chromodynamics, higgs, protons, binding-energy", "url": null }
context-free, formal-grammars, parsers, ambiguity The traditional "match closest" dangling-else resolution matches each close with the most recent as-yet-unmatched open. That means that there is never an unmatched open (or close, for that matter) between a matched open and its matching close. One possible alternative would be to match each close with the earliest feasible unmatched open. "Feasible" here means that the open could be matched without violating parenthetic nesting (eg. the first $($ in $()()$ cannot feasibly match the last $)$). This matching has to be done outside-in, so that a match for a close is not attempted until all the enclosing pairs have been matched. This fact makes it impossible to produce a parse with a bounded-lookahead algorithm, since the parse has to work inwards from both ends, after having split the string into completely matched segments (because those effectively limit the range of potential matches).
{ "domain": "cs.stackexchange", "id": 8099, "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": "context-free, formal-grammars, parsers, ambiguity", "url": null }
c++, sorting Title: Sorting an array in C++ using Bubble sort Here is my bubble sort algorithm that I would like to improve in any way possible #include<iostream> int main(){ int arr[6] = {5,2,3,7,2,6}; int f = 0; int b = 0; for(int i = 1;i < 6;i++){ if(arr[i] < arr[i-1]){ f = arr[i]; b = arr[i-1]; arr[i] = b; arr[i-1] = f; i=1; } } for(int i = 0;i < 6;i++) std::cout << arr[i] << " "; } Anything is appreciated Some notes: I would avoid running a loop while changing i inside, it is very unclear to the reader. I prefer using two nested loops. The swap can be done in one step less I would initialize a size variable and use it throughout the code instead of hard-coding 6. Printing the array to the console should be in a separate function (as well as the sorting function really). #include<iostream>
{ "domain": "codereview.stackexchange", "id": 39274, "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++, sorting", "url": null }
the distances between our observations ( euclidean distance in r... Contains the measured distance from a certain object is needed recommend using Study... Want to calculate the distance will be overlap so the distance to the nearest 1 presence! A site that makes learning statistics easy by explaining topics in simple and straightforward ways compute the Euclidean distance a. Items to themselves recommend using Chegg Study to get the Euclidean distance between two points, as we will.... Among all pairings between multiple points utilising the distances the similarity of items to themselves will the! The aspace package Pythagorean theorem, and is occasionally called the Pythagorean distance series using the dist function of proxy! Site that makes learning statistics easy by explaining topics in simple and straightforward ways than 2 space. We don ’ t compute the score for each pair of nodes once divided 1000! Can therefore compute the score for each pair of numeric vectors function of
{ "domain": "saecof.com", "id": null, "lm_label": "1. YES\n2. YES", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.9433475715065793, "lm_q1q2_score": 0.8481839600872672, "lm_q2_score": 0.8991213691605412, "openwebmath_perplexity": 869.39782788379, "openwebmath_score": 0.7398490309715271, "tags": null, "url": "http://www.saecof.com/szx3a7w/b9a6b6-euclidean-distance-in-r" }
# Angular speed of two points on a circle. 709 views A disk is rotating CCW with an angular speed omega. Two stickers A and B are fixed to different locations on the disk as shown. Compare the angular speed of the two stickers A and B.
{ "domain": "leiacademy.org", "id": null, "lm_label": "1. YES\n2. YES", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.9893474885320983, "lm_q1q2_score": 0.8389347740078658, "lm_q2_score": 0.8479677602988602, "openwebmath_perplexity": 233.29564067503725, "openwebmath_score": 0.837550163269043, "tags": null, "url": "http://tutor.leiacademy.org/qa/index.php/102/angular-speed-of-two-points-on-a-circle" }
c++, exception-handling Use std::cerr instead of std::cout for errors. return 1 (or any value different from 0) if your program fails. In runAlgorithm() Generally you should only catch exceptions you want to handle. And printing a message is not really handling an exception, that is more like cheap debugging. You are catching the MyOtherException exception and ignoring it. Why? Is it irrelevant to the algorithm? If so, why print a message? If not, why continue the algorithm? You might want to move the catch block out of the loop if it is fatal, or possibly remove it at all if you can't deal with it. As a rule of thumb: Only catch an exception if
{ "domain": "codereview.stackexchange", "id": 7634, "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++, exception-handling", "url": null }
c, strings, array, parsing, matrix i = 0; while(*(parse + i) != '\0') { if(*(parse + i) == value) return 0; i++; } return 1; } /*string must be null terminated. the string that needs to be split*/ /*parse must be null terminated. contains value that the string will be split at*/ /*matrix contains all the string that was split based on parse. the function return how how many string there are*/ size_t parse_string(const char *string, const char *parse, char *** const user_matrix) { /*how many spots there are*/ size_t temp_matrix_size; /*how many acctually string there are*/ size_t temp_matrix_length; char **temp_matrix; size_t i; size_t counter; /*allocate initial memory. array of pointers*/ temp_matrix = malloc(sizeof(*temp_matrix) * DEFAULT_SIZE); if(temp_matrix == NULL) goto FAIL0; temp_matrix_size = DEFAULT_SIZE; /*since right now there 0 string aka pointers to strings*/ temp_matrix_length = 0;
{ "domain": "codereview.stackexchange", "id": 41083, "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, strings, array, parsing, matrix", "url": null }
php, comparative-review, validation return true; } } Or for another: <?php namespace validation\rules; class minValue extends base{ public function check($field, $userInput, $config){ // don't check the value if we don't have a value (that is the job of `required`) // however, don't be fooled by PHP's loose comparison: 0 should return an error // if the minValue is 1. $incoming = $userInput[$field] ?? ''; if (!$incoming && $incoming !== '0' && $incoming !== 0){ return true; } if ($incoming < $config){ return "$field should be at least $config"; } return true; } }
{ "domain": "codereview.stackexchange", "id": 28550, "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, comparative-review, validation", "url": null }
logic, first-order-logic Whenever you create a new rule $l\to r$, you must consider all critical pairs between it and the existing rules $l_1\to r_1,\dots,l_n\to r_n$, checking for unifiability of $l$ with each non-variable subterm of $l_i$ and vice versa. Also remember to check for self-overlaps, i.e. unifiability of $l$ with its own subterms, as we did above for associativity. You only stop when all critical pairs of the existing rules have been examined and either produced new rules, or been discarded.
{ "domain": "cs.stackexchange", "id": 5216, "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": "logic, first-order-logic", "url": null }
ros, libroscpp, turtlesim Title: Problem of running "rosrun turtlesim turtlesim_node" Hey guys, I am new to ros and try to learn it by going through the beginner tutorial. However, when I tried typing the code "rosrun turtlesim turtlesim_node" provided in "Understandingnodes" part of the tutorial, the turtlesim window just flicked and then disappeared. I got the error message: [ INFO] [1390367521.100598911]: Starting turtlesim with node name /turtlesim [ INFO] [1390367521.107999703]: Spawning turtle [turtle1] at x=[5.544445], y=[5.544445], theta=[0.000000] /opt/ros/hydro/lib/turtlesim/turtlesim_node: symbol lookup *****error: /opt/ros/hydro/lib/libroscpp.so: undefined symbol: _ZN3ros6HeaderC1Ev***** I simply cannot do anything with the turtle since I can't see the window at all. Do you guys have any idea or suggestion? Thanks.
{ "domain": "robotics.stackexchange", "id": 16717, "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, libroscpp, turtlesim", "url": null }
javascript, snake-game, webgl if(item[0] === head[0] && item[2] === head[2]) { selfCollision = true; }; }; }); const collision = selfCollision || wallCollision; return collision; } }
{ "domain": "codereview.stackexchange", "id": 30557, "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": "javascript, snake-game, webgl", "url": null }
c++, strings, c++11, immutability bool operator < (const String & other) const{ return cmp(other) < 0; } bool operator <= (const String & other) const{ return cmp(other) <= 0; } private: static char *__dup(const char *s){ auto size = strlen(s); char *copy = new char[size]; memcpy(copy, s, size); return copy; } private: std::unique_ptr<char[]> _data; }; void p(String &s){ printf("%s\n", s ? (const char *) s : "[null]"); } int main(){ String s1; p(s1); String s2 = { "hello" }; p(s2); String s3a = s2; p(s3a); String s3 = std::move(s3a); p(s3); s1 = s3; p(s1); s1 = "hi"; p(s1); String a = "aaaa"; String b = "bbbb"; String c = "aaaa";
{ "domain": "codereview.stackexchange", "id": 14836, "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++, strings, c++11, immutability", "url": null }
javascript, jquery, knockout.js There is what you call "function and variable declaration hoisting" in JavaScript where function and variable declarations are pulled up in the scope which results in the order discussed previously. However, function expressions are assigment operations and are not hoisted. They exist where they are assigned. So unlike a function declaration which can be used before they are declared (since the compiler pulls it up), function expressions cannot be used before it was assigned. A misplaced function expression could lead to errors, while a misplaced function declaration is bad practice (IMO). Stick to the order, it's better. When selectors are often reused, it's best you store the selector string into a variable for easy modification. What if you changed the id of the element, you wouldn't want to edit tens of selectors (Although you could do a Replace All, but with considerable amount of risk). So from your viewModel, you can do: var viewModel = function (drafts) {
{ "domain": "codereview.stackexchange", "id": 3826, "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": "javascript, jquery, knockout.js", "url": null }
dna Finally, getting back to your original question of how long it takes from DNA alteration to expression of the gene product, the answer is that it depends on the gene and the context. In the case of our hypothetical situation earlier, as soon as the NVR gene's DNA is edited, the new sequence begins to be transcribed and translated into protein. There is still some wild-type protein left over initially, so it depends on the transcription rate of the gene and the turnover of the existing protein. Some proteins have an extremely long half-life, on the order of years or decades (or more!), while some degrade within minutes to hours of being synthesized.
{ "domain": "biology.stackexchange", "id": 5738, "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": "dna", "url": null }
assembly mov rdi, dword num_format ; load rdi with address to format string xor rax, rax ; zero out return value register call scanf ; call C function ; scanf reads the input as an integer
{ "domain": "codereview.stackexchange", "id": 28461, "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": "assembly", "url": null }
php, mysql, security foreach($_POST['gegevens'] as $key => $value){ if(!in_array($key,$notneeded)){ if($key == "prijs_inkoop" || $key == 'prijs_verkoop'){ $value = str_replace(',','.',$value); $fields .= "`".$conn->real_escape_string($key)."`,"; $values .= "'".$conn->real_escape_string($value)."',"; }else{ if(in_array($key,$nulledout)){ if($value != ""){ $value = str_replace(',','.',$value); if(!is_numeric($value)){ $isValid = false; $fouteVelden[] = $key; $message = "Er zijn alleen getallen mogelijk bij ".$key."."; }else{ $fields .= "`".$conn->real_escape_string($key)."`,";
{ "domain": "codereview.stackexchange", "id": 9585, "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, mysql, security", "url": null }
javascript, jquery, performance, plugin // Recall this function with the new display quantity setting setWidths(); // Prevent subsquent rendering of the CSS before the sizes have been recalculated return; } // Slide width is smaller than max width // Calculate if a slide could be removed, without making all slides greater than max width // AND that we don't display any less than one } else if( Math.floor(slideWpx * (slider.settings.displayQty) / (slider.settings.displayQty - 1) <= slider.settings.maxWidth) && (slider.settings.displayQty > 1) ) { --slider.settings.displayQty; // Recall this function with the new display quantity setting setWidths();
{ "domain": "codereview.stackexchange", "id": 10054, "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": "javascript, jquery, performance, plugin", "url": null }
navigation, odometry ##INFLATION LAYER## inflation_layer: enabled: true cost_scaling_factor: 100.0 inflation_radius: 0.15 #transform_tolerance : 0.2 ##STATIC LAYER## static_layer: enabled: true ##BASE RANGE SENSOR LAYER## base_range_layer: clear_threshold: 0.46 mark_threshold: 0.98 clear_on_max_reading: true topics: ["/friday/sensors/ir_f", "/friday/sensors/ir_f_l_1", "/friday/sensors/ir_f_l_2", "/friday/sensors/ir_f_l_3", "/friday/sensors/ir_f_r_1", "/friday/sensors/ir_f_r_2", "/friday/sensors/ir_f_r_3"] ##BODY RANGE SENSOR LAYER 1## body1_range_layer: clear_threshold: 0.46 mark_threshold: 0.98 topics: ["/friday/sensors/ir_f_level1"] ##BODY RANGE SENSOR LAYER 2## body2_range_layer: clear_threshold: 0.46 mark_threshold: 0.98 topics: ["/friday/sensors/ir_f_level2"] ##IR SR 1 RANGE SENSOR LAYER## irsr1_range_layer: clear_threshold: 0.46 mark_threshold: 0.98 topics: ["/friday/sensors/ir_sr_level1_l", "/friday/sensors/ir_sr_level1_l"]
{ "domain": "robotics.stackexchange", "id": 28142, "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, odometry", "url": null }
fft, audio Title: Combining channels into single FFT left/right vs mid/side I am creating a spectrum analyser to visualize some stereo audio data in real time. I want to display a single spectrum for the input and a single spectrum for the output. The stereo data is the usual two channels: left (L) and right (R). I am combining them into a single channel by taking the FFT of L + R. Is this conventional or would it be more appropriate to combine FFT(L) + FFT(R) rather than use FFT(L + R). Also if I encode the left and right channels as mid (M) and side (S) do some processing on each of M and S and convert back to L and R then I observe the following:
{ "domain": "dsp.stackexchange", "id": 3717, "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": "fft, audio", "url": null }
java, socket, server, client .put(extraData).array(); str.write(buffer); str.flush(); } catch (IOException e) { close(); throw e; } }
{ "domain": "codereview.stackexchange", "id": 6497, "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, socket, server, client", "url": null }
waves, frequency, mathematics, wavelength, dispersion $$ \omega = D(|\boldsymbol{k}|) $$ For simple waves we have that $D(|\boldsymbol{k}|)$ is linear with $D(|\boldsymbol{k}|) = v|\boldsymbol{k}|$. $v$ can be interpreted as the velocity of the wave. For more complex media or wave equations the dispersion function $D(|\boldsymbol{k}|)$ may be non-linear, in which case we say the medium exhibits dispersion. However, in any case, we see that $D(|\boldsymbol{k}|)$ is a single valued function of $|\boldsymbol{k}|$. If I'm being imaginative I could imagine a medium that allows multiple values of $\omega$ for a single value of $|\boldsymbol{k}|$. In fact, I think such media are possible. Examples that come to mind are
{ "domain": "physics.stackexchange", "id": 83291, "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": "waves, frequency, mathematics, wavelength, dispersion", "url": null }
the-moon, venus, planetary-transits Title: Venus transiting behind the Earth’s moon December 7, 2015 Observing from Earth what are the odds that Venus does not line up in conjunction with Earth’s moon and does not transit behind the moon but slightly below or above with a complete visual of Venus during the entire conjunction of the two? What are the chances of a miscalculation in this event? Well, depending on where you live, the probability is either 0 or 1, modulo cloudy weather. From the picture below (from this site), you see that you'll need to be in the US to see the occultation. However, only in the regions outlined in cyan (West Alaska, East Siberia, East Canada, and in Caribbean islands east of the Dominican Republic) will it be during darkness (just before sunrise / after sunset). But with binoculars (or without, if you have very sharp eyes), you should be able to see it over all of the US.
{ "domain": "astronomy.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": "the-moon, venus, planetary-transits", "url": null }
lagrangian-formalism, differential-geometry, field-theory, variational-principle, boundary-conditions The requirement for spatial infinity arises because $\int_\mathcal{M} \mathrm{d}\omega \neq \omega$, but $\int_\mathcal{M} \mathrm{d}\omega = \int_{\partial\mathcal{M}}\omega $ (Stokes' theorem). For the latter term to vanish, it suffices that $\omega$ vanishes on $\partial\mathcal{M}$. Since the integrals are over $\mathbb{R}^4$, the boundary of our space is "infinity". (Since one would compute such integrals e.g. by taking them over a 4-ball of radius $r$ and sending that to $\infty$.)
{ "domain": "physics.stackexchange", "id": 17619, "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": "lagrangian-formalism, differential-geometry, field-theory, variational-principle, boundary-conditions", "url": null }
beginner, parsing, lua, lua-table -- mark one task as done elseif command =='done' then local name = ask('name: ') local found = false for _,v in pairs(tasks) do if v.name == name then v.done = true found = true end end if not found then print('cannot find task `' .. name .. '`') end -- save everything to disk local savepath = (os.getenv('HOME') .. '/.luacal') or 'luacal' local savefile = io.open(savepath, 'w') save_tasks(savefile, tasks) savefile:close() -- print all active tasks elseif command == 'print' then print_tasks(tasks, false) -- also print completed tasks elseif command == 'printall' then print_tasks(tasks, true) -- quite on demand or <eof> elseif command == 'exit' or not command then print('bye!') running = false
{ "domain": "codereview.stackexchange", "id": 29942, "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, parsing, lua, lua-table", "url": null }
programming-challenge, racket Even in the absence of change, the code will be more readable. And by extension a reviewer will spend less time trying to map the problem statement into the code. In Racket, unlike many other languages, the idiom is to err on the side of verbosity and explanation. The guiding document is How to Design Programs (first edition, second edition) often referred to as HtDP. The methodology includes lots and lots of comments...even for someone who thinks the Easter Bunny and self-documenting code share some common features. Code golf the method is not. Data Structures HtDP methodology starts with data structures. The data structures should reflect the problem domain / business logic. Conversely as a general rule, working with values is a often code smell in Racket. There are a few corner cases where it is necessary and perhaps a few existing code bases where doing so maintains consistency. Otherwise it is likely that data structures will produce more modular and easier to read code.
{ "domain": "codereview.stackexchange", "id": 23290, "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": "programming-challenge, racket", "url": null }
newtonian-mechanics, projectile, drag, coriolis-effect Do I just combine them to get the equations of motion? Thanks for help I don't think your equations are consistent with your coordinate system. Let the projectile be launched only in the x-z plane. Then $\vec{\Omega} = (-\Omega \cos(\phi), 0, \Omega \sin(\phi))$ in your coordinate system ($\phi$ is the angle from equator, x points south, y east, z outward), so $\dot{\vec{r}} \times \vec{\Omega} = (\dot{y} \Omega \sin(\phi), -\dot{z} \Omega \cos(\phi) - \dot{x} \Omega \sin(\phi), -\dot{y} \Omega \cos(\phi))$. Hence, your coriolis equations should be $$\ddot{x} = 2 \Omega v_y \sin(\phi)$$ $$\ddot{y} = -2\Omega(v_z \cos(\phi) + v_x \sin(\phi))$$ $$\ddot{z} = 2 \Omega v_y \cos(\phi)$$
{ "domain": "physics.stackexchange", "id": 89581, "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, projectile, drag, coriolis-effect", "url": null }
homework-and-exercises, newtonian-mechanics, kinematics $$ \vec{r}_i = r_i \left( \cos\theta_i {\hat i} + \sin\theta_i {\hat j} \right) $$ Now, before we proceed, we will use symmetry. Note that, no matter how the particles travel they will always form an equilateral triangle. Mathematically this implies the following equations $$ r_1(t) = r_2(t) = r_3(t) = r(t) $$ $$ \theta_1(t) - \theta_2(t) = \theta_2(t) - \theta_3(t) = \frac{2\pi}{3} $$ $$ \implies \theta_1(t) = \theta(t) + \frac{2\pi}{3} ,~\theta_2(t) = \theta(t),~\theta_3(t) = \theta(t) - \frac{2\pi}{3} $$ Thus, the original 6 variables have been reduced to two variables $r(t)$ and $\theta(t)$. Let us now write down the equations of motion. These are $$ \frac{d}{dt}\vec{r}_2(t) = \frac{v \left( \vec{r}_1 - \vec{r}_2\right) }{|\vec{r}_1 - \vec{r}_2|} $$ and similarly for $ \vec{r}_1(t) $ and $ \vec{r}_3(t) $, but given symmetry, these equations can be derived from the equation above. Let us now explicitly write out the equation above. $$
{ "domain": "physics.stackexchange", "id": 8300, "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, newtonian-mechanics, kinematics", "url": null }
machine-learning, quantum-enhanced-machine-learning Pre-training quantum models If your goal is to improve performance then it makes perfect sense to pre-train a model on a (noisy) simulator and then load those parameters as initial parameters for further training on the noisy device. This is (loosely) a very specialized form of transfer learning, and may be especially useful considering that device noise can result in untrainability of variational quantum circuits (Wang, 2021). It seems reasonable that this would improve your training convergence time (on hardware) compared to random parameter initialization unless the noise is very strong. If you have an effective training technique for the simulated model then this will (presumably) result in a better optimized model as well. Of course, this is not a practical/realistic strategy for finding useful QML algorithms: If you can pre-train your QML model on a simulator then by definition it cannot demonstrate any kind of advantage over classical algorithms.
{ "domain": "quantumcomputing.stackexchange", "id": 4139, "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, quantum-enhanced-machine-learning", "url": null }
c#, playing-cards if (!TakeBet()) { EndRound(RoundResult.INVALID_BET); return; } Console.Clear(); InitializeHands(); TakeActions(); Dealer.RevealCard(); Console.Clear(); player.WriteHand(); Dealer.WriteHand(); player.HandsCompleted++; if (player.Hand.Count == 0) { EndRound(RoundResult.SURRENDER); return; } else if (player.GetHandValue() > 21) { EndRound(RoundResult.PLAYER_BUST); return; } while (Dealer.GetHandValue() <= 16) { Thread.Sleep(1000); Dealer.RevealedCards.Add(deck.DrawCard()); Console.Clear(); player.WriteHand(); Dealer.WriteHand(); }
{ "domain": "codereview.stackexchange", "id": 43543, "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#, playing-cards", "url": null }
time-series, machine-learning-model Title: Predicting student exam outcome based upon study patterns I have a few years of data now for HE students participation in their course(es) including exam results. If I just compare formative exam results with summative results there is good correlation, and linear regression models deal well with that. For each new academic year however I would like to predict future results based upon study patterns. Data would be in the format Actual date | academic year | academic month | academic week | activity id | activity name | activity type | time spent | student identifier This results in 1000s of rows per individual student. According to https://machinelearningmastery.com/convert-time-series-supervised-learning-problem-python/ I can convert time series into a date pair (date yesterday | current date) but assuming each student has hundreds of activities this would result in a vast number of categorical columns comparing each activity.
{ "domain": "datascience.stackexchange", "id": 11450, "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": "time-series, machine-learning-model", "url": null }
bandwidth $$|X(f)|=\frac{1}{\sqrt{1+(f/B)^2}}$$ Then the energy spectral density is $$|X(f)|^2=\frac{1}{1+(f/B)^2}\tag{1}$$ The 3 dB bandwidth is simply the frequency for which (1) becomes $0.5$, which is $W_{3dB}=B$. The bandwidth according to the 90% energy/power definition is $$\int_{-W}^W|X(f)|^2df=0.9\cdot\int_{-\infty}^{\infty}|X(f)|^2df\tag{2}$$ Equation (2) is the reason why I assume the definition as given in (1), because otherwise the integral on the right-hand side of (2) does not converge, so the 90% energy/power definition would not make sense. With the definition (1) the integrals in (2) are easily solved using the $\arctan$ function, from which $W=const\cdot B$ follows, where $const=6.31$ (if I'm not mistaken), but I'm sure you can do the calculation yourself.
{ "domain": "dsp.stackexchange", "id": 2195, "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": "bandwidth", "url": null }
objective-c // Add new device to array NSLog(@"Monitoring new device: %@", [device nameOrAddress]); [btMonitoredDevices addObject:device]; // Return that we haven't seen it. return(TRUE); } You should definitely be releasing both btMonitoredDevices and btPairedDevices in the dealloc. But it appears that this is your appDelegate so it matters little outside of correctness. I'd do it anyhow. You shouldn't need the retain on btMonitoredDevices since you're calling alloc on it. So you already have a retain count of one on it. By calling retain on it you actually have a retain count of two. So to sum up make sure you're releasing both in your dealloc and get rid of the [btMonitedDecices retain]; and you should be good.
{ "domain": "codereview.stackexchange", "id": 1167, "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": "objective-c", "url": null }
energy, visible-light, photons, atomic-physics, absorption In the first example the electrons moving with current gives energy to the electron in the atom. So the electron in the atom absorbs the moving electron? If so how is this possible because they are both negative? There is no question of an electron absorbing another electron. Instead, by means of photon emission, momentum can be transferred between electrons, bearing in mind the conservation laws regarding energy and momentum. An example of this is a Feynman Diagram: Where the wavy line represents energy and momentum being transferred by means of a photon.
{ "domain": "physics.stackexchange", "id": 38125, "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": "energy, visible-light, photons, atomic-physics, absorption", "url": null }
Using eigenvalues: Let $x$ be an eigenvector of $A$ associated with $\lambda$. Note that $$0 = 0x = (A^2 - 2A + 4I)x = (\lambda^2 - 2\lambda + 4)x$$ so, each $\lambda$ must be a root of $x^2 - 2x + 4$, which is to say that each eigenvalue is either $1 + \sqrt{3}i$ or $1 - \sqrt{3} i$. Since $A$ is real, its eigenvalues come in conjugate pairs. So, $n$ must be even, and the eigenvalues $1+\sqrt{3}i$ and $1 - \sqrt{3}i$ must have the equal multiplicities $n/2$. The determinant of $A$ is the product of its eigenvalues, so $$\det(A) = [(1 + \sqrt{3}i)(1 - \sqrt{3} i)]^{n/2} = 4^{n/2} = 2^n$$
{ "domain": "stackexchange.com", "id": null, "lm_label": "1. YES\n2. YES", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.9748211575679041, "lm_q1q2_score": 0.814447020781676, "lm_q2_score": 0.8354835289107307, "openwebmath_perplexity": 164.8042732749155, "openwebmath_score": 0.944470226764679, "tags": null, "url": "https://math.stackexchange.com/questions/2174876/find-the-determinant-and-possible-sizes-of-a-matrix-a-which-satisfies-the-equ" }
machine-learning, deep-learning, classification, feature-selection, categorical-data b) I understand we can create one-hot encoding variables for region variables because it has only 4 values like APAC, EMEA, GC, EUROPE, etc. c) My total number of rows in the dataset is 300K. But as you see most the categorical variable has 100 unique values. How should I decide whether it has one hot encoded or not? d) Is there any other better or alternative method to do this? Let's answer you questions one by one.
{ "domain": "datascience.stackexchange", "id": 10399, "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, deep-learning, classification, feature-selection, categorical-data", "url": null }
# Identify the symmetries and sketch the curve $r=\sin (\theta/2)$ I've been at this for a while and I can't think clearly so I'm definitely doing something wrong. The question: Identify the symmetries of the curves in Exercises 1–12. Then sketch the curves. $r = \sin (\frac{\theta}{2})$ In the book it states that first to find symmetry we have to check the following: $$( r ; - \theta )$$ $$( -r ; \pi-\theta )$$ $$( -r ; -\theta )$$ $$( r ; \pi-\theta )$$ $$( -r ; \theta )$$ $$( r ; \pi+\theta )$$ So I checked for the first one and this is what I got: For $-\theta$: $r = \sin (\frac{-\theta}{2})$ $-r = \sin (\frac{\theta}{2})$ Which turns out to satisfy the y-axis. Now here's what I don't understand. I want to check for $\pi-\theta$, So I replace that where $\theta$ would be. $r = \sin (\frac{\pi-\theta}{2})$ $r = \sin (\frac{\pi}{2} - \frac{\theta}{2})$ Following the formula for sin(A-B), then:
{ "domain": "stackexchange.com", "id": null, "lm_label": "1. YES\n2. YES", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.9632305318133554, "lm_q1q2_score": 0.8468210084101963, "lm_q2_score": 0.8791467675095294, "openwebmath_perplexity": 494.80589151785375, "openwebmath_score": 0.7597527503967285, "tags": null, "url": "https://math.stackexchange.com/questions/2767788/identify-the-symmetries-and-sketch-the-curve-r-sin-theta-2" }
inorganic-chemistry, ions Title: What is the molecular formula of the nitrate of a metal Q that forms a carbonate of the form QCO3? A metal $\ce{Q}$ forms a carbonate and a nitrate. The molecular formula of the carbonate of $\ce{Q}$ is $\ce{QCO3}$. What is the molecular formula of the nitrate of $\ce{Q}$? The answer says it is $\ce{Q(NO2)3}$ which I think is incorrect; I think the answer should be $\ce{Q(NO3)2}$. Am I right? The carbonate anion is $\ce{CO3^{2-}}$. This tells us that the metal cation is doubly positively charged: $$ \ce{Q^{2+} + CO3^{2-} -> QCO3} $$ The other two anions mentioned in your question are the nitrite anion $\ce{NO2^-}$ the nitrate anion $\ce{NO3^-}$ Since the question you're concerned with asks for the formula of the nitrate of $\ce{Q}$, the correct answer would be $\ce{Q(NO3)2}$. However, the compound $\ce{Q(NO2)2}$ is, at least from a charge perspective, also correct. But that is the nitrite of $\ce{Q}$.
{ "domain": "chemistry.stackexchange", "id": 2059, "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, ions", "url": null }
deep-learning, convolutional-neural-networks, classification, object-recognition, one-shot-learning print(candidate, min_distance) At least with my 5 test reference images and several query images it worked without a single failed "classification". However, I am not sure if it will stand up to a larger test...
{ "domain": "ai.stackexchange", "id": 2390, "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": "deep-learning, convolutional-neural-networks, classification, object-recognition, one-shot-learning", "url": null }
terminology, type-theory Title: Does modern type theory include specifications and implementations? Good programming practice distinguishes between specification (at the API level) and implementation. I would have thought that this same distinction would be found in type theory. Perhaps I just don't understand what I'm reading, but I don't see it. Apologies if I'm completely off (and corrections appreciated), but it seems that in type theory one adds new computation/rewrite rules, which in effect are at the implementation level, i.e., they compute something. (They may be "declarative," but they are used for computation.) I don't see how one adds anything like a specification. A type $T$ is a specification. A term $t$ of type $T$ is an implementation together with a proof of correctness.
{ "domain": "cs.stackexchange", "id": 3177, "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": "terminology, type-theory", "url": null }
photoelectric-effect In the photoelectric effect, a single photon can interact with a single electron and give it sufficient energy to escape. You can think of this as "heating up" a single electron to a very high apparent temperature - and it escapes before it has shared that energy with other electrons. The effect is definitely real - you will see photo-emission for photons with sufficient energy (short enough wavelength, corresponding to the energy needed for electrons to escape) and it will exist regardless of the intensity of the radiation - in other words, it doesn't require you to heat up the cathode in order to see the emission. Einstein got his Nobel prize for figuring this out.
{ "domain": "physics.stackexchange", "id": 27743, "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": "photoelectric-effect", "url": null }
7. Show that if every element of a group $G$ has its own inverse then $G$ is abelian. Solution: Given, Every element of a group $G$ has it own inverse. i.e., if $a \in G$ then $a^{-1}=a$. Similarly, for $b \in G$, we have $b^{-1}=b$. Now for $a,b \in G$ $\Rightarrow$ $ab \in G$ $\Rightarrow$ $(ab)^{-1}=ab$ $\Rightarrow$ $b^{-1}a^{-1}=ab$ $\Rightarrow$ $ba=ab$ $\Rightarrow$ $G$ is abelian. $\spadesuit$
{ "domain": "gargsain.com", "id": null, "lm_label": "1. YES\n2. YES", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.994530724104456, "lm_q1q2_score": 0.8012259712311727, "lm_q2_score": 0.8056321959813275, "openwebmath_perplexity": 156.71099325492173, "openwebmath_score": 0.9908809065818787, "tags": null, "url": "http://nstejas.gargsain.com/content/semester_3/chapter4.html" }
performance, php, array, json the output, Check that this include 2 Main array :: JsonDataand otherdata: array(2) { ["JsonData"]=> array(10) { ["firstname"]=> string(0) "" ["lastname"]=> string(0) "" ["email"]=> string(0) "" ["countryCode"]=> string(0) "" ["phone"]=> string(0) "" ["i_signup_password"]=> string(0) "" ["i_signup_password_rep"]=> string(0) "" ["i_signin_password"]=> string(0) "" ["form"]=> string(11) "d-sys-login" ["process"]=> string(8) "e-signin" } ["otherdata"]=> string(9) "otherdata" }
{ "domain": "codereview.stackexchange", "id": 39044, "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, php, array, json", "url": null }
gazebo Working on it now, so hopefully by tonight ill implement a cubic hermite spline to be applied to the roads/road interections/road junctions to make the roads alot smoother. However, i think this should be done from within the gazebo source for Road2d.cc. But maybe it might be better to already supply smoother points from a higher level (like gazebo_osm) EDIT: I should also mention that the option of using data from google maps i think is out of the question as it is in their terms of service agreement. Reference here: https://support.google.com/maps/answer/41136
{ "domain": "robotics.stackexchange", "id": 3787, "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": "gazebo", "url": null }
black-holes, hawking-radiation, black-hole-thermodynamics Title: Should each and every black hole decay? Is it necessary that black holes should always decay, say if we have a potential for not letting the Hawking radiation escape? Lets take the case of a Schwarzchild black hole embedded in an asymptotically AdS spacetime. We know that a geodesic in an asymptotically AdS space takes a finite amount of proper time to start from a point, reach the boundary and come back. Now the black hole has a finite lifetime of evaporation due to quantum effects which is proportional to the $M^3$, where $M$ is the mass of the black hole. In case the time for a geodesic to start from the horizon, go to the boundary and come back to the black hole is less than this evaporation lifetime, the Hawking radiation starts getting into equilibrium with the black hole. This is a phase transition with $M$ playing the role of an order parameter, and is commonly known as Hawking-Page transition.
{ "domain": "physics.stackexchange", "id": 49375, "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": "black-holes, hawking-radiation, black-hole-thermodynamics", "url": null }
computational-chemistry ## One Electron Ints ## 1 2 3 4 5 6 7 1 -32.6850823 -7.6043227 0.0000000 0.0000000 -0.0186797 -1.6196036 -1.6196036 2 -7.6043227 -9.3020628 0.0000000 0.0000000 -0.2221598 -3.5432106 -3.5432106 3 0.0000000 0.0000000 -7.4308356 0.0000000 0.0000000 0.0000000 0.0000000 4 0.0000000 0.0000000 0.0000000 -7.5670222 0.0000000 -1.8908561 1.8908561 5 -0.0186797 -0.2221598 0.0000000 0.0000000 -7.5266557 -1.6587893 -1.6587893 6 -1.6196036 -3.5432106 0.0000000 -1.8908561 -1.6587893 -4.9564901 -1.5602636 7 -1.6196036 -3.5432106 0.0000000 1.8908561 -1.6587893 -1.5602636 -4.9564901
{ "domain": "chemistry.stackexchange", "id": 7126, "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": "computational-chemistry", "url": null }
json, bash, linux, file-structure, jq Test set This script was tested with the following disk set: Microsoft C Compiler 4.0. The first 3 .img disks inside the ZIP (disk01.img, disk02.img and disk03.img) should be placed in the same directory the script is. The corresponding JSON recipe used for the test is below. It's named steps.json and placed in the same directory the script is for convenience. [ { "disk": "disk01.img", "files": [ { "src": "*", "dest": "bin" } ] }, { "disk": "disk02.img", "files": [ { "src": "*.EXE", "dest": "bin" } ] }, { "disk": "disk03.img", "files": [ { "src": "LINK.EXE", "dest": "bin" }, { "src": "*.H", "dest": "include" }, { "src": "SYS/*.H",
{ "domain": "codereview.stackexchange", "id": 32991, "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": "json, bash, linux, file-structure, jq", "url": null }
javascript, beginner, json, api } }); $.ajax ({ url: forecast_url, type: 'GET', cache: false, datatype: "jsonp", success: function(data) { localStorage.ForecastCache = JSON.stringify(data); displayData(temp, wind); }, error: function (errorData) { $("#forecast").html("Error retrieving forecast data :: "+ errorData.status); } }); localStorage.timestamp = data_timestamp; }; function displayData(temp_units, wind_units) { try { // If the timestamp is newer than 30 minutes, parse data from cache if ( localStorage.getItem('timestamp') > data_timestamp - 1800){ var data = JSON.parse(localStorage.WeatherCache); var forecast = JSON.parse(localStorage.ForecastCache); document.body.style.background = "url('assets/backgrounds/" +data.weather[0].icon+ ".jpg') no-repeat fixed 50% 50%"; document.body.style.backgroundSize = "cover";
{ "domain": "codereview.stackexchange", "id": 8447, "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": "javascript, beginner, json, api", "url": null }
black-holes, mass, speed-of-light, mass-energy, speed Title: If a black hole is created from light, can this black hole then move at the speed of light? Imagine we managed to squeeze light into a very tiny region of space so that the energy concentration at that point becomes a black hole. Can this black hole then move at the speed of light? No. I assume you're thinking that a black hole made from light would have a zero rest mass and could therefore travel at the speed of light. However the rest mass of any black hole is due not only to the mass that went into it but also the energy (e.g. photons) that went into it. The increase in mass due to the energy is given by Einstein's famous equation $E = mc^2$. So if we create the black hole from purely mass $m$ the rest mass of the black hole is just $m$. If we create the black hole from purely energy $E$, e.g. from photons with a total energy $E$, then the rest mass of the black hole is $E/c^2$.
{ "domain": "physics.stackexchange", "id": 56878, "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": "black-holes, mass, speed-of-light, mass-energy, speed", "url": null }
quantum-mechanics, general-relativity, newtonian-gravity, qft-in-curved-spacetime Since an expansion in $v/c$ or the curvature is possible, one should be able to incorporate even weakly relativistic effects, e.g., the $1/r^3$ correction to the potential that accounts for the anomalous precession of the perihelion of Mercury. This is analogous to the spin-orbit, Thomas precession, and "mass shift" correction terms -- all relativistic of order $v^2/c^2$ that account for the fine structure of the hydrogen atom. Of course one should note that it is possible to do quantum mechanics -- actually, quantum field theory -- in curved spacetime backgrounds. Here background means that one neglects the gravitational field produced by the matter that is modeled quantum mechanically. E.g., in Hawking's famous calculation, the black hole and the rest of spadetime is entirely classical, and the gravitational field produced by the radiation is neglected, and only the radiation is quantum mechanical. For a general formalism see the recent review by Fredenhagen and Rejzner.
{ "domain": "physics.stackexchange", "id": 34363, "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, general-relativity, newtonian-gravity, qft-in-curved-spacetime", "url": null }
perl By passing the function all of the variables it needs (test1), you don't need to rely on global variables. This makes the function easier to test, more predictable (no side effects) and easier to refactor as you can move it to another module or file easily. If it relied on global variables, it would be broken if the variable is moved or its data structures changed. Returning the original reference is not necessary for test3, because the original $ref is changed. Returning is useful if you want to chain function calls. Modifying the arguments passed your function directly can be surprising to the function's caller. If you do this, make it clear in the documentation. If you actually want to make a new copy of the object, modify it and return it, use something like Clone. Of course, this can be slow.
{ "domain": "codereview.stackexchange", "id": 3257, "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": "perl", "url": null }
algorithms, graphs, trees The naive method would be to just maintain a tree and on every update change the type of vertex; to answer queries of second type, run a bfs starting at X and stop as soon as a vertex with type 1 is found. With this simple scheme, Set(X) would run in $O(1)$ time, but Dist(X) would take $O(n)$ time. However, in my application the number of queries and number of nodes are both of the order of $10^5$, so the naive method is too slow. In particular, $O(n)$ time is too slow. Can somebody suggest a better algorithm for doing this? One can improve your naive method by augmenting the data structure. At each node in the tree, store an extra field that contains the distance to the closest descendant of type 1. Assume each node as a pointer to its parent. Let the depth of the tree be $d$.
{ "domain": "cs.stackexchange", "id": 5481, "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": "algorithms, graphs, trees", "url": null }
python, python-3.x, multithreading import numpy as np # Function to optimize def fnc(x): total=0 for i in range(len(x)): total+=x[i]**2 return total if __name__ == '__main__': x_down, x_up = (-100, 100) # All shared datastrucures between particles and particle producer dict_shared_new_position = {i: list(np.random.uniform(x_down, x_up, NUM_DIMENSIONS)) for i in range(0, NUMBER_OF_PARTICLES)} dict_shared_best_position = dict_shared_new_position.copy() dict_velocity = {i: [random.uniform(-1,1)] * NUM_DIMENSIONS for i in range(0, NUMBER_OF_PARTICLES)} dict_shared_errors = {i: -1 for i in range(0, NUMBER_OF_PARTICLES)} dict_shared_is_ready = {i: False for i in range(0, NUMBER_OF_PARTICLES)} bounds = [(x_down, x_up) for i in range(NUMBER_OF_PARTICLES)] condition_wait = threading.Condition()
{ "domain": "codereview.stackexchange", "id": 41526, "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, python-3.x, multithreading", "url": null }
ros, subscribe Title: How to return an array from my subscriber function I am trying to return an array that contains a latitude and a longitude from a subscriber that I wrote. What I am trying to do is have some type of global variable and when infoGetter() is called, go to the callback function, run once, set new values from the /novatel/fix topic to my latitude and longitude variables and return them in an array once we are back in the infoGetter function. The array is sent to another program so I made my subscriber into a function. It is only supposed to run once in my other program and return those values. Is it possible to do what I am trying to do? What am I missing? Here's my subscriber function: #!/usr/bin/env python import rospy from sensor_msgs.msg import NavSatFix #from RetreiveFiles import whatTheHell latitude = 0 longitude = 0 ra = [0,0]
{ "domain": "robotics.stackexchange", "id": 22446, "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, subscribe", "url": null }
#### Victor Ivrii • Elder Member • Posts: 2511 • Karma: 0 ##### Re: Can there exists infinite number of solutions given initial conditions. « Reply #1 on: September 25, 2018, 09:27:59 PM » For condition see Section 2.8 of the textbook or this Lecture Note Yes, this equation $y'=3 y^{2/3}$ (I modified it for simplicity) has a general solution $y=(x-c)^{3}$ but also a special solution $y=0$. Thus problem $y'=3 y^{2/3}$, $y(0)=0$ has an infinite number of solutions. Restricting ourselves by $x>0$ we get solutions y=\left\{\begin{aligned} &0 &&0<x<c,\\ &(x-c)^3 && x\ge c\end{aligned}\right. with any $c\ge 0$ and similarly for $x< 0$. This happens because this Lipschitz condition is violated at each point of the solution $y=0$. #### Kathryn Bucci
{ "domain": "toronto.edu", "id": null, "lm_label": "1. YES\n2. YES", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.9828232884721166, "lm_q1q2_score": 0.8764926693186664, "lm_q2_score": 0.8918110504699677, "openwebmath_perplexity": 1245.826559568301, "openwebmath_score": 0.9579827189445496, "tags": null, "url": "http://forum.math.toronto.edu/index.php?topic=1326.0;prev_next=next" }
newtonian-mechanics, forces, torque Axial force of $f = a + w = 20 \,\mathrm{lb}$ Overturning moment of $m = (a+w)*c/12 = 60 \,\mathrm{lb\,ft}$ Radial force of $q = (a+w)*c*(n^2/35211.268) = 2.045\,\mathrm{lb}$ The magic number of $35211.268$ converts units around between pounds mass, inches, and rpm to give pounds-force. Then you go to the motor specs and try to find information on the motor performance under those conditions. This problem is an engineering problem, and as such you need to contact someone with an engineering background to solve this. To illustrate my point here is free-body-diagram of the situation (with a change in nomenclature)
{ "domain": "physics.stackexchange", "id": 82133, "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, torque", "url": null }
java, xml, swing JLabel labelAuthor = new JLabel("Author: Damien Bell"); labelAuthor.setBounds(620, 600, 150, 50); panel.add(labelAuthor); toggleAnswerButton.setBounds(95, 520, 250, 30); toggleAnswerButton.setText("Show Last Week's Answer"); toggleAnswerButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ae){ toggleContent(area, toggleAnswerButton, strArray); } }); panel.add(toggleAnswerButton); nextButton.setBounds(550, 250, 80, 30); nextButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ae){ Date date1 = getDateTime(); DateFormat dateFormat = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss"); try{ Date date2 = dateFormat.parse(strArray[0]); if (date1.compareTo(date2) < 0 ){
{ "domain": "codereview.stackexchange", "id": 1217, "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, xml, swing", "url": null }
filters, filter-design, finite-impulse-response, digital-filters, least-squares if len(weight) != len(desired): raise ValueError("weight must be the same size as the number of " "band pairs (%s)." % (len(bands),)) if (weight < 0).any(): raise ValueError("weight must be non-negative.")
{ "domain": "dsp.stackexchange", "id": 10798, "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": "filters, filter-design, finite-impulse-response, digital-filters, least-squares", "url": null }
javascript, object-oriented, design-patterns, modules //JQ for adding box shadow to ie8 $(function () { var temp; $('#sg-evm-interLocutor-popUp').addClass('shadow'); //JQ for toggle box button $(".toggle-box").click(function () { $('.toggle-box span').toggleClass('toggle-box-visited'); $('.toggle-box font').toggleClass('toggle-box-visited-font'); }); $(".intb-close").on("click", function () { temp = $('#intbpop').bPopup(); temp.close(); }); }); //JQ for adding box shadow to ie8 END // oops code var sg = { w: $(window).innerWidth(), h: $(window).innerHeight(), paper: new Raphael("paper", "100%", "100%") }; if (sg.w >= 1024) { //view box for responsive sg.paper.setViewBox(0, 0, 1280, 720, false); } else { sg.paper.setViewBox(0, 0, 1280, 720, false); } // module for calling the json for employee popup sg.employeeJsonCall = function () { var employeeJsonCall = this;
{ "domain": "codereview.stackexchange", "id": 14155, "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": "javascript, object-oriented, design-patterns, modules", "url": null }
entomology, pathology, parasitology Title: Why is the species-diversity of deadly parasites greatest in the tropics? There are so many parasites living in tropical regions of Africa, South America, or Asia, but very few in Europe or North America. Is this due to climate, or are there other reasons? Many of the tropical diseases and parasites are transmitted by insects, such as flies and mosquitoes. Well there are flies and mosquitoes in Europe as well. There might be malaria-transmitting mosquitoes in the very south of Europe, and there is encephalitis transmitted by ticks. But that's it. Why don't the hundreds of different parasitic species from Africa spread to Europe ? The diversity of parasites shows a gradient with increasing diversity from the poles to the equator. Several reasons have been brought forth to explain the latitude-dependency of parasite diversity:
{ "domain": "biology.stackexchange", "id": 5168, "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": "entomology, pathology, parasitology", "url": null }
classical-mechanics, conservation-laws Title: Cat falling from a tree When a cat or any body falls over to the ground, how is momentum conserved? I was working on a problem of a cat falling on top of a skateboard, and the system travels together with a new velocity. That seemed intuitive enough for me. This is how I was thinking through: The cat had momentum that became zero after the impact. Should not the skateboard have recoiled in some way, due to the conservation of momentum? After all, the change in momentum for the board should have been something measurable. I guess there is something wrong with the way I am approaching the problem. Could you please help me identify this?
{ "domain": "physics.stackexchange", "id": 53570, "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, conservation-laws", "url": null }
Plotting the graph of: $u^2+v^2=1$, $u^2+v^2=4$, $v=2\sqrt2 u$ and $v=5\sqrt2 u$. I have attached the graph to this post. So, i end up with a pair of concentric circles. Now, using the formula for finding the area of sector of a circle: $$A= \frac{1}{2}r^2 \theta$$ I know that $1\le r \le 2$ for the area of region required in the u-v plane. Since, $\theta$ is the same for both sectors: Area of required region=$$\frac{1}{2}(2)^2 \theta-\frac{1}{2}(1)^2 \theta=\frac{3}{2}\theta$$ But i have no idea how to find $\theta$. #### Attached Files: • ###### uv.png File size: 3.7 KB Views: 105 Last edited: May 4, 2012 8. May 4, 2012 ### LCKurtz Of course you can calculate the Jacobian. But remember, this question was posted by NewtonianAlch, and you should be careful not to provide a full solution. 9. May 4, 2012 ### sharks
{ "domain": "physicsforums.com", "id": null, "lm_label": "1. YES\n2. YES", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.9674102571131692, "lm_q1q2_score": 0.822270828066862, "lm_q2_score": 0.8499711699569787, "openwebmath_perplexity": 574.7949513861821, "openwebmath_score": 0.9101993441581726, "tags": null, "url": "https://www.physicsforums.com/threads/double-integrals-change-of-variables.603195/" }
javascript, jquery, html, css, twitter-bootstrap // Dynamically create equivalency-rate bars from array data // Time Equivalency Rate var EqRates = [ [7, 30, "5.00"], [10, 45, "7.00"], [16, 45, "9.00"], [19, 30, "7.00"], [26, 00, "N/A" ] ]; // 2:00 AM, the NEXT day! createEqRateBars(EqRates); // Set the position of an arrow pointing to the correct time block setArrowPosition(EqRates); setInterval(function() { setArrowPosition(EqRates); }, 1000); // Update it every second $(window).resize(function() { setArrowPosition(EqRates); }); // Update it upon window resize } /* * Create a clock, with special formatting */ function createClock() { // Date format is "Sunday, January 1st, 12:00:00 AM" var today = new Date();
{ "domain": "codereview.stackexchange", "id": 6744, "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": "javascript, jquery, html, css, twitter-bootstrap", "url": null }
c, heap, priority-queue free(p_heap->p_table); p_heap->p_table = p_new_table; p_heap->capacity = new_capacity; return true; } bool heap_t_add(heap_t* p_heap, void* p_element, void* p_priority) { heap_node_t* p_node; if (!p_heap) return false; /* Already in the heap? */ if (unordered_map_t_contains_key(p_heap->p_node_map, p_element)) return false; p_node = heap_node_t_alloc(p_element, p_priority); if (!p_node) return false; if (!ensure_capacity_before_add(p_heap)) return false; p_node->index = p_heap->size; p_heap->p_table[p_heap->size] = p_node; unordered_map_t_put(p_heap->p_node_map, p_element, p_node); sift_up(p_heap, p_heap->size); p_heap->size++; return true; } bool heap_t_decrease_key(heap_t* p_heap, void* p_element, void* p_priority) { heap_node_t* p_node; if (!p_heap) return false; if (!unordered_map_t_contains_key(p_heap->p_node_map, p_element)) return false;
{ "domain": "codereview.stackexchange", "id": 15508, "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, heap, priority-queue", "url": null }
phase-transition, metrology, interferometry Before you make a map of the globe, you need to make local maps under the shuttle orbit. For that, you are trying to measure the terrain height field: $$ h_t(x, y)$$ where $(x, y)$ are some suitable surface coordinates. The receive antennas, each at the end of the baseline ${\bf B}$ measure complex radar amplitudes, $A$, that are a product of a magnitude, $M$, and a phase, $\phi$: $$ A_i(x, y)=M_i(x, y)e^{i\phi_i(x, y)}\ \ {i \in (1, 2)} $$ The measured phase difference: $$\Delta\phi_M(x, y) \equiv \phi_2(x, y)-\phi_1(x, y) $$ can be extracted from: $$ \frac{A_1^*(x, y)A_2(x, y)}{M_1(x, y)M_2(x, y)} = e^{i(\phi_2(x, y)-\phi_1(x, y))}$$ From the diagram, you can show that the target height is: $$h_t(x, y) = h_p - \rho(x, y)\cos{\big[\sin^{-1}{\big(\frac{\lambda\Delta\phi(x, y)}{2\pi B}\big)+\alpha} \big]} $$ where the range, $\rho$ is measured by the radar. The problem arises because the radar does not measure $\Delta\phi(x, y)$ because of phase wrapping. The radar measures:
{ "domain": "physics.stackexchange", "id": 67462, "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": "phase-transition, metrology, interferometry", "url": null }
complexity-theory, graphs, time-complexity, polynomial-time, network-flow The idea is to construct the network by creating two nodes $(i,x,0)$ and $(i,x,1)$ for each gate $(i,x)$ (gate $x$ on the $i$th layer in $C$, one for each possible value 0 and 1). The input layer is layer 0. The source of $N$ is connected to $(0,x,0)$ ($(0,x,1)$) with capacity $4^k$ iff $(0,x)$ is a constant 0 (1) in $C$. Each edge $((i,x),(i+1,y))$ of $C$ is then replaced by a small subnetwork which sends 3/4 of the flow directly to the sink. The remaining quarter is sent to $(i+1,y,0) ((i+1,y,1))$, if $x$ in $C$ values to 0 (1). (At least the max flow needs to take these routes. Hence these small subnetworks simulate the gates.) Now, the output gate $(k,x)$ is copied as well, but only the $(k,x,1)$ copy is connected to the edge. That is: Iff $C$ evaluates to 0, then exactly 1 flow unit cannot be sent to the sink. Hence, the flow in $N$ is $D 4^{k-1}-1$. If $C$ evaluates to 1, then the full $D 4^{k-1}$ flow units can reach the sink. This completes the reduction.
{ "domain": "cs.stackexchange", "id": 3144, "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, graphs, time-complexity, polynomial-time, network-flow", "url": null }
python, performance, sliding-tile-puzzle, a-star class NotFoundError(Exception): pass def puzzle15_solve(start): goal = Position(start.width, start.height) closed_set = set() # Heap items are lists [F-score, G-score, position, parent data] start_data = [start.heuristic_cost(), 0, start, None] # open_set and open_heap always contain the same positions. # open_set maps each position to the corresponding heap item. open_set = {start: start_data} open_heap = [start_data] while open_heap: current_data = heapq.heappop(open_heap) f_current, g_current, current, parent_data = current_data if current == goal: def path(data): while data: yield data[2] data = data[3] return list(path(current_data))[::-1] del open_set[current] closed_set.add(current) for neighbor in current.neighbors(): if neighbor in closed_set: continue
{ "domain": "codereview.stackexchange", "id": 4887, "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, performance, sliding-tile-puzzle, a-star", "url": null }
covalent-compounds, ionic-compounds, polarity Radius of the ions: Source As you see, and could've imagined if you were on the right track, bigger ions (literally) mean weaker attraction. I wanted the answer to be fairly complete, so I did an addition to the main point that answers your question. Thus, there's no need of expanding this. In your case: You might as well have reached a conclusion. Mg ion has a 2+ charge, while Na has only a single electron missing. The anion is pretty much the same, $\ce{HCO3-}$ (hydrogen carbonate), and its priorly covalent nature shouldn't mislead you in doubting your answer. There is a case of comparison of the charge of the ions, and I would say Magnesium ion wins. In case of additional study, you can visit: http://www.chemguide.co.uk/physical/energetics/lattice.html http://www.knockhardy.org.uk/sci_htm_files/08le.pdf http://www.rsc.org/learn-chemistry/resources/gridlocks/downloads/answers/Born%20Haber%20NaCl%20ans.pdf
{ "domain": "chemistry.stackexchange", "id": 2742, "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": "covalent-compounds, ionic-compounds, polarity", "url": null }
black-hole, gravity, supermassive-black-hole Orbital Mechanics Newton's Universal Law of Gravitation Black Holes
{ "domain": "astronomy.stackexchange", "id": 256, "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": "black-hole, gravity, supermassive-black-hole", "url": null }
python, parsing This finds all single characters (.), which are surrounded by square parenthesis (\[...\]) and selects only the character itself ((.)). If you want to allow more than one character between the parenthesis, you need to use a non-greedy version of *, the *?: re.findall('\[(.*)\]', '[][a][a2][+%]') # ['][a][a2][+%'] re.findall('\[(.*?)\]', '[][a][a2][+%]') # ['', 'a', 'a2', '+%'] Regarding your code itself, Python has an official style-guide, PEP8, which recommends using lower_case instead of pascalCase for variables and functions. You could also chain your calls together without sacrificing too much readability (even gaining some, arguably): my_list = my_string.lstrip('[').rstrip(']').split('][')
{ "domain": "codereview.stackexchange", "id": 40412, "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, parsing", "url": null }
fluid-dynamics, weather, turbulence and $$ \partial_j v_j = 0 $$ Where repeated indices are summed, and the units of mass normalize the fluid density to be 1. Each of the terms are easy to understand: the nonlinear term gives the advection, it says that the force on the fluid acts to accelerate the fluid as you move along with the fluid, not at one fixed x position. The pressure P term is just a constraint force that enforces incompressibility, and it is determined by taking the divergence of the equation, and enforcing that $\partial_i v_i = 0$. This determines the Laplacian of the pressure $$ \partial_i v^j \partial_j v_i + \partial_i \partial_i P = 0$$ The friction force says that in the addition to moving along with itself and bending to keep the density constant, the velocity diffuses with a diffusion constant $\nu$. In the limit $\nu=0$, you get the Euler equations, which describe hydrodynamics in the absence of friction.
{ "domain": "physics.stackexchange", "id": 22869, "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": "fluid-dynamics, weather, turbulence", "url": null }
proof-techniques, correctness-proof, induction Induction basis: [...] Induction step: let $k$ be given. Induction hypothesis (IH): let [statement you are trying to prove] be true for $k$. Then [ensuing reasoning which shows the statement is true for $k + 1$ by making use of IH]. This makes it explicit for which $k$ the hypothesis should hold as well as what statement it is exactly that we are trying to prove in the induction step.
{ "domain": "cs.stackexchange", "id": 12813, "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": "proof-techniques, correctness-proof, induction", "url": null }
amateur-observing, history, night-sky Since Super-Novae events can be quite bright, they can even be visible in the daytime sky. They don't last particularly long ... they quickly brighten up ... then begin to dim over weeks and ... after a few months they may no longer be noticeable (but they will leave behind a Super Nova Remnant -- deep sky nebulae such as the Crab Nebula and Veil Nebula are examples of Super Nova Remnants.)
{ "domain": "astronomy.stackexchange", "id": 5603, "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": "amateur-observing, history, night-sky", "url": null }
ros, ros-indigo sudo apt-get install libgl1-mesa-dev-lts-utopic For more information on this issue see this answers.ros.org thread or this launchpad issue Originally posted by Mani with karma: 1704 on 2015-05-20 This answer was ACCEPTED on the original site Post score: 0 Original comments Comment by juwinkler on 2015-10-01: When trying to do this, terminal prints out that each of the packages could not be found. Why does't it find them? Comment by Cerin on 2016-09-15: I'm using 14.04.5 and this doesn't work. It gives me similar "but it is not going to be installed" errors.
{ "domain": "robotics.stackexchange", "id": 21741, "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, ros-indigo", "url": null }
matlab, fft, filters It is desirable to have the filter output be the same length as the input. I can have the input and output be an integer number of cycles of a sinusoid and avoid any spectral leakage. Requiring that the signal be zero-padded for filtering makes avoiding spectral leakage impossible. A full convolution is Lx + Lh - 1 samples long. This can be truncated to two meaningful subsets, as documented in conv(). filter() is generally an iir filter, and will have an infinite output. Thus it is truncated at input length. If you like, you can read final state and insert initial state by adding parameters to i/o. Implementation of FIR and IIR filtering is most easily understood in the time domain, I think. It is just a loop of mults and adds working on a delayline.
{ "domain": "dsp.stackexchange", "id": 10628, "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": "matlab, fft, filters", "url": null }
java, game, mvc, swing if (troop != null) { addAttackTroop(troop); setChanged(); } } } Is MVC correctly applied here? Especially when it comes to the controller layer (Event handlers call the Controller, which calls the Model)? I have the impression that my Controller layer, i.e. the only class of the controller package, is here just to allow me to say "Hey look at me, I've a control layer!", that the event handlers could call the model directly. Should I have done it differently or is that "the right way" as it is? Also, the BattlefieldView is a component of the GameView, which also includes the ShopView: class GameView extends JPanel { public GameView(GameController gameController) { MouseListener moduleApplicationListener = new MouseAdapter() { private Module module; private Object currentView; public void mouseEntered(MouseEvent e) { currentView = e.getSource(); }
{ "domain": "codereview.stackexchange", "id": 26191, "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, mvc, swing", "url": null }
quantum-mechanics, hilbert-space, wavefunction, schroedinger-equation, variational-principle Do the basis functions that we use (especially in linear variations) need to be eigenfunctions of the Hamiltonian of the system ? Why this question ? I am not sure how could be use the theorem otherwise, since it uses eigenfunctions to derive its result. And if they need not, why? And how do we know that this combinations won't actually (for some unknown reason) be actually below the system's ground energy ? Continuing from our chat in $\hslash$, I have to concur with the other participants that you are conflating very many things together, and that that is the real source of all your confusions regarding this topic. In fact, even your title is conflating stuff and thus making your confusion apparent. However, it would go too far afield in linguistics to disentangle that. I do, however, like your own answer to this, as it shows that you have learnt some nice little things.
{ "domain": "physics.stackexchange", "id": 97191, "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, hilbert-space, wavefunction, schroedinger-equation, variational-principle", "url": null }
electrostatics, electric-fields, potential, gauss-law It's straightforward to show that $\Phi_{x=-a} =- \Phi_{x=a}$ and $\Phi_{z=-d} =- \Phi_{z=d}$. Hence: $$\Phi_{y = b} + \Phi_{y = c} = 0.$$
{ "domain": "physics.stackexchange", "id": 67380, "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, potential, gauss-law", "url": null }
formal-languages, turing-machines This is homework so I am not looking for a full resolution or a walkthrough, but if anyone can point be in the right direction I would be very grateful as this has been irritating me for half a day now. You explicitly try to find the middle position and then check whether it has a $c$ at that position. You can save some time by using the power of nondeterminism here. Choose any $c$ and check whether the number of symbols after that position matches the number before that position. When the computation makes a wrong choice it will not accept. If there is indeed a $c$ at the middle position there is a guess that will accept.
{ "domain": "cs.stackexchange", "id": 10173, "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": "formal-languages, turing-machines", "url": null }
If it's abelian then you know it's a product of cyclic groups. You know that the order of these cyclic groups can be $3, 9, 11, 33$, or $99$ and their product must be $99$. You've already seen that if $99$ is in their that you're done, and if $9$ is in their then you're done. So your left with a product of cyclic subgroups of orders $3, 11$, or $33$ and their product must be $99$. So show that $\mathbb Z/33$ has a subgroup of order $3$ and you must have either this group and $\mathbb Z/3$ or you must have two copies of $\mathbb Z/3$. In either case this gives you a subgroup of order $9$.
{ "domain": "stackexchange.com", "id": null, "lm_label": "1. YES\n2. YES", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.9820137863531804, "lm_q1q2_score": 0.828716621089063, "lm_q2_score": 0.8438950986284991, "openwebmath_perplexity": 104.19097258681228, "openwebmath_score": 0.8559584617614746, "tags": null, "url": "https://math.stackexchange.com/questions/1076880/abelian-group-of-order-99-has-a-subgroup-of-order-9" }
statistical-mechanics, correlation-functions, ising-model $$=\frac{2001}{2000}-\left(\frac{2001}{2000}\right)^{2}\approx-5\cdot10^{-4}$$ $$\chi(500)=\frac{1501}{1500}-\left(\frac{1501}{1500}\right)^{2}\approx-6.6\cdot10^{-4}$$ $$\chi(1000)=\frac{1001}{1000}-\left(\frac{1001}{1000}\right)^{2}\approx-1\cdot10^{-3}$$ As we see, the autocorrelation value has doubled when check for half of the number of sweeps through the lattice. Questions:
{ "domain": "physics.stackexchange", "id": 37836, "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": "statistical-mechanics, correlation-functions, ising-model", "url": null }
c++, recursion, template, c++20, constrained-templates namespace UL // unwrap_level { template< std::ranges::input_range Container, std::copy_constructible F> requires (std::ranges::view<Container>&& std::is_object_v<F>) constexpr auto make_view(const Container& input, const F& f) noexcept { return std::ranges::transform_view( input, [&f](const auto&& element) constexpr { return recursive_transform(element, f ); } ); } /* Override make_view to catch dangling references. A borrowed range is * safe from dangling.. */ template <std::ranges::input_range T> requires (!std::ranges::borrowed_range<T>) constexpr std::ranges::dangling make_view(T&&) noexcept { return std::ranges::dangling(); }
{ "domain": "codereview.stackexchange", "id": 44803, "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++, recursion, template, c++20, constrained-templates", "url": null }
quantum-mechanics, statistical-mechanics, hilbert-space, density-operator Could it be that Landau uses the density matrix to describe a subsystem which is quite determined in a way unknown to us (since we only have incomplete information) and in the above example the matrix is used in a closed and completely described system which is probabilistic in nature? (I am ignoring here the probabilistic property in quantum physics itself as it is present in both cases.) I think what he means is with reference to his equation (5.1) $$\psi = \sum_n c_n \psi_n. $$ These $\psi_n$ states are in a superposition and this superposition is not the same as saying the system has some probability of being in one state or the other, even though $|c_n|^2$ is really the probability of the system being in state $\psi_n$ (regular quantum mechanics interference effects). This is manifested in the off diagonal terms of the density matrix. This lead us to the other part of the question.
{ "domain": "physics.stackexchange", "id": 59618, "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, statistical-mechanics, hilbert-space, density-operator", "url": null }
molecular-structure, molecules, dna-rna One of the major areas where the terminology gets fuzzy is in polymers. While on a strict interpretation of the normal definition a single polymer strand (be it DNA or a single strand of polyethylene) is a molecule the terminology is not particularly helpful as the key things that matter in bulk polymer properties are not easily reduced to the properties of individual 'molecules' so the very idea of molecules is less relevant. In polyethylene (a very simple polymer) there will not be a mix of identical molecules but, rather, a wide range of very similar molecules (even for linear polyethylene there will be a wide range of chain lengths (say from 1,000 to 10,000 carbons). So polymer chemists tend not to talk about molecules much.
{ "domain": "chemistry.stackexchange", "id": 14782, "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": "molecular-structure, molecules, dna-rna", "url": null }
algorithms Note that over here the 1s represent that you can transition from the current state to that state. Thus, if the 5th element of the 3rd row is 1 it means that you can go from 2to4. Finding all permissible combinations of length n is equivalent to finding all the walks of length n in this graph. (Adjacency_Matrix)^n results in a matrix of the same dimension where (i,j) denotes number of unique walks of length n between vertex i and j. Since first element cannot be 0, you can sum up the values of this matrix for all (i,j) where i!=0. This would be your answer. Matrix Exponentiation takes O(d^3 log(n)) time. d-> DImension of matrix(10). The DP approach would take too much time for n>10^4. Since this approach is log(n) it will perform better for large values of n.
{ "domain": "cs.stackexchange", "id": 14983, "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": "algorithms", "url": null }
quantum-state, measurement, postselection, state-tomography What is the meaning of postselection in this context? How does Bob go from $I$ to $\sigma$ in this procedure? In principle, Bob here just has to guess the $2\times 2$ matrix $\sigma$. If he starts with any parametric state $\sigma(\alpha,\beta)$ with $\alpha,\beta\in\mathbb{C}$ and measures the outcome Tr$(M\sigma)$ with the post measurement state $\sigma '=M\rho M^\dagger/\text{Tr}(M\rho)$, he receives a number and he has to tune $\alpha,\beta$ to come close to the value Tr$(M\rho)$. This tuning is done on the basis of postselection by which it is implied that he selects the state $\sigma$ close to $\rho$ on the constraint of minimising the relative entropy: \begin{equation} \rho\text{ln}\rho-\rho\text{ln}\sigma \end{equation} so as to move closer to the state $\rho$, which can be found out in terms of $\alpha,\beta$. In such problems usually one starts with a parametric state in one variable and optimises over it.
{ "domain": "quantumcomputing.stackexchange", "id": 528, "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-state, measurement, postselection, state-tomography", "url": null }
python, python-3.x, time-limit-exceeded, numpy, statistics def createListOfStandardDeviations(start,end): end = int(end) sim_num = end - start maxes = np.broadcast_to(np.arange(start+1, end+1), (numCapturedTanks, sim_num)) tankSerialNumbersSimulated = np.floor(np.random.uniform(1, maxes)) simulatedSTDs = np.std(tankSerialNumbersSimulated, axis=0) STDarray.extend(simulatedSTDs)
{ "domain": "codereview.stackexchange", "id": 28578, "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, python-3.x, time-limit-exceeded, numpy, statistics", "url": null }
javascript, immutable.js Title: Cleaner way to construct a name using Immutable.js This is what I've come up with to construct a name using a javascript object and immutable.js: const getFullName = ({ user }) => { if (!user || !user.get('response')) { return ''; } return `${user.getIn(['response', 'firstName']) || ''} ${user.getIn(['response', 'lastName']) || ''}`; };
{ "domain": "codereview.stackexchange", "id": 39671, "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": "javascript, immutable.js", "url": null }
comets Title: How big do comets get? If my understanding is correct, Chury, the best explored comet so far is rather on the smallish side as comets go. Most comets observable with naked eye were so because they flew close to Earth, not because they were so big. I wonder, though, how big are the biggest ones. Let's get it in two variants:
{ "domain": "astronomy.stackexchange", "id": 5258, "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": "comets", "url": null }
slam, localization, navigation, nao, gmapping Originally posted by AHornung with karma: 5904 on 2013-06-26 This answer was ACCEPTED on the original site Post score: 0
{ "domain": "robotics.stackexchange", "id": 14694, "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": "slam, localization, navigation, nao, gmapping", "url": null }
c++, performance, c++17 std::unordered_set<int> Nopes::values() const { return mValues; } class Field { public: Field(int &skyscraper, Nopes &nopes); void insertSkyscraper(int skyscraper); void insertNope(int nope); void insertNopes(const std::vector<int> &nopes); bool fullOfNopes() const; int skyscraper() const; Nopes nopes() const; bool hasSkyscraper() const; std::optional<int> lastMissingNope() const; private: int &mSkyscraper; Nopes &mNopes; bool mHasSkyscraper = false; }; Field::Field(int &skyscraper, Nopes &nopes) : mSkyscraper{skyscraper}, mNopes{nopes} { } void Field::insertSkyscraper(int skyscraper) { assert(mSkyscraper == 0 || skyscraper == mSkyscraper); if (mHasSkyscraper) { return; } mSkyscraper = skyscraper; mHasSkyscraper = true;
{ "domain": "codereview.stackexchange", "id": 40845, "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, c++17", "url": null }