text
stringlengths
1
1.11k
source
dict
exoplanet, water, surface, terrestrial-planets If there's enough dissolved salts or iron in the water-ammonia mix, then the density might be sufficient that water-ice could remain on top. Ice tends to form out of nearly pure water, with very little ocean salt, which increases it's buoyancy. It's possible, with enough saltiness, that ice could form in an ammonia-water ocean. It's also possible that ice would sink. Density I want to point this out now, because it's important. Using our oceans as a model, higher salt concentration sinks. Salt concentration by density
{ "domain": "astronomy.stackexchange", "id": 3851, "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": "exoplanet, water, surface, terrestrial-planets", "url": null }
data-mining, social-network-analysis, crawling, scraping Title: LinkedIn web scraping I recently discovered a new R package for connecting to the LinkedIn API. Unfortunately the LinkedIn API seems pretty limited to begin with; for example, you can only get basic data on companies, and this is detached from data on individuals. I'd like to get data on all employees of a given company, which you can do manually on the site but is not possible through the API. import.io would be perfect if it recognised the LinkedIn pagination (see end of page). Does anyone know any web scraping tools or techniques applicable to the current format of the LinkedIn site, or ways of bending the API to carry out more flexible analysis? Preferably in R or web based, but certainly open to other approaches. Beautiful Soup is specifically designed for web crawling and scraping, but is written for python and not R
{ "domain": "datascience.stackexchange", "id": 525, "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": "data-mining, social-network-analysis, crawling, scraping", "url": null }
java, validation, hibernate @Inject EntityManager entityManager; private String message; @Override public void initialize(final UniqueLocation annotation) { message = annotation.message(); } @Override public boolean isValid(final Location instance, final ConstraintValidatorContext context) { if (instance == null) { // Recommended, instead use explicit @NotNull Annotation for // validating non-nullable instances return true; } final String checkedValue = instance.getLocationName(); final long id = instance.getId(); // must not return a result for name-equality on the same Id String queryString = "SELECT * FROM Location WHERE locationName = :value AND id <> :id"; Query defensiveSelect = entityManager.createNativeQuery(queryString) .setParameter("value", checkedValue).setParameter("id", id);
{ "domain": "codereview.stackexchange", "id": 9908, "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, validation, hibernate", "url": null }
general-relativity, black-holes, event-horizon, geodesics So basically when an object enters the EH it could either follow the geodesic path or the non-geodesic path. There are two cases: As per GR, it should follow the geodesic path, but that looks weird, in a way because it includes an effect that seems something like changing the angle (at the EH) towards the singularity. It follows the more curved (non-geodesic) path, but that is not the shortest way towards the singularity. Question: Which way will the object (massive or massless) follow entering the EH? Your picture is wrong, there is no abrupt change in the angle. A particle approaching the black hole with an angle will have a trajectory like this (the simulation was done in Kerr Schild coordinates, but it looks the same in Raindrop and Droste coordinates): r can only decrease, but that does not mean that the motion has to be purely radial. Angular momentum is conserved.
{ "domain": "physics.stackexchange", "id": 64373, "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": "general-relativity, black-holes, event-horizon, geodesics", "url": null }
performance, r Title: Average calculation I'm testing the influence of the time period on the end result of my calculations. To do this, I'm using a for loop, that is detailed below. In the current state of affairs, this code works well, but it takes more than 10 minutes to go through my complete data set. I believe the use of apply instead of a loop could speed up the process, but I can't work out how to do this. Some assistance would be more than welcome. ## result vector HLClist<-vector() Ts=3600 for(i in 1:length(TimeSpan[,1])){ StartTime=TimeSpan[i,] EndTime=TimeSpan[i,]+TimeInterval Xbis<-Choixintervalle(X,StartTime,EndTime) Xtierce <- resampleDF(Xbis, Ts) HLC<-CalcAverage(Xtierce$Ph,Xtierce$Ti,Xtierce$Te) HLC<-HLC[length(HLC)] HLClist<-append(HLClist,HLC) } Where
{ "domain": "codereview.stackexchange", "id": 31279, "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, r", "url": null }
java, performance, android static enum NetworkType {NO_NETWORK, WIFI, MOBILE} void onNetworkChange(NetworkType type); } And the manager: public final class NetListenerManager { private static final List<NetListener> NET_LISTENERS = new CopyOnWriteArrayList<NetListener>(); private static final BlockingQueue<NetListener.NetworkType> QUEUE = new LinkedBlockingQueue<NetListener.NetworkType>(); private static final Thread QUEUE_PROCESSOR = new Thread(new QueueProcessor()); static { QUEUE_PROCESSOR.start(); } public static void addListener(final NetListener listener) { if (null != listener) { NET_LISTENERS.add(listener); } } public static void removeListener(final NetListener listener) { if (null != listener) { NET_LISTENERS.remove(listener); } } /** * Called when there is a network change. */ public static void notifyOnNetworkChange(final NetListener.NetworkType type) { QUEUE.add(type); }
{ "domain": "codereview.stackexchange", "id": 5125, "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, performance, android", "url": null }
vba, file-system, ms-access Title: Recursive function designed to ensure that full folder path exists before copying a file to the location My recursive function works, but I feel it could be improved... suggestions? The code ensures that a given folder path exists by checking its validity or creating them if they don't already exist, so that afterwards I can, for example copy a file to the location. Function EnsureFolderPath(strP As String) As Boolean On Error GoTo EnsureFolderPath_Error Dim strParent As String Dim fso As FileSystemObject Set fso = New FileSystemObject If Len(fso.GetFileName(strP)) > 0 Then strP = fso.GetParentFolderName(strP) End If If fso.FolderExists(strP) Then 'folder exist EnsureFolderPath = True ElseIf fso.FolderExists(fso.GetParentFolderName(strP)) Then 'parent folder exist fso.CreateFolder strP 'create new subfolder and exit
{ "domain": "codereview.stackexchange", "id": 43238, "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": "vba, file-system, ms-access", "url": null }
terminology, programming-languages, meta-programming The idea of partial evaluation is to compute the specialized function $\phi_m(n)$ automatically. Given the code for the original function $\phi$, partial evaluation does static analysis to determine which bits of the code depend on $m$ and which bits depend on $n$, and transforms it to a function $\phi'$ which, given $m$, constructs $\phi_m$. The second argument $n$ can then be fed to this specialized function. The idea of staged computation is to think about the function $\phi'$ first. It is called a "staged" function because it works in multiple stages. Once we give it the first argument $m$, it constructs the code for the specialized function $\phi_m$. This is the "first stage." In the second stage, the second argument is provided to $\phi_m$ which does the rest of the job.
{ "domain": "cs.stackexchange", "id": 381, "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, programming-languages, meta-programming", "url": null }
homework-and-exercises, schroedinger-equation, harmonic-oscillator Title: Change of variable in harmonic oscillator time independent Schrodinger equation I was revising the harmonic oscillator for my intro to quantum course and realised I'd sort of accepted a change of variable result without actually being able to get to it. It says: The stationary state Schrodinger equation of energy $E$ is $$-\frac{\hbar^{2}}{2m}\frac{d^{2}\psi}{dx^{2}}+\frac{1}{2}m\omega^{2}x^{2}\psi=E\psi\tag{5.2}$$ The first thing to do is to redefine variables so as to remove the various physical constants: $$\epsilon=\frac{2E}{\hbar\omega}, \xi=\sqrt{\frac{m\omega}{\hbar}}x$$ so that (5.2) becomes $$-\frac{d^{2}\chi}{d\xi^{2}}+\xi^{2}\chi=\epsilon\chi$$ where $$\psi(x)=\chi(\xi)=\chi(\sqrt{\frac{m\omega}{\hbar}}x).$$ So, I've tried working with the algebra but can't seem to get to this. I'm probably missing something really obvious, but it's getting quite frustrating! Can anyone help? You should show your work, but my guess is that you have to notice the change of variables:
{ "domain": "physics.stackexchange", "id": 13171, "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, schroedinger-equation, harmonic-oscillator", "url": null }
geophysics, planetary-science, earth-rotation I think the answer to the question will depend on whether the Earth's rotation is slowing at a decreasing rate or at a constant rate. The short answer is "Probably Yes". The longer answer is that it is debatable whether Earth's rotation will become tidally locked to the moon due to tidal drag, at which point it will not be rotating relative to the moon, or whether the sun's exhaustion of hydrogen and the fusion of Helium will result in the sun's expansion vaporizing the earth first. As tidal drag slows the earth's rotation, the moon moves further away, reducing its effect on the earth's rotation, and making the calculations fairly complex. In either case, unless something really unexpected happens to the earth first, such as it being ejected from the solar system, which is completely improbable, it will stop rotating, if only due to it ceasing to be a planet at all.
{ "domain": "earthscience.stackexchange", "id": 2183, "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": "geophysics, planetary-science, earth-rotation", "url": null }
c++, strings, search Before these code reviews I raised the question The best place to store index to data where I didn’t get better proposals than my way to wrap up the references to index and indexed text into Index structure: template <typename LexemType=lexem_t, typename IndexType = index_t> struct Index { const std::vector<LexemType>& text; const std::vector<IndexType>& index; public: decltype(index.begin()) begin() const { return index.begin(); } decltype(index.end()) end() const { return index.end(); } size_t size() const { return index.size(); } const IndexType& operator[] (size_t idx) const { return index[idx]; } };
{ "domain": "codereview.stackexchange", "id": 45370, "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, search", "url": null }
ros, catkin, ros-kinetic, rosdistro Original comments Comment by gvdhoorn on 2018-04-13: I'm not sure what your asking exactly. The yaml files you mention list packages by their name, not their file system location. rospkg and all other ROS libraries/tools that handle packages use names and there is infrastructure to find pkgs on the FS. Can you clarify why you believe you need .. Comment by gvdhoorn on 2018-04-13: .. to list packages with (relative) file system paths exactly? Is there a document, page or tutorial that gives you that impression? Also note: Bloom (and some other tools) will generate the yaml listings, that is not something you do by hand typically. Comment by zcm on 2018-04-13: @gvdhoorn Thanks for your reply! I see the yaml file just list package names, not relative location, in like kinetic rosdistro file. But I see from the tutorial http://wiki.ros.org/bloom/Tutorials/FirstTimeRelease , at the very end of the page. Comment by zcm on 2018-04-13:
{ "domain": "robotics.stackexchange", "id": 30629, "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, catkin, ros-kinetic, rosdistro", "url": null }
$\angle ACB = \cos^{-1}\frac18$ and $\angle BAC = \cos^{-1}\frac34$. So $\sin \angle BAC = \sqrt{1 - \frac9{16}} = \frac{\sqrt7}2$. By the double angle formula, $\cos (2\angle BAC) = (\frac34)^2 - (\frac{\sqrt7}2)^2 = \frac18 = \cos \angle ACB$. –  NovaDenizen Jan 22 '14 at 15:40
{ "domain": "stackexchange.com", "id": null, "lm_label": "1. YES\n2. YES", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.984336348990826, "lm_q1q2_score": 0.8223968185865274, "lm_q2_score": 0.8354835411997897, "openwebmath_perplexity": 446.80322432323817, "openwebmath_score": 0.922185480594635, "tags": null, "url": "http://math.stackexchange.com/questions/563866/ratio-of-angles-in-a-triangle-given-lengths-of-triangles-sides" }
c++, memory-management, vectors Alright, so I made my position clear in the concept review section, but this isn’t related to that: even assuming that the whole “dumb vector” thing is a good idea, I think you should basically throw dumb::vector out entirely, and just keep dumbestvector (but put that in the namespace and call it dumb::vector). Why? Well, dumbestvector may be “dumb”… but at least it isn’t wrong. This…: // Copies all the elements in the vector to a larger data allocation. // Accessing that extra space is undefined behavior. // dumb::vector v; // v.reserve(10); // increases capacity to 10 // for (unsigned int i = 0; i < 10; i++) // v.push_back(i); // doesn't keep copying the entire vector on every push_back() void reserve(unsigned int new_cap) { if (new_cap <= capacity_) return; value_type* new_data = new value_type[new_cap]; for (unsigned int i = 0; i < size_; ++i) { new_data[i] = data_[i]; } delete[] data_; data_ = new_data; capacity_ = new_cap; }
{ "domain": "codereview.stackexchange", "id": 40485, "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++, memory-management, vectors", "url": null }
quantum-mechanics, operators, hilbert-space, wavefunction-collapse, quantum-states One choice would be just saying "my state now is syrup", end of discussion. Other option is using unitary operators ($U$ such that $UU^* = U^*U = 1$). Those transform state vectors in state vectors. If you would like more sophisticated examples, it starts to get tricky, and I will shut up before I say something very wrong about it. But rest assured this is not easy at all, and your question is really nice. Hope to see some other inspiring aswers.
{ "domain": "physics.stackexchange", "id": 16281, "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, operators, hilbert-space, wavefunction-collapse, quantum-states", "url": null }
reaction-mechanism Coal gas is of little use these days, with major fuel components carbon monoxide and hydrogen. Much more common is natural gas, based on methane, or LPG, based on butane (typically 80%) and propane. The oxidant is in all cases aerial oxygen.
{ "domain": "chemistry.stackexchange", "id": 15316, "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": "reaction-mechanism", "url": null }
c++, template-meta-programming, c++17 template <typename Callable, typename Container> using invoke_result = std::result_of_t<Callable(value_type<Container>)>; } template <typename Container, typename Callable> struct mutable_in_place : public std::bool_constant<std::is_same_v<detail::value_type<Container>, detail::invoke_result<Callable, Container>>> {}; namespace detail { template <template <typename ...> typename Container, typename T, typename ... TArgs, typename Callable> auto realfmap(Container<T, TArgs...> container, Callable&& callable, std::true_type) { std::transform(container.begin(), container.end(), container.begin(), std::forward<Callable>(callable)); return container; }
{ "domain": "codereview.stackexchange", "id": 26214, "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++, template-meta-programming, c++17", "url": null }
general-relativity, reference-frames, observers, quantum-gravity, equivalence-principle $$ \frac{d^2 x^\mu}{d\tau^2} + \Gamma^\mu_{\rho\sigma} x^\rho x^\sigma = 0 $$ If you aren't familiar with GR, you can roughly read this as saying that the acceleration (second time derivative of $x$) is related to the gravitational field $\Gamma$. However, $\Gamma$ depends on you choice of coordinates. For uniform acceleration, it will be possible to select coordinates where $\Gamma=0$. In graviton language, you should be able to describe the process of a uniformly accelerating particle with virtual gravitons in some frame, but you will get an equivalent answer to a different frame where no virtual gravitons where created. In the lingo, any apparent effect from virtual gravitons in this case is "pure gauge", or fictitious.
{ "domain": "physics.stackexchange", "id": 98048, "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": "general-relativity, reference-frames, observers, quantum-gravity, equivalence-principle", "url": null }
javascript With these suggestions applied, your code would look something like this: function isContactEmpty(contact) { for (const field of Object.values(contact)) { if (typeof field === 'string' && field) { return false } else if (Array.isArray(field)) { for (const { value } of field) { if (value.length) return false } } } return true }
{ "domain": "codereview.stackexchange", "id": 40576, "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", "url": null }
If I model this as a simply supported beam having load at mid span [...] I suspect that this is where your analysis went awry. First off, you should always model bridges with distributed loads, not a single concentrated load at midspan. The most significant load on a bridge will almost always be its own self-weight; load-trains are heavy but, well, so are bridges. Secondly, I assume you're thinking of the bridge like this: Indeed, we can see here that the bending moment is greater at midspan. However, that's not the bridge we're looking at, it's missing the cantilevers! So in fact we get: Now, I chose a midspan-to-cantilever ratio which exactly cancels out the bending moment at midspan. It's entirely possible that the real bridge has a positive bending moment at midspan, but it'll certainly be much smaller than the negative moment at the supports.
{ "domain": "stackexchange.com", "id": null, "lm_label": "1. YES\n2. YES", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.9425067147399245, "lm_q1q2_score": 0.8270277732896693, "lm_q2_score": 0.8774767970940975, "openwebmath_perplexity": 1698.0854397734424, "openwebmath_score": 0.6012333035469055, "tags": null, "url": "https://engineering.stackexchange.com/questions/51347/why-is-this-bridge-thickest-above-the-support-pillars-instead-of-the-mid-span-wh/51351" }
newtonian-mechanics, acceleration, calculus, approximations, differential-equations Title: Differential Equation & MacLaurin Series for Newton’s Second Law I am currently working with a differential equation, where I think I need to take the derivative of $ma$ (corrected as per comment). I am trying to write $F = ma$ as a MacLaurin series and eventually set it in terms of $m\ddot x(t)$. The problem is that I am not sure if I should write my MacLaurin series in terms of $x$ also or use a. Also, I am not very sure if you take the derivative of $a$ if you would have to use Chain Rule or if you could simply take the third derivative of position. Any hints would be appreciated. As I understand the problem statement, you want to start with Newton's 2nd law, $F$ = ma for some general Force $F$. Let's suppose we're talking about the 1-dimensional displacement $x$ of a particle with mass $m$ at time $t$. Writing $F(x)$ means $F(x) = ma = m*\left(\frac{d^2 x}{dt^2}\right)$.
{ "domain": "physics.stackexchange", "id": 72675, "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, acceleration, calculus, approximations, differential-equations", "url": null }
species-identification, botany Title: Please name this plant What is the name of this plant? It was found in a village in Bangladesh, in the month of February. I believe this plant may be Rotala rotundifolia Quoting from Wikipedia, It is a common weed in rice paddies and wet places in India, China, Taiwan, Thailand, Laos, and Vietnam, and has been introduced to the United States. This makes sense, as Bangladesh is located near both India and China. The emerse form has rounded leaves, the submerse leaves are narrow lanceolate. It is very variable dependent on light and environmental conditions. Under strong light, the leaves can become almost wine red. It has pale pink flowers. (source)
{ "domain": "biology.stackexchange", "id": 8487, "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": "species-identification, botany", "url": null }
python, parsing, csv, pandas, email 91,0,Sunflower - Spider-Man: Into the Spider-Verse,/track?id=21815071,https://open.spotify.com/track/0RiRZpuVRbi7oqRdSMwhQY,"Post Malone, Swae Lee",Hollywood's Bleeding,Republic Records,"Sep 06, 2019",8102,18,"Dec 05, 2019",-2.71,930,USUM71814888 92,-2,Hrs & Hrs,/track?id=66959718,https://open.spotify.com/track/3M5azWqeZbfoVkGXygatlb,Muni Long,Public Displays Of Affection,"Supergiant Records, LLC / Def Jam Recordings","Nov 19, 2021",8015,40,"Mar 22, 2022",-4.14,16,QZAKB2136210 93,15,Go Your Own Way - 2004 Remaster,/track?id=16016837,https://open.spotify.com/track/07GvNcU1WdyZJq3XxP0kZa,Fleetwood Mac,Rumours,Rhino/Warner Records,"Feb 04, 1977",8003,33,"Dec 31, 2021",-1.14,"1,435",USWB10400050 94,-7,Softcore,/track?id=18714857,https://open.spotify.com/track/2K7xn816oNHJZ0aVqdQsha,The Neighbourhood,Hard To Imagine The Neighbourhood Ever Changing,Columbia,"Nov 02, 2018",7994,61,"Feb 13, 2022",3.86,88,USSM11800523
{ "domain": "codereview.stackexchange", "id": 43147, "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, csv, pandas, email", "url": null }
c++, error-handling, c++20, exception if (!check(result)) { return EXIT_FAILURE; } The advantage of exceptions of course is that errors won't be ignored if you forget to check for them, and you can also do multiple actions in a single try-catch block without having to check the result of each individual action. Make it easy to wrap lots of functions Your createDirectory_CanThrow() has a lot of code in it. What if you want to wrap another function that also returns a CreateDirectoryResult? The what() function I wrote might be helpful then. You can also make a function like check() that throws the exception for you: void check(CreateDirectoryResult result) { if (result != CreateDirectoryResult::Ok) { throw std::runtime_error("Error creating directory: " + what(result) + "\n"); } } So then you can write: void createDirectory_CanThrow(std::string_view directory) { check(createDirectory(directory)); }
{ "domain": "codereview.stackexchange", "id": 45311, "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++, error-handling, c++20, exception", "url": null }
quantum-field-theory, conformal-field-theory, correlation-functions $$ where $e=\frac{z}{|z|}$, write $\xi=\frac{x}{|z|}$ and now work with $$ \frac{1}{|e-\xi|^{\Delta_\phi}}=\left[\frac{1}{(e-\xi)^2}\right]^{\Delta_\phi/2}, $$ Using $(e-\xi)^2=1-2(e\cdot\xi)+\xi^2$ and replacing $\xi\to\epsilon\xi$ to track the order you get just $$ \left[\frac{1}{1-2\epsilon(e\cdot\xi)+\epsilon^2\xi^2}\right]^{\Delta_\phi/2}, $$ which is now just a usual function of scalar argument $\epsilon$, which you can expand out in powers of $\epsilon$ by hand or using Mathematica. To get the general answer, set $\epsilon=t/|\xi|$ and get $$ \left[\frac{1}{1-2t\frac{(e\cdot\xi)}{|\xi|}+t^2}\right]^{\Delta_\phi/2}=\sum_{j=0}^\infty C^{(\Delta_\phi/2)}_j\left(\frac{e\cdot\xi}{|\xi|}\right)t^j=\sum_{j=0}^\infty C^{(\Delta_\phi/2)}_j\left(\frac{e\cdot\xi}{|\xi|}\right)|\xi|^j\epsilon^j, $$ by definition of the Gegenbauer polynomials, as noted by Abdelmalek Abdesselam.
{ "domain": "physics.stackexchange", "id": 39534, "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, conformal-field-theory, correlation-functions", "url": null }
My team wasn't awarded any points for the answer. The quizmaster said that the time period will decrease, but he too gave the same reason that I had given. Note by Ritu Roy 4 years, 8 months ago MarkdownAppears as *italics* or _italics_ italics **bold** or __bold__ bold - bulleted- list • bulleted • list 1. numbered2. list 1. numbered 2. list Note: you must add a full line of space before and after lists for them to show up correctly paragraph 1paragraph 2 paragraph 1 paragraph 2 [example link](https://brilliant.org)example link > This is a quote This is a quote # I indented these lines # 4 spaces, and now they show # up as a code block. print "hello world" # I indented these lines # 4 spaces, and now they show # up as a code block.
{ "domain": "brilliant.org", "id": null, "lm_label": "1. YES\n2. YES\n\n", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.9579122696813394, "lm_q1q2_score": 0.8122787163639358, "lm_q2_score": 0.8479677545357569, "openwebmath_perplexity": 3894.860620922402, "openwebmath_score": 0.9850621223449707, "tags": null, "url": "https://brilliant.org/discussions/thread/time-period-and-frequency/" }
# How do you deduce that matrices are equal i wanted to ask for a clarification. I was looking around in my linear algebra text when i reached this justification: Considered two coloumn vectors $$X$$ and $$Y$$, and assume $$X ^tC Y = X^t C^t Y$$ for every $$X,Y \in V$$, with $$V$$ an $$n$$-dimensional vectorial space, with $$X^t, Y^t$$ being the transposed of $$X, Y$$. My book says that because of this is valid for every $$X,Y$$, we can deduce: $$C^t = C$$ Now, it is intuitively true, but i was wondering if ,maybe the general sum (it's a bilinear form) could equals without needing $$C^t = C$$. I've seen this type of justification also in other theorems, but i want to know if there is a way to prove it formally, beacuse i'm not satisfied.
{ "domain": "stackexchange.com", "id": null, "lm_label": "1. YES\n2. YES", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.98527138442035, "lm_q1q2_score": 0.8334828801736328, "lm_q2_score": 0.8459424411924673, "openwebmath_perplexity": 176.88681712131978, "openwebmath_score": 0.9437273144721985, "tags": null, "url": "https://math.stackexchange.com/questions/4284669/how-do-you-deduce-that-matrices-are-equal" }
galaxy, stellar-evolution, star-systems, stellar-dynamics, cepheids I can't really describe it much better than this, but let me know if it needs to be made more clear. Note that this mechanism isn't restricted to helium II/III. Other classes of variable star operate in the same way. e.g. RR Lyraes and $\beta$ Cepheids. The equilibrium state of stars In all phases, stars are presumed to be in hydrostatic equilibrium: the outward force of pressure in the star (from the gas, radiation and sometimes electron or neutron degeneracy) is precisely balanced by the inward force of gravity. In many phases, we can additional regard the star as being in local thermodynamic equilibrium. What we really mean here is that the star is not generating (or absorbing) energy through expansion and contraction. This isn't true for, say, pre-main-sequence stars, which are only generating energy by their contraction toward the main sequence.
{ "domain": "astronomy.stackexchange", "id": 442, "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": "galaxy, stellar-evolution, star-systems, stellar-dynamics, cepheids", "url": null }
c#, .net, wpf, xaml, markdown if (result.Value) { using (var sr = new StreamReader(dialog.FileName)) { MarkdownContent = sr.ReadToEnd(); } } } public bool CanOpenCss(object parameter) => true; public void OpenCss(object parameter) { var dialog = new OpenFileDialog(); dialog.AddExtension = true; dialog.Filter = "CSS Files|*.css|All Files|*.*"; var result = dialog.ShowDialog(); if (result.Value) { using (var sr = new StreamReader(dialog.FileName)) { CssContent = sr.ReadToEnd(); } } } public void OnPropertyChanged(PropertyChangedEventArgs e) { var handler = PropertyChanged; handler?.Invoke(this, e); } public event PropertyChangedEventHandler PropertyChanged; }
{ "domain": "codereview.stackexchange", "id": 18681, "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#, .net, wpf, xaml, markdown", "url": null }
c++, random private: [[nodiscard]] static Engine& engineInstance() { static Engine engine{ Seeder{}() }; return engine; } }; using Random = BasicRandom<std::mt19937_64, details::DefaultSeeder>; } Here is some example usage, that ive also used to make sure everything works as expected: Main.cpp #include "Random.hpp" #include <iostream> #include <numeric> int main() { const auto int_range{ ae::Random::range(0, 100) }; const auto double_range{ ae::Random::range(0.0, 50.0) }; const auto uint_range{ ae::Random::range(5u, 100) }; // std::common_type will make the result unsigned int constexpr auto chance_to_roll_6{ 1.0 / 6.0 }; constexpr auto chance_to_roll_6_twice{ chance_to_roll_6 * chance_to_roll_6 }; const auto roll_6_with_dice{ ae::Random::chance(chance_to_roll_6) }; const auto roll_6_with_dice_twice{ ae::Random::chance(chance_to_roll_6_twice) };
{ "domain": "codereview.stackexchange", "id": 37972, "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++, random", "url": null }
Since $|z'(s)| \equiv 1$ and $\Lambda(s_1,s_2) > 0$ for $(s_1,s_2) \in (0,L)^2$, we can bound $\mathcal{M}_{cm}$ as $$\mathcal{M}_{cm} \le L \iint_{[0,L]^2} \Lambda(s_1,s_2) |z'(s_1)||z'(s_2)| ds_1 ds_2 = L \iint_{[0,L]^2} \Lambda(s_1,s_2) ds_1 ds_2$$ Notice the equality in above inequality is achieved when and only when $z'(s)$ is a constant. We can conclude $\mathcal{M}_{cm}$ is largest for straight lines.
{ "domain": "stackexchange.com", "id": null, "lm_label": "1. YES\n2. YES", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.9867771759145342, "lm_q1q2_score": 0.853783381882623, "lm_q2_score": 0.8652240877899775, "openwebmath_perplexity": 362.9206858080145, "openwebmath_score": 0.9473633170127869, "tags": null, "url": "https://math.stackexchange.com/questions/616106/when-is-the-moment-of-inertia-of-a-smooth-plane-curve-is-maximum" }
algorithms, sorting, consensus Unfortunately, there are also negative results showing that no scheme provides all of the properties that we might desire. See Arrow's theorem: https://en.wikipedia.org/wiki/Arrow%27s_impossibility_theorem and https://en.wikipedia.org/wiki/Condorcet_paradox.
{ "domain": "cs.stackexchange", "id": 13643, "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, sorting, consensus", "url": null }
quantum-field-theory, special-relativity, standard-model, symmetry-breaking, higgs Title: What if EM or QCD was spontaneously broken? Suppose that Standard Model Higgs mechanism broke electromagnetism, by e.g. veving the charged component of the doublet, so that the photon was massive with $m_\gamma\sim v$. Could such a Universe still have large scale structure? Atoms (i.e. stable electronic orbits)? Life? Assuming we got past those hurdles, would it have been much more difficult to have discovered special relativity? Would we have been stuck at Galilean invariance, without the invariance of the speed of light from which to build SR? I appreciate that this is speculative. And, also, the identical question but for a coloured Higgs vacuum that breaks QCD. Would broken QCD still be confining? I guess so - so we could still have nucleons and the resulting chemistry?
{ "domain": "physics.stackexchange", "id": 7911, "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, special-relativity, standard-model, symmetry-breaking, higgs", "url": null }
ros, build Both long double and double are valid types; evidently, the compiler you're using can't disambiguate them. This is outside my realm of knowledge; I'm not sure if people run into this often or if there's a typical fix. But it seems to me that you should be able to explicitly declare and initialize a typed variable on the line before and use that: double x=5.0; private_nh_.param("max_desired_publish_freq", max_desired_publish_freq_, x); Originally posted by kramer with karma: 1470 on 2017-02-05 This answer was ACCEPTED on the original site Post score: 0 Original comments Comment by banerjs on 2017-02-05: Of course! I didn't notice that line with long double. double_t must be parsed as a long double on 32-bit. Thanks!
{ "domain": "robotics.stackexchange", "id": 26922, "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, build", "url": null }
waves I used to have this misunderstanding that the phase difference was the wavelength "elapsed" between two points, but this is not truly correct as phase difference is an angle and not a distance. Phase and distance are related but as you say the dimensions are different. The correct relationship is (see the answer by AccidentalTaylorExpansion for the math equations): phase difference is the distance elapsed between two points divided by the wavelength of a complete period and multiplied by $2\pi$
{ "domain": "physics.stackexchange", "id": 94461, "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", "url": null }
books Mathematician's Delight by W. W. Sawyer How to Prove It: A Structured Approach by Daniel J. Velleman How to Solve It: A New Aspect of Mathematical Method by G. Polya An Introduction to Functional Programming Through Lambda Calculus by Greg Michaelson Foundations of Computer Science by Al Aho and Jeff Ullman (http://i.stanford.edu/~ullman/focs.html) Concrete Mathematics: A Foundation for Computer Science by Graham, Knuth, and Patashnik Introduction to the Theory of Computation by Michael Sipser Introduction to Automata Theory, Languages, and Computation by John E. Hopcroft, Rajeev Motwani, Jeffrey D. Ullman Computational Complexity: A Conceptual Perspective by Oded Goldreich Computational Complexity: A Modern Approach by Sanjeev Arora, Boaz Barak A Course in Combinatorics by J. H. van Lint, R. M. Wilson Computability: An Introduction to Recursive Function Theory by Nigel Cutland Computers and Intractability: A Guide to the Theory of NP-Completeness by M.R. Garey, D.S. Johnson
{ "domain": "cs.stackexchange", "id": 783, "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": "books", "url": null }
electromagnetism, homework-and-exercises Title: Will relative velocity with respect to electrons effect current in wire and magnetic field produced by wire? Question: consider a long, straight wire of cross-sectional area $A$ carrying a current $i$. Let there be $n$ free electrons per unit volume. An observer places himself on a trolley moving in the direction opposite to the current with a speed $v = \frac{i}{nAe}$ and separated from the wire by a distance $r$. The magnetic field seen by the observer is very nearly My Answer: Zero. Because current is $neAv$ where $v$ is drift velocity of electrons. Relative velocity between him and electrons is zero. So, no flow of charge through any cross-section according to him. So no current. So no magnetic field. Actual answer: $\frac{\mu\ i}{2\cdot\pi\cdot r}$ where $\mu$ is the permeabilty of free space. Unlike an electron beam, a wire carrying a current contains positive charges as well, and these charges move with respect to the moving observer.
{ "domain": "physics.stackexchange", "id": 2434, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "electromagnetism, homework-and-exercises", "url": null }
methods Nonlinear oscillations. Non‐linear systems can have multiple equilibrium points. Introduction Phase Plane Qualitative Behavior of Linear Systems Local Behavior of Nonlinear Systems How to Construct Phase Plane Trajectories? I Despite of exiting several routines to generate the phase portraits by computer, it is useful to learn roughly sketch the portraits or quickly verify the computer outputs. of these nonlinear systems is the phase portrait [Shamolin, 2009], where typical nonlinear behavior canbeeasily identified,suchasmultiple equilibrium points, limit cycles, bifurcations and chaos. See Figure 1. ) (b) Linearize the system at each of the constant solutions. It is the boundary between oscillations of the nonlinear pendulum and rotations. 1 of the text discusses equilibrium points and analysis of the phase plane. In general, it may not be possible to find solutions for a nonlinear system in terms of elementary functions. After completing this course, students should
{ "domain": "colagrossijeans.it", "id": null, "lm_label": "1. YES\n2. YES\n\n", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.9852713891776498, "lm_q1q2_score": 0.8273658508922132, "lm_q2_score": 0.8397339656668287, "openwebmath_perplexity": 567.4945903919495, "openwebmath_score": 0.6094440817832947, "tags": null, "url": "http://colagrossijeans.it/kzgz/phase-portrait-nonlinear-system.html" }
disjoint-sets And the concrete implementation: class FastUnionSlowFindSet : public DisjointSet { public: FastUnionSlowFindSet(int n) : DisjointSet(n) {} int find(int vertex) const { while (vertices[vertex] != vertex) { vertex = vertices[vertex]; } return vertex; } void union_(int v1, int v2) const { vertices[v2] = v1; } }; The idea is that we are keeping track of each vertex's parent and when finding we are going 'up' until we have a vertex whos parent is itself. For the union operation we are just changing the parent of the second node and the find will work because it is going one parent at a time. Why do we need to check for the rank and whether the roots are the same in the official implementation? I fail to see the logic discrepancy in my approach. Unfortunately, your implementation of disjoint sets does not work. For example, consider the following calling sequence. s = FastUnionSlowFindSet(3); s.union_(0,1); s.union_(2,1);
{ "domain": "cs.stackexchange", "id": 20329, "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": "disjoint-sets", "url": null }
thermodynamics, statistical-mechanics Title: Distinguishable particles in Maxwell-Boltzmann distribution In the derivation of Maxwell-Boltzmann (MB) probability distribution function, why did he choose distinguishable particles? I mean, suppose you consider CO gas. and you are applying the probability function, but you know that the molecules are indistinguishable. Now in Bose-Einstein and Fermi-Dirac statistics we consider indistinguishability of particles due to quantum approach because the wavefuntions of the particles overlap with each other. But I mean in common sense you can feel that the molecules must be indistinguishable. But why did Maxwell choose distinguishable particles? And what are the problems you have if you consider indistinguishable particles in MB statistics or what are the conditions for which the particles of the gas becomes distinguishable? It is true that atoms and molecules are fundamentally indistinguishable, but when they are enough far apart you can distinguish them.
{ "domain": "physics.stackexchange", "id": 46817, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "thermodynamics, statistical-mechanics", "url": null }
c++, memory-management, template-meta-programming How can I write some unit tests to this? it's hard to figure whether the address returned is valid or not. malloc.cpp #include "slab_allocator.h" const size_t PAGE_SIZE = 0x1000; static Slab<0x010, PAGE_SIZE> slab_0x10; static Slab<0x020, PAGE_SIZE> slab_0x20; static Slab<0x040, PAGE_SIZE> slab_0x40; static Slab<0x060, PAGE_SIZE> slab_0x60; static Slab<0x100, PAGE_SIZE> slab_0x100; static Slab<0x200, PAGE_SIZE> slab_0x200; static Slab<0x300, PAGE_SIZE> slab_0x300; void init() { slab_0x10.init(); slab_0x20.init(); slab_0x40.init(); slab_0x60.init(); slab_0x100.init(); slab_0x200.init(); slab_0x300.init(); }
{ "domain": "codereview.stackexchange", "id": 39434, "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++, memory-management, template-meta-programming", "url": null }
sine wave of frequency 1Hz without phrase angle, the blue one is the result of ploting sin(2*pi*time). What goes wrong: by multiplying time vector t by 2*pi*60 your discrete step size becomes 0. Wavelength. See full list on mathopenref. This wave equation is called the Klein-Gordon equation and correctly describes the propagation of relativistic particles of mass m 0. Find the amplitude which is half the distance between the maximum and minimum. A shock wave is generated which is inclined at angle s. angular wave function Ф, i. 0 # framerate as a float amp. I will provide you with two examples. So shouldn't the coefficient of the sine be 100?. Fourier Series. Traveling Wave Parameters. Square wave can be defined as a non sinusoidal periodic waveform that can be represented as an infinite summation of sinusoidal waves. So if I have a sine wave, a voltage sine wave, for instance, v of t equals cosine omega t, I can write that equivalently as v of t equals cosine two pi f times t. It
{ "domain": "wattonweb.it", "id": null, "lm_label": "1. YES\n2. YES", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.9833429604789206, "lm_q1q2_score": 0.8318515387880796, "lm_q2_score": 0.8459424353665382, "openwebmath_perplexity": 596.3331284839677, "openwebmath_score": 0.8392153978347778, "tags": null, "url": "http://wattonweb.it/mvv/sine-wave-equation.html" }
php, design-patterns, php5 interface Subject{ public function registerObserver(Observer $o); public function removeObserver(Observer $o); public function notifyObserver(); } interface DisplayElement{ public function display(); } class WeatherData implements Subject{ private $observers; private $temperature; private $humidity; private $pressure;
{ "domain": "codereview.stackexchange", "id": 6297, "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, design-patterns, php5", "url": null }
javascript, beginner, angular.js, asynchronous, firebase // No need for catch. Should any errors happen, the entire thing will be a // return a rejected promise which the caller can handle instead. }
{ "domain": "codereview.stackexchange", "id": 18738, "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, angular.js, asynchronous, firebase", "url": null }
The integer solutions are $b = 4, ~~ r = 8, ~~ y = 3$ and $b = 1,~~ r = 13, ~~ y = 1$. The first solution has $b\ge2$. • I can vouch for the correctness of the calculations, that is, those are indeed the only integer solutions to the system of inequalities and equality. That said, I still think it should be shown whether or not the diophantine solution has a geometric realisation on the plane. Apr 11 '16 at 0:46 • @Fimpellizieri: I added a (semi-trivial) geometric realization of these points in the community wiki answer. Apr 13 '16 at 17:10 • @MichaelSeifert Are they allowed to coincide? That's a bit of a bummer, haha. Apr 13 '16 at 17:49 • @Fimpellizieri: Yeah, it's not terribly interesting. I suspect, however, that this solution could be continuously deformed to another one where the points aren't all degenerate. After all, we have 30 free variables (x and y coords for 15 points) and only 3 constraints, so one would expect the solution space to be 27-dimensional. Apr 13 '16 at 17:52
{ "domain": "stackexchange.com", "id": null, "lm_label": "1. YES\n2. YES", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.9825575116884778, "lm_q1q2_score": 0.8010128083906934, "lm_q2_score": 0.8152324915965392, "openwebmath_perplexity": 455.0723516940438, "openwebmath_score": 0.7615922689437866, "tags": null, "url": "https://puzzling.stackexchange.com/questions/30717/red-blue-and-yellow-points/30730" }
If $(X,Y)$ is binormal, then so is $(X,Z) = (X,X+Y)$. The ratio $X/Z$ is the tangent of the slope of the line through the origin and the point $(Z,X)$. When $X$ and $Z$ are uncorrelated with zero means, it is well known (and easy to compute) that $X/Z$ has a Cauchy distribution. Cauchy distributions have no expectations. This should lead us to suspect $X/Z$ might not have a mean, either. Let's see whether it does nor not. For any angle $0 \lt \theta \lt \pi/2$, consider the event $$E_\theta = \{(Z,X)\,|\, X \ge Z\cot(\theta\}.$$ This is of interest because its probability is the chance that $X/Z$ exceeds $\cot(\theta)$: the survival function of $X/Z$. It carries all the information of the distribution function of $X/Z$.
{ "domain": "stackexchange.com", "id": null, "lm_label": "1. YES\n2. YES", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.9820137889851291, "lm_q1q2_score": 0.8266843993678109, "lm_q2_score": 0.8418256532040708, "openwebmath_perplexity": 228.10545472616786, "openwebmath_score": 0.9972779750823975, "tags": null, "url": "https://stats.stackexchange.com/questions/161461/what-is-the-expected-value-of-fracxxy" }
javascript, performance Title: Optimize "nearest" Element query prototype I have devised a recursive function to grab the "nearest" element. This is a bit different than Element.closest, because instead of traversing just the immediate parent(s); it traverses up but checks left-right-up-down. Is there a more efficient check for siblings that I am missing? if (Element.prototype.nearest === undefined) { const nearest = (el, selector) => { if (el == null) return undefined; const prev = el.previousElementSibling; if (prev?.matches(selector)) return prev; const next = el.nextElementSibling; if (next?.matches(selector)) return prev; const parent = el.parentElement; if (parent?.matches(selector)) return parent; const relative = parent.querySelector(selector); if (relative) return relative; return nearest(el.parentElement, selector); }; Element.prototype.nearest = function(selector) { return nearest(this, selector); }; }
{ "domain": "codereview.stackexchange", "id": 40647, "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, performance", "url": null }
javascript, performance, random function find_coin() { var roll = Math.random() * 100; if (roll < 0.01) currency['platinum']++; else if (roll < 0.1) currency['gold']++; else if (roll < 1) currency['silver']++; else if (roll < 10) currency['bronze']++; }; 90% of your random values will be >= 10, additionally, 9 % will be between 1 and 10 %, so, 99% of your tests will have to check.... 4 roll conditions (< 0.01, < 0.1, < 1, and < 10). So, 99% of all your rolls will check 100% of your conditions. If you reverse the logic, and do: function find_coin() { var roll = Math.random() * 100; if (roll >= 10) { return } if (roll >= 1) { currency['bronze']++; } else if (roll >= 0.1) { currency['silver']++; } else if (roll >= 0.01) { currency['gold']++; } else { currency['platinum']++; } };
{ "domain": "codereview.stackexchange", "id": 8744, "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, performance, random", "url": null }
forces, pressure, velocity I could not therefore understand why in the war, sandbags are used to block bullets? My teacher also disagreed with me by raising the fact that sand is highly compact and it is thus very hard for a bullet to penetrate. I would like to ask, is my idea correct? When you hit sand, the sand has time to move out of the way. It behaves like a fluid in that regard - dipping your finger in water isn't painful. But doing a belly-flop off the high dive into the water is extremely painful, the reason being that the water has no time to get out of the way, so it behaves more like a solid.
{ "domain": "physics.stackexchange", "id": 51173, "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": "forces, pressure, velocity", "url": null }
strings, vba, interface Title: Representing Objects as strings in VBA I am working an a more meaningful way to print objects in VBA. The desired result should look something like this. Console.PrintLine List.Create(1, 2, 3) List(1, 2, 3) The concept is that objects implementing an IPrintable interface are printed as their ToString property. Primitive data types are printed as is Console.PrintLine "a" a And other objects are represented as "TypeName(&ObjPtr)" Console.PrintLine New Collection Collection(&150653720) But the issue that is gunking up my design is that I want nested objects to represent themselves Console.PrintLine List.Create(1, List.Create(), New Collection) List(1, List(), Collection(&150653384)) My solution is to use an auxiliary helper methods, located in a standard module called cast, which in a way provides a default implementation of IPrintable Public Function ToString(ByVal x As Variant) As String Dim result As String
{ "domain": "codereview.stackexchange", "id": 12211, "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": "strings, vba, interface", "url": null }
imu, ros-melodic, transform, quaternion Title: MSG to TF : Quaternion Not Properly Normalized Thank you for clicking, hello, I'm ros begginer. I am currently using IMU for Slam mapping. But I get the ERR MSG(MSG to TF : Quaternion Not Properly Normalized). What should I do?? $ rostopic echo /imu_data header: seq: 122552 stamp: secs: 1626158167 nsecs: 547560799 frame_id: "imu_link" orientation: x: 126.18 y: -40.61 z: -174.65 w: -40.63 orientation_covariance: [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0] angular_velocity: x: 2.20086018676 y: 0.0 z: 0.0 angular_velocity_covariance: [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0] linear_acceleration: x: 0.0 y: 0.0 z: 0.0 linear_acceleration_covariance: [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0] Originally posted by jjb1220 on ROS Answers with karma: 7 on 2021-07-13 Post score: 0 We see this in your rostopic echo output: orientation: x: 126.18 y: -40.61 z: -174.65 w: -40.63
{ "domain": "robotics.stackexchange", "id": 36695, "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": "imu, ros-melodic, transform, quaternion", "url": null }
computability That said, constructing an infinite non-recursive r.e. $A$ with $A<_mK$ is significantly easier than constructing one with $A<_T K$. The former was done by Post in 1944 who introduced the notions of creative and simple sets (each of which are necessarily non-recursive), proved that a simple set exists and that $K$ is creative, and proved that no creative set is $m$-reducibile to any simple set; the latter wasn't achieved until a decade later by Friedberg and Muchnik independently, and required a fundamentally new technique (the priority method).
{ "domain": "cs.stackexchange", "id": 17336, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "computability", "url": null }
linked-list, kotlin fun <T> print(node: Node<T>?){ if (node != null){ println("Node data:${node.data} previous:${node.previous?.data} next:${node.next?.data} random:${node.random?.data}") print(node.next) } } } Misplaced Responsibility: print() The class LinkedList (or data class Node, see below) should not print() functions. Calling print() functions is a separate responsibility and should be done elsewhere in the code: What if you want your program to support different output formats like JSON or XML and they shall be sent over the network? Of course, we don't prepare software for all what-ifs. But we do make the obvious "cuts" between responsibilities. To get a printable representation, extract the text used by the print() calls into a toString() method. Then call print(node) from main(). Avoid Feature Envy (from LinkedList on Node) Feature Envy is a special type of Misplaced Responsibility.
{ "domain": "codereview.stackexchange", "id": 38677, "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": "linked-list, kotlin", "url": null }
around 10 bits. i'm pretty sure it should work on brushless dc motors. The general sine and cosine graphs will be illustrated and applied. The differentiated peak positive and negative output voltage was recorded and monitored on Ch. Since the IIR filter is unstable, an input is not required to produce an output. If you know the Y value is zero at time zero, then constrain PhaseShift to a constant value of zero. This parameter cannot be changed while a simulation is running. 11 the answer is 0. Sine wave generator. Resolution is around 10 bits. The equation for the sine wave assumes that the wave. That is, we wish to show that given E1 = E10 sinωt, (1) E2 = E20 sin(ωt+δ), (2) the sum Eθ ≡ E1 +E2 can be written in the form:. 1 by vegaseat import math import wave import struct def make_soundfile(freq=440, data_size=10000, fname="test. Adjustable High Low Frequency Sine Wave Generator. Wave form The wave form: a sine wave, square wave, or sawtooth wave. using Equation 1. Like any well
{ "domain": "keduku.fr", "id": null, "lm_label": "1. Yes\n2. Yes", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.9559813476288301, "lm_q1q2_score": 0.8047696224185478, "lm_q2_score": 0.8418256532040708, "openwebmath_perplexity": 940.2265415389599, "openwebmath_score": 0.6763566732406616, "tags": null, "url": "http://hzpj.keduku.fr/sine-wave-equation-generator.html" }
physical-chemistry, fluorescence Title: Deriving fluorescence intensity equations I've been having trouble with deriving the equations in the following problem.
{ "domain": "chemistry.stackexchange", "id": 13679, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "physical-chemistry, fluorescence", "url": null }
Then $p=\frac66\frac16\frac16=\frac1{36}$ and $q=\frac66\frac56\frac46=\frac{20}{36}$. The probability of winning will take the shape:$$p+(1-p-q)\times\cdots+q\times\cdots=\frac1{36}\times\cdots+\frac{15}{36}\times\cdots+\frac{20}{36}\times\cdots$$ Can you fill in $\cdots$ yourself? $$\frac1{36}+\frac{15}{36}\left[\frac16+\frac56\frac16\right]+\frac{20}{36}\left[\frac1{36}+\frac{15}{36}\frac16+\frac{20}{36}\frac1{36}\right]$$ • Thank you drhab, the way that you explain the answer is much better than I used! – YOUSEFY Aug 24 '17 at 19:32 • You are very welcome – drhab Aug 24 '17 at 19:41 Tree: Round1 - All three Match $\frac{1}{36}$ - Win Round1 - Two match $\frac{15}{36}$ - Round 2 - All three match $\frac{1}{6}$-Win Round1 - Two match $\frac{15}{36}$ - Round2 - Two Still match$\frac{15}{36}$ - Round 3 - All three match $\frac{1}{6}$ - Win Round1 - All three don't match $\frac{20}{36}$ - Round2 Roll all three - all three match $\frac{1}{36}$.
{ "domain": "stackexchange.com", "id": null, "lm_label": "1. YES\n2. YES", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.9728307653134903, "lm_q1q2_score": 0.8209671241915059, "lm_q2_score": 0.8438951084436077, "openwebmath_perplexity": 847.8593234342202, "openwebmath_score": 0.5194849371910095, "tags": null, "url": "https://math.stackexchange.com/questions/2404451/find-the-probability-that-a-player-wins-the-following-game" }
newtonian-gravity, planets Title: How big can a cube-shaped planet be? There can be small cube planets or asteroids, but as they get bigger, the gravitational force compresses them to a sphere. But what is the maximum size? It depends what you consider a cube or a sphere. Is the Earth a sphere or do the mountains make it something else?
{ "domain": "physics.stackexchange", "id": 16828, "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-gravity, planets", "url": null }
c++, iterator, unicode More like this: char convertChar (char c) { switch(x) { case '"': case '\\': case '/': return x; case 'b': return '\b'; case 'f': return '\f'; case 'n': return '\n'; case 'r': return '\r'; case 't': return '\t'; } } Then, you can change the switch statement like this: if (x == 'u') { unicodeCount = 4; unicodeValue = 0; } else { cont.push_back(convertChar(x)); } Further down, you could reuse that again: switch(next) { case '"': case '\\': case '/': case 'b': case 'f': case 'n': case 'r': case 't': cont[0] = convertChar(next); break; case 'u': decodeUnicode(); break; default: cont[0] = next; break; } Otherwise, it looks good to me.
{ "domain": "codereview.stackexchange", "id": 12001, "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++, iterator, unicode", "url": null }
everyday-chemistry, analytical-chemistry, safety, elemental-analysis Cold Vapor Atomic Absorption Spectroscopy (CVAAS) In mercury CVAAS, a light source of known wavelength and intensity (~254 $\mathrm{nm}$, middle ultraviolet spectrum) is radiated through a sample of air where the light eventually encounters a detector. If mercury is present, electrons from within the mercury atoms will absorb some of this energy from the light source. The difference between the initial energy of the light source and the energy measured by the detector gives you an indirect measurement of how many mercury atoms were initially present. Atomic Fluorescence Spectroscopy (CVAFS)
{ "domain": "chemistry.stackexchange", "id": 7248, "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": "everyday-chemistry, analytical-chemistry, safety, elemental-analysis", "url": null }
ruby, ruby-on-rails, controller, active-record def self.assigned_default(page: 1) uncompleted.includes(executor: :profile).ordered.paginated(page: page) end Should I do something differently or is this okay? This is a good place to use scopes. http://edgeguides.rubyonrails.org/active_record_querying.html#scopes Scopes are just syntactic sugar for class methods that return relations. In this way they can always be chain-able. scope :ordered -> { order(deadline: 'DESC') } scope :paginated -> (page: 1) { paginate(page: page, per_page: pagination_per_page) } scope :assigned_default -> (page: 1) { uncompleted.includes(executor: :profile).ordered.paginated(page: page) }
{ "domain": "codereview.stackexchange", "id": 20495, "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": "ruby, ruby-on-rails, controller, active-record", "url": null }
functional-programming, matrices, linked-lists A Quick Implementation So for concatenation, we need to keep track of the lengths. We can do so by using a language that supports dependent types, such as Idris or Agda. Haskell can mimic them, but a difficult task onto itself. So here's a naive implementation in Agda. data Matrix (A : Set) : (rows columns : ℕ) → Set where ∣_∣ : A → Matrix A 1 1 _Φ_ : ∀ {r c₁ c₂} → Matrix A r c₁ → Matrix A r c₂ → Matrix A r (c₁ + c₂) _⊝_ : ∀ {c r₁ r₂} → Matrix A r₁ c → Matrix A r₂ c → Matrix A (r₁ + r₂) c
{ "domain": "cs.stackexchange", "id": 6585, "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": "functional-programming, matrices, linked-lists", "url": null }
embedded-systems Image is from ASF Wizard documentation. For viewing changes before you upgrade the ASF version, I think the release notes for a given ASF release are your only resource. They're admittedly not very complete, but I can't find any other documentation about them. I don't know of any way to cherry-pick different sections of an ASF release. I don't think this is a great idea anyway, unless you're willing to wade through a lot of dependencies. Not all components of the ASF are direct windows between your software and the hardware; some of it is middleware that other components of the same ASF release may rely on. By picking and choosing which aspects of the ASF to update, you risks losing APIs, structure definitions, and other code that you may need in a non-obvious way. Last note: the only ASF git repository I can find is here: https://spaces.atmel.com/gf/project/asf/scmgit/. Unfortunately, it doesn't appear to have been updated since 2012. I can't find any more up-to-date repositories.
{ "domain": "engineering.stackexchange", "id": 373, "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": "embedded-systems", "url": null }
5 67 3 [2, 3, 2] [1, 5, 1] 5 98 3 [3, 4, 3] [2, 4, 2] 5 104 3 [4, 0, 4] [2, 5, 2] 6 92 3 [2, 3, 2] [1, 6, 1] 6 135 3 [3, 4, 3] [2, 5, 2] 6 178 3 [4, 5, 4] [3, 4, 3] 6 185 3 [5, 0, 5] [3, 5, 3] 7 121 3 [2, 3, 2] [1, 7, 1] 7 178 3 [3, 4, 3] [2, 6, 2] 7 235 3 [4, 5, 4] [3, 5, 3] 7 292 3 [5, 6, 5] [4, 4, 4] 7 300 3 [6, 0, 6] [4, 5, 4] Same pattern holds for all $$n\gt3$$, as observed. First column is the base $$b=n+1$$, second is the number, third are the digits, and last two are number representations in number bases $$(n+1,n+2)$$. The solutions for $$n=2,3$$ which are not included in $$P_3(n)$$ are $$10, 46$$ ; Where number bases $$(2,3)$$, the $$n=1$$ case, has no solutions. ## $$5,7,9\dots$$ digit pattern? I've found patterns for $$5,7,9,\dots$$ digits to be similar among themselves but not so simple as the three digit one, as they seem to be more unpredictable with more digits. Can we define a function / algorithm to generate all the solutions for some $$P_d(n)$$?
{ "domain": "stackexchange.com", "id": null, "lm_label": "1. YES\n2. YES", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.9715639653084244, "lm_q1q2_score": 0.8238549140504406, "lm_q2_score": 0.8479677545357569, "openwebmath_perplexity": 415.7623864800823, "openwebmath_score": 0.7537059187889099, "tags": null, "url": "https://math.stackexchange.com/questions/2516564/find-palindromes-in-two-consecutive-number-bases" }
performance, php, comparative-review, regex, dom Solutions I've come up with a 2 solutions by myself. It works fine, but I don't know which one is good for my case. Regex pattern $el = 'li'; // Ex $match = []; // Reserving for results /** * Regex - extract HTML tag and its content * Array map: * x[0] = everything * x[1] = open tag * x[2] = attributes * x[3] = content & end tag * x[4] = content only * * Note for content: including text node + children node */ $reg = '/(<'.$el.'(.*?)>)((\n*?.*?\n*?)<\/'.$el.'>|)/'; if (preg_match($reg, $html_str, $match)) { echo 'Moving onward!';} Result: see demo of regex DOM object $dom = new DomDocument(); $content = mb_convert_encoding( get_the_content(null, true), # WordPress func, it gives input str 'HTML-ENTITIES', 'UTF-8' ); $dom->loadHTML($content); $el = $doc->getElementsByTagName('li');
{ "domain": "codereview.stackexchange", "id": 35615, "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, comparative-review, regex, dom", "url": null }
virology, rna-interference Title: Transposons, Viruses and RNA interference My textbook says that in RNAi, a complementary double stranded RNA sequence attaches to an mRNA and silences it using a protein machinery. I Googled and read about this so now I know what siRNA and RISC and microRNA are. But the next thing my book says is “the source of these complementary double stranded RNA sequence [obviously my textbook means siRNA] may be viruses and transposable elements.”
{ "domain": "biology.stackexchange", "id": 7825, "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": "virology, rna-interference", "url": null }
# Throwing a dice and add the digit that appears to a sum and stopping when sum $\geq 100$. You keep on throwing a dice and add the digit that appears to a sum. You stop when sum $$\ge 100$$. What’s the most frequently appearing digit in all such cases? $$1$$ or $$6$$? I believe the probability of $$1$$ and $$6$$ should be equal as the whatever the number of rolls, the probability of getting a number should not be affected. However I don't have a formal proof for it and am not sure if this is right.
{ "domain": "stackexchange.com", "id": null, "lm_label": "1. YES\n2. YES", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.9740426405416754, "lm_q1q2_score": 0.8610919548465491, "lm_q2_score": 0.8840392802184581, "openwebmath_perplexity": 308.4409610065867, "openwebmath_score": 0.770578145980835, "tags": null, "url": "https://math.stackexchange.com/questions/3750188/throwing-a-dice-and-add-the-digit-that-appears-to-a-sum-and-stopping-when-sum?noredirect=1" }
Those were my thoughts on the problem, I'm not sure if they are right, but I got stuck trying to prove them. ### Proof of when $b=0, x_{n+1}=0$ for all n, which will imply that $\lim\ x_n=0$: This can be proved by induction (but I'm not sure how to do it properly):$$x_0=0=0$$$$x_{0+1}=x_1=\frac{0^2+0}{2}=0$$ $x_{n+1}=>x_{n+2}$ $$x_{n+2}=x_{(n+1)+1}=\frac{(x_{n+1})^2+b}{2}=\frac{(x_{n+1})^2}{2}=\frac{0}{2}=0$$ I really don't know if that is how you do the induction. Any help? ### Proof of $0<b\leq1$ When $b=1$, $x_{n+1}=\frac{(x_n)^2+1}{2}=\frac{(x_n)^2}{2}+\frac{1}{2}$. I can't really explain this besides saying that $\frac{(x_n)^2}{2}$ seems to be tending to $0$. Is this correct, and can I have a hint at how to solve it? I'm thinking I may be able to split it into 2 limits, saying $\lim \frac{(x_n)^2}{2}+\lim\ (b/2)=0+(b/2)$. Thanks for any help!
{ "domain": "stackexchange.com", "id": null, "lm_label": "1. YES\n2. YES", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.9790357579585026, "lm_q1q2_score": 0.8360111229562779, "lm_q2_score": 0.8539127566694178, "openwebmath_perplexity": 136.96539233648303, "openwebmath_score": 0.9740416407585144, "tags": null, "url": "http://math.stackexchange.com/questions/332390/how-do-i-compute-the-limit-of-this-sequence-x-n1-fracx-n2b2-x-o" }
swift, tic-tac-toe Assuming that the makeMove() action is connected to buttons only, you should declare it as @IBAction func makeMove(sender: UIButton) { ... } this allows better error checking than sender : AnyObject. (When you create the action in interface builder, there is an option for that.) Using all the above stuff, the makeMove() method becomes @IBAction func makeMove(sender: UIButton) { let space = sender.tag if (board[space] == nil && !gameOver) { sender.setImage(currentPlayer.image(), forState: .Normal) board[space] = currentPlayer turnCount++ if let winner = checkForWinner() { gameOver = true gameResult.text = "\(winner) is the winner!" } else if (turnCount == 9) { gameOver = true gameResult.text = "It's a tie!" } else { currentPlayer = currentPlayer.other() } } }
{ "domain": "codereview.stackexchange", "id": 18097, "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": "swift, tic-tac-toe", "url": null }
ros Unable to load msg [beginner_tutorials/Num]: Cannot locate message [Num]: unknown package [beginner_tutorials] on search path [{'rosconsole': ['/opt/ros/indigo/share/rosconsole/msg'], 'catkin': ['/opt/ros/indigo/share/catkin/msg'], 'angles': ['/opt/ros/indigo/share/angles/msg'], 'image_view': ['/opt/ros/indigo/share/image_view/msg'], 'carrot_planner': ['/opt/ros/indigo/share/carrot_planner/msg'], 'urdf': ['/opt/ros/indigo/share/urdf/msg'], 'rosgraph': ['/opt/ros/indigo/share/rosgraph/msg'], 'rqt_py_console': ['/opt/ros/indigo/share/rqt_py_console/msg'], 'nodelet_topic_tools': ['/opt/ros/indigo/share/nodelet_topic_tools/msg'], 'rqt_graph': ['/opt/ros/indigo/share/rqt_graph/msg'], 'rotate_recovery': ['/opt/ros/indigo/share/rotate_recovery/msg'], 'theora_image_transport': ['/opt/ros/indigo/share/theora_image_transport/msg'], 'rocon_python_comms': ['/opt/ros/indigo/share/rocon_python_comms/msg'], 'qt_gui': ['/opt/ros/indigo/share/qt_gui/msg'], 'filters':
{ "domain": "robotics.stackexchange", "id": 20759, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "ros", "url": null }
c# } else if (ActivityTypeID == 2 || ActivityTypeID == 5) { if (BusinessLayer.StatusLike_Table.GetByIsliked(SourceID, ID, 2) == 0) { BusinessLayer.PhotoStsLike_Table nl = new BusinessLayer.PhotoStsLike_Table(); nl.Id = Convert.ToInt32(Session["ID"].ToString()); nl.Photostsid = SourceID; nl.Photostslikedate = System.DateTime.Now; nl.Save(); numberoflike.Text = BusinessLayer.PhotoStsLike_Table.GetByNumberOFlike(Convert.ToInt32(SourceID)).ToString(); } } } catch (Exception ee) { } }
{ "domain": "codereview.stackexchange", "id": 9227, "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#", "url": null }
of 4, because 2×2=4. once you have an equation contained in one in each of those ax² + bx + c = 0 (the place x is your variable, a,b,and c are rational constants, and a isn't 0), the discriminate is b² - 4ac. A square root of a number is a number that, when it is multiplied by itself (squared), gives the first number again. rational, integer, whole, real, or irrational? In equation format: n √ a = b b n = a. Estimating a Root. While numbers like pi and the square root of two are irrational numbers, rational numbers are zero, whole numbers, fractions and decimals. a,b > 0. 2 Answers George C. Nov 13, 2015 #1.5# Explanation: #15^2 = 225#, so #2.25 = 225/100 = 225/(10^2)# and #sqrt(2.25) = … Pull terms out from under the radical, assuming positive real numbers. How will understanding of attitudes and predisposition enhance teaching? The Real Number System. If a number is a perfect square, then we can easily find its square root using prime factorisation method. Join Yahoo Answers and
{ "domain": "lamakinita.com", "id": null, "lm_label": "1. Yes\n2. Yes", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.9752018441287091, "lm_q1q2_score": 0.8018003584320269, "lm_q2_score": 0.8221891327004132, "openwebmath_perplexity": 472.8044874256721, "openwebmath_score": 0.7424460053443909, "tags": null, "url": "http://lamakinita.com/category/is-the-square-root-of-25-a-real-number-0fec40" }
hhl-algorithm, speedup, linear-algebra Title: HHL algorithm for linear systems with a real matrix and a real right side HHL algorithm can be used for solving linear system $A|x\rangle=|b\rangle$. If we put $|b\rangle$ (to be precise its normalized version) into the algorithm and measuring ancilla to be $|1\rangle$ we are left with the state $$ \sum_{i=1}^n \beta_i\frac{C}{\lambda_i}|x_i\rangle, $$ where $|x_i\rangle$ is ith eigenvector of matrix $A$, $\lambda_i$ is respecitve eigenvalue and $\beta_i = \langle b|x_i\rangle$ is ith coordinate of $|b\rangle$ in basis composed of eigenvectors of $A$. It is known that HHL brings exponential speed-up, however, to get whole state $|x\rangle$ we need to do a tomography which cancels the speed-up completely.
{ "domain": "quantumcomputing.stackexchange", "id": 2710, "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": "hhl-algorithm, speedup, linear-algebra", "url": null }
optics, reflection, geometry Notice that this means while the actual object is on the left of your real position, the virtual object is on the right of your virtual position. Where you need to look on the mirror is now a geometry problem. Draw this system with both the real and virtual points on the coordinate system, then draw a line straight from your real position to the virtual position of the object. Then draw a right triangle with this line being the hypotenuse, and the other side of it connecting to your real position perpendicularly. What we need to find is where on the x-axis the hypotenuse you drew is passing from, that's the point where you'll look to see the object. To find this point we use the following ratio; $$ \frac{2}{15} = \frac{d}{6} $$
{ "domain": "physics.stackexchange", "id": 68875, "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": "optics, reflection, geometry", "url": null }
newtonian-mechanics, forces, work, rocket-science, distance At low speeds most of the fuel’s energy is “wasted” in the KE of the exhaust. At higher speeds more goes into the rocket and less into the exhaust. For a real rocket, the same thing happens on a continuous basis. Both energy and momentum are conserved, and in fact more power is delivered to the vehicle as the speed increases under constant thrust.
{ "domain": "physics.stackexchange", "id": 51789, "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, work, rocket-science, distance", "url": null }
Algebraic Approach $\tan\theta = \dfrac{4}{3} \Rightarrow\\ \dfrac{\sin\theta}{\cos\theta} = \dfrac{4}{3} \Rightarrow\\ \cos\theta = \dfrac{3}{4}\sin\theta$ Now, $\cos^2\theta + \sin^2\theta = 1 \Rightarrow\\ \dfrac{9}{16}\sin^2\theta + \sin^2\theta = 1 \Rightarrow\\ \sin^2\theta = \dfrac{16}{25} \Rightarrow\\ \sin\theta = \pm \dfrac{4}{5}$ Then $\cos\theta = \dfrac{\sin\theta}{\tan\theta} = \pm\dfrac{3}{5}$ (with respective signs). Thus $$\boxed{ \begin{matrix} \sin\theta = \dfrac{4}{5},\ \cos\theta = \dfrac{3}{5}\\ \text{or}\\ \sin\theta = -\dfrac{4}{5},\ \cos\theta = -\dfrac{3}{5} \end{matrix} }$$ • This approach does not deal with the possibility that $\theta$ may not be in $[0,\pi/2]$ – 5xum Jun 9, 2014 at 8:22 • @5xum Fixed, I think? Jun 9, 2014 at 8:43 • I agree. Just fix the last value of $\cos \theta$ to $-\frac35$. – 5xum Jun 9, 2014 at 8:45 • Damn sign. Thanks, @5xum! Jun 9, 2014 at 8:49
{ "domain": "stackexchange.com", "id": null, "lm_label": "1. YES\n2. YES", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.9838471632833944, "lm_q1q2_score": 0.8240900168589559, "lm_q2_score": 0.8376199552262967, "openwebmath_perplexity": 454.80773401897204, "openwebmath_score": 0.8197816014289856, "tags": null, "url": "https://math.stackexchange.com/questions/827648/trigonometry-tan-theta-dfrac43/827657" }
• This argument should be rewritten more carefully; it is right in concept but needs work on the details. Oct 11, 2020 at 15:23 Would you like an elementary proof ? By this, I mean a calculus proof, one which does not invoque Hahn-Banach (Farkas Lemma involves HB). Let $$P$$ be the orthogonal projector over $$F$$, and $$K$$ be the cone of non-negative vectors. Denote $$S$$ the unit sphere. The continuous function $$x\mapsto\|Px\|$$ achieves its maximum over the non-void compact subset $$S\cap K$$, at some vector $$a$$. It amounts to saying that $$a$$ maximizes $$f(x):=\frac{\|Px\|^2}{\|x\|^2}$$ over $$K\setminus\{0\}$$. Comparing $$f(a)$$ with $$f(a+t\vec e_i)$$, we find that $$\partial_{x_i}f(a)$$ vanishes if $$a_i>0$$, and is $$\le0$$ if $$a_i=0$$. This gives either $$(Pa)_i=\lambda^2a_i$$, where $$\lambda=\|Pa\|/\|a\|\le1$$, or $$(Pa)_i\le0$$. We infer that the vector $$b:=a-Pa$$ belongs to $$K\cap F^\bot$$.
{ "domain": "mathoverflow.net", "id": null, "lm_label": "1. Yes\n2. Yes", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.9825575152637946, "lm_q1q2_score": 0.8166458540968912, "lm_q2_score": 0.831143054132195, "openwebmath_perplexity": 308.9528301418037, "openwebmath_score": 0.9482479691505432, "tags": null, "url": "https://mathoverflow.net/questions/373820/existence-of-a-non-null-and-non-negative-vector-in-f-cup-f-perp" }
newtonian-gravity, coordinate-systems, integration, tidal-effect Evaluating the integrals gives $F = \frac{3GM}{4\pi R^3} \times R \times 2 \times 2\pi$, which simplifes to $F = \frac{3GM}{R^2}$ However, my lecturer gives this force as $\frac{GM}{R^2}$ without explanation. I already tried googling it, but all I can find is things about self gravitational potential energy, which I've gathered is something else. So, can someone see where I'm getting an extra factor of 3? And if I'm going about this entirely the wrong way, can someone point we in the right way of a correct derivation? If anyone is wondering about the context, I want to calculate this force because I want to balance it with tidal forces. I was looking for the surface gravity, which is indeed just given by $\frac{GM}{R^2}$. My integration was nonsense as I did not consider the direction of the gravitational forces, only the magnitude.
{ "domain": "physics.stackexchange", "id": 65011, "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-gravity, coordinate-systems, integration, tidal-effect", "url": null }
newtonian-mechanics, resource-recommendations, computational-physics, simulations The approach used in this book is to introduce a topic in physics and to describe problems under the topics. An approach to solving these problems is presented and the author starts introducing computer codes to help. The explanations are not always the best but it does introduce many topics in each chapter and would supplement courses you've had or are taking In many cases the author presents a topic and works through it building up his computer codes in subsequent sections, introducing issues one may encounter on a given topic. The codes are listed line by line in the book. The book covers topics in
{ "domain": "physics.stackexchange", "id": 62657, "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, resource-recommendations, computational-physics, simulations", "url": null }
c++, asynchronous, socket, boost, client You should instead throw a type that inherits from std::exception. In this case, either throw a std::runtime_error, or if you wish some custom type that inherits from that. Avoid using std::endl Prefer using "\n" instead of std::endl; the latter is equivalent to the former, but also forces a flush of the output stream, which is usually not necessary and might be bad for performance.
{ "domain": "codereview.stackexchange", "id": 39435, "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++, asynchronous, socket, boost, client", "url": null }
performance, programming-challenge, haskell elem is an O(n) operation. You're calling it for each of the n elements in your input list, meaning that your function is at least O(n^2) (and it turns out that this is the final complexity). I checked the number of iterations required for my sample input and it took 142991 iterations to find a repeated frequency. An O(n^2) runtime is going to require about 10 billion iterations for the lookups alone. Ouch. Second is a more insidious mistake that is easy to overlook. In this line, else let f = acc ++ [next] Appending to a list is an O(n) operation. Lists in Haskell are implemented as linked lists, and appending to the back of one cannot be amortized to O(1) like one might in Python's list or Java's ArrayList. You need to travel all the way to the back to add in a link. Fixing the second issue actually isn't very hard since you don't care about the ordering of the list. You can switch it to else let f = next : acc
{ "domain": "codereview.stackexchange", "id": 32765, "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, programming-challenge, haskell", "url": null }
quantum-mechanics, quantum-field-theory The intensity is the number of photons, while the the energy $E=hf$ is the energy of one photon. To our question, if one also can eject an electron by using photons whose energies as their owns are enough to eject the electron but their total energy (sum of all) would be enough: Yes this is possible, but more unlikely to happen and only possible for certain energies-configurations of the photons depending on the atom you are looking at. Say you consider the H-Atom and say the electron is in the ground state and we neclegt special relativity and so on... Then the energy of the electron for all bounded states (labelled by n) is $E_n=-\frac{13,6}{n^2}ev$. If the electron is in the ground state (n=1), the energy is -13.6ev. So you can hit the atom with an photon of having this energy or more to eject the electron (ejecting means the electron can get a positive energy). That's clear. But you could also hit it with an photon with energy
{ "domain": "physics.stackexchange", "id": 74419, "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, quantum-field-theory", "url": null }
r, ggplot2 Title: Density plot, scale it to 0-1 Doubt regarding density plot what is the scale being plotted in the Y axis.Is it possible to scale it to 1?. This is my code w <- read.csv("Normal_Myeloid_Dev_stages/Myeloid_non_coding_non_CDS_CORRVALUE.txt",header = TRUE) head(w) #names(w)[1] = "Sample" head(w) #w.plot <- melt(w) df <- w df_melt=melt(df,id.vars="Sample") #head(df_melt) tail(df_melt) df_melt$Group <- gsub('[0-9]', '',df_melt$variable) head(df_melt) p1 <- ggplot(aes(x=value, colour=Group), data=df_melt) p1 + geom_density()
{ "domain": "bioinformatics.stackexchange", "id": 1204, "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": "r, ggplot2", "url": null }
newtonian-mechanics, reference-frames, inertial-frames, time-reversal-symmetry, galilean-relativity Title: Why isn't time reversal a Galilean transformation? I'm a mathematician learning physics from scratch, starting from Newtonian mechanics. As far as I understand, Galilean transformations are defined as transformations of space-time that transform from one inertial frame to another. In turn, an inertial frame is a frame of reference in which Newton's first law holds: a body not acted upon by any force will move in linear motion. From those two definitions, it seems like Galilean transformations should be all transformations of space-time that preserve linear motion. However, Galilean transformations are then described as compositions of:
{ "domain": "physics.stackexchange", "id": 82079, "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, reference-frames, inertial-frames, time-reversal-symmetry, galilean-relativity", "url": null }
electric-circuits, electricity, electric-current, voltage CAPACITOR: Mathematical Explanation: The basic relationship between current and voltage for a capacitor is $$i(t)=C\frac{dv(t)}{dt}$$ In your diagram, the voltage is a sine wave. The derivative of the sine is the cosine, which is your current waveform. Physical Explanation: The previous equation can be rewritten: $$v(t)=\frac{1}{C}\int_0^t i(t)dt$$ Where the initial voltage across the capacitor is zero. The relationship between voltage, charge and capacitance is $$V=\frac{Q}{C}$$ Since current is the rate of delivery of charge to the capacitor, the integral tells us it takes time to deliver that charge to the capacitor which in turn means it takes time for voltage to build on the capacitor. It is therefore said you can't change the voltage across an ideal capacitor instantaneously (i.e., in zero time). So while we initially have current at t=0 we have no voltage at t=0.
{ "domain": "physics.stackexchange", "id": 63157, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "electric-circuits, electricity, electric-current, voltage", "url": null }
python, python-2.x, caesar-cipher #If they choose Decrypt: elif ans == "d": #Get users input to decipher print "What is the message you would like to decrypt?" plainText = get_user_input(plainText) #Translate it using Caesar Cipher #Very similar to the code for encrypting for word in plainText.split(): newWord= "" for char in word: if char in alphabet: pos = alphabet.index(char) #This time it subtracts the length of the word from the position #%26 is so that any word "below 'a'" goes to the end of the alphabet newPos = ((pos - len(word))%26) newChar = alphabet[newPos] newWord += newChar else: newWord += char cipherText += newWord + " " #Print out the Translation line_break(20) print "%r turns into:\n%r" % (plainText, cipherText)
{ "domain": "codereview.stackexchange", "id": 15832, "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-2.x, caesar-cipher", "url": null }
control, robotic-arm, dynamics, matlab, input %% Assign Outputs qDdot = M\(-C*qDot-G+F); varDot = [... qDot; ... qDdot; ... F]; Then, the script that solves the ODE: . clear all; close all; clc; % Compare the all-in-one method of solving the problem with the segmented % method of solving the problem by setting the variable below equal to % "true" or "false". segmentSolution = true; t0 = 0;tf = 20; % Your initial conditions here for x- and y-positions were not zero, so I % set them to zero to reproduce Figure 2 and Figure 3 in the paper you % linked. % Also - you don't ever use the last 4 values of this except as a way to % output the force. This isn't used in the segmentSolution because there % the input force is supplied to the function. x0 = [0 0 0 0, 0 0 0 0,0 0 0 0]; % Initial Conditions %% Specifications Mp = [0.1 0.5 1]; % Variable mass for the payload figure plotStyle = {'b-','k','r'};
{ "domain": "robotics.stackexchange", "id": 1064, "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": "control, robotic-arm, dynamics, matlab, input", "url": null }
neutrons Title: Why fast neutrons for breeder reactor but slow neutrons for regular light water reactor? Water is used as a moderator to slow down neutrons in a light water nuclear reactor. By slowing down the neutrons they have more of a window to strike fission ready nuclei thus promoting the self perpetuating chain reaction when more neutrons are released from the fissions and slowed neutrons. All fine and good so far. I got it. Now, what I don't get is why fast neutrons are needed for the breeder nuclear reactor.
{ "domain": "physics.stackexchange", "id": 43417, "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": "neutrons", "url": null }
ros, laser, scan, ros-indigo Originally posted by dljubic with karma: 516 on 2018-03-17 This answer was ACCEPTED on the original site Post score: 0 Original comments Comment by EGYRos on 2018-03-18: Hello dljubic Ya i get it , thanks a lot it is very useful. Comment by dljubic on 2018-03-19: No problem, I am glad to help! :) Please mark the answer as correct if it solved your problem.
{ "domain": "robotics.stackexchange", "id": 30346, "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, laser, scan, ros-indigo", "url": null }
electrostatics, electric-fields, charge, gauss-law $$ R = \sqrt{D^2 + z^2} = \frac{D}{\cos \phi} $$ Where $\phi$ is the angle between the lines $R$ and $D$, similar to how $\theta$ is the angle for the image about (just extrapolate to 3D). Moreover, the surface charge of the sheet is now given by: $$ \lambda = \sigma dz = \sigma D d\phi $$ $$ \hat{\mathbf{r'}} = \cos \phi \; \hat{\mathbf{x}} $$ Note that the second equation might not make a lot of sense at first; however it is similar to our previous transformation ($ \hat{\mathbf{x}} = \cos \theta \; \hat{\mathbf{r}}$) execpt that the direction is a new offset from $\hat{\mathbf{r'}}$. If we take the answer for the electric field via a line of charge and put it into a differential form: $$ d\vec{E_{r'}} = \frac{1}{4\pi\epsilon_0} \frac{2\lambda}{R} \;\hat{\mathbf{r'}} $$ Subsituting: $$ d\vec{E_x} = \frac{1}{4\pi\epsilon_0} \frac{2 \sigma D }{D} \frac{\cos \phi}{\cos \phi} d\phi \;\hat{\mathbf{x}} $$ $$ = \frac{1}{4\pi\epsilon_0} \left( 2 \sigma \right) d\phi \;\hat{\mathbf{x}} $$
{ "domain": "physics.stackexchange", "id": 81907, "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, charge, gauss-law", "url": null }
algorithms, linear-algebra Title: Complexity of finding the pseudoinverse matrix How many arithmetic operations are required to find a Moore–Penrose pseudoinverse matrix of a arbitrary field?
{ "domain": "cs.stackexchange", "id": 2738, "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, linear-algebra", "url": null }
How do he obtain ##x^{-4}y = x e^x - e^x + c## or ##y = x^5e^x - x^4e^x + cx^4.## ????????????? Mark44 Mentor How do he obtain ##x^{-4}y = x e^x - e^x + c## or ##y = x^5e^x - x^4e^x + cx^4.## The whole point of getting an integrating factor is to be able to write one side of the differential equation as the derivative of something. After one step in the first part of your post you have y' - (4/x)y = x5ex In the later work an integrating factor of x-4 was found. Multiplying through by the integrating factor yields this equation: x-4y' - 4x-5y = xex The left side of the equation above is the derivative of x-4y, so d/dx(x-4y) = xex or x-4y = ##\int xe^x dx## Finally, integrate the right hand side, and then multiply both sides by x+4 to get y in terms of x alone. How to differentiate ##x^{-4}y## or ##\frac{d}{dx}(x^{-4}y)## ???? ehild Homework Helper How do you differentiate a product? Keep in mind that y is a function of x. You need to get ##\frac{d}{dx}(x^{-4}y(x))##
{ "domain": "physicsforums.com", "id": null, "lm_label": "1. YES\n2. YES", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.9496693702514737, "lm_q1q2_score": 0.8052890052678761, "lm_q2_score": 0.8479677564567913, "openwebmath_perplexity": 3037.2588918330002, "openwebmath_score": 0.9245595335960388, "tags": null, "url": "https://www.physicsforums.com/threads/integration-de.786515/" }
transmon, dilution-refrigerator Longer/more detailed answer with a concrete example: Of course to have a superconducting qubit, we need the material they are built in to be superconducting, which means that for ambient pressure, its temperature should be low. However the temperature at which superconductivity is lost is usually much higher than the typical temperature of a transmon qubit (which is around $10mK$). I explain why in what follows. If you want to drive transmon qubits, you send microwave signals that interact with the qubit. If the waveguide in which these microwaves travel contains "undesired signal" (i.e. noise), the quantum gate you will implement on your qubit will be noisy: you don't want that. Putting the qubit at low temperature can suppress this noise.
{ "domain": "quantumcomputing.stackexchange", "id": 5047, "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": "transmon, dilution-refrigerator", "url": null }
sql, mysql, oracle Title: Out of one Oracle into another A project that I have been working on required data to be transferred from an Oracle database into MySQL. The process I devised for that transfer involved a query (included below) on the Oracle source database to make it dump out the schema for the relevant tables to be replicated, in the form of CREATE TABLE statements to be executed in the MySQL destination database. I'm also exporting the column names, parameter placeholders (a string of ?, ?, ?, …, ?, with as many symbols as columns), and mysqli type codes in preparation for the next step, which is to allow each row to be INSERTed using mysqli. I'm not particularly concerned about preserving constraints and foreign key relationships. Just enforcing the primary keys should suffice. WITH constraints AS ( SELECT cols.*, cons.constraint_type FROM all_constraints cons INNER JOIN all_cons_columns cols ON cols.constraint_name = cons.constraint_name
{ "domain": "codereview.stackexchange", "id": 10324, "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, mysql, oracle", "url": null }
python, pyqt My question mainly aims at finding a better data structure, but every little improvement is appreciated. Note that I intentionally didn't follow PEP8 there, because PyQt's naming convention is against that, and I'd rather keep the code coherent. Basically you can load any x-y dataset from a txt file which looks like this: 1,1 2,4 3,9 4,16 .. Here is an example dataset you can load. I do not have worked a lot with PyQt, but in most GUI libraries tree-view-items have facilities to store userdata. For QTreeWidgetItem you can use the data and setData methods. It might conflict with the MVC-pattern but practicality beats purity. My revised logic.py with self.xData and self.yData removed and data stored in the GUI objects: import numpy as np from PyQt5 import QtWidgets from PyQt5.QtWidgets import QAbstractItemView, QFileDialog, QTreeWidgetItem from ui import Ui_SPP
{ "domain": "codereview.stackexchange", "id": 36848, "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, pyqt", "url": null }
backpropagation Title: Synthetic Gradients - what's the practical benefit? I can see two motives to use Synthetic Gradients in RNN: To speed up training, by imediately correcting each layer with predicted gradient To be able to learn longer sequences I see problems with both of them. Please note, I really like Synthetic Gradients and would like to implement them. But I need to understand where my trail of thought is incorrect. I will now show why Point 1 and Point 2 don't seem to be beneficial, and I need you to correct me, if they are actually beneficial:
{ "domain": "datascience.stackexchange", "id": 3193, "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": "backpropagation", "url": null }
python, object-oriented, python-3.x, console Don't use __repr__ for a human readable version of the object. That is what __str__ is for. When writing your own __rerp__ you should aim to make eval(repr(obj)) work. Rather than str.replace, you could str.format the values to the correct format. And so I'd change your Day.__repr__ to something more like: def __str__(self): return '\n'.join(' {!s}'.format(x) for x in self.lessons) Rather than making two near duplicate loops, you could abstract the logic into one function, get_input. You could also make it so that it shows the user what input they are allowed to pick. This could be implemented as: def get_input(question, valid): question += '[{}] '.format('/'.join(valid)) valid = set(valid) while True: answer = input(question).lower() if answer in valid: return answer
{ "domain": "codereview.stackexchange", "id": 27498, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "python, object-oriented, python-3.x, console", "url": null }
beginner, dart, flutter Title: Remove else-if statement from multi-conditional logic INTRODUCTION I am studying the book Five Lines of Code (2021) by Christian Clause. The book covers several techniques regarding refactoring legacy code. I am learning much and applying several of its refactoring patterns. The book gives rules that makes a lot of sense and I have been applying them to great success. RULE: NEVER USE IF WITH ELSE
{ "domain": "codereview.stackexchange", "id": 44808, "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, dart, flutter", "url": null }
I do not even know how to integrate this! Polar coordinate system really seems to be better in this case. Last edited: Oct 27, 2009 10. ### jdwood983 383 Not quite. The integral you need is given by $$I=\frac{m}{A}\int_{-R}^R\int_{-\sqrt{R^2-x^2}}^{\sqrt{R^2-x^2}}\left(x^2+y^2\right)dydx$$ $$I=\frac{m}{\pi R^2}\int_{-R}^R \frac{2\sqrt{R^2-x^2}\left(R^2+2x^2\right)}{3}dx$$ $$I=\frac{m}{\pi R^2}\cdot\frac{\pi R^4}{2}$$ $$I=\frac{mR^2}{2}$$ For most moment of inertia problems, spherical or cylindrical coordinates are the best. 11. ### soopo 226 How did you solve this part? It has taken my some effort in trying to solve it by hand. 12. ### jdwood983
{ "domain": "physicsforums.com", "id": null, "lm_label": "1. YES\n2. YES", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.9766692305124306, "lm_q1q2_score": 0.8502855543852338, "lm_q2_score": 0.8705972583359805, "openwebmath_perplexity": 1002.6747776149896, "openwebmath_score": 0.9997972846031189, "tags": null, "url": "https://www.physicsforums.com/threads/moment-of-inertia-of-a-disk-by-integration.349466/" }
Then $N = Tsin\frac{\Delta\phi}{2}$ and also $\Delta\phi = \frac{x}{R}$ where x is the rim corresponding to $\Delta\phi$. I guess now integrating, to find the whole normal force? Attached Files: • IMG_20140305_233811.jpg File size: 20.3 KB Views: 84 11. Mar 5, 2014 BvU Funny you should draw these T inward. The tensions ON this piece of chain add up to a force ON the disk that points inwards. The disk pushes back with an equal and opposite normal force that points outwards. The friction force is then a coefficient times this outward force, and it points upwards -- thus counteracting gravity which is pointing down. 12. Mar 5, 2014 Staff: Mentor
{ "domain": "physicsforums.com", "id": null, "lm_label": "1. YES\n2. YES", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.9518632343454895, "lm_q1q2_score": 0.8128081601816023, "lm_q2_score": 0.8539127585282745, "openwebmath_perplexity": 668.8752155842086, "openwebmath_score": 0.7448002099990845, "tags": null, "url": "https://www.physicsforums.com/threads/chain-and-spinning-disk-problem.741529/" }
We will also briefly present the (arithmetic) large sieve, which gives a rather different approach to Problem 3 in the case that each ${E_p}$ consists of some number (typically a large number) of residue classes modulo ${p}$, and is powered by the (analytic) large sieve inequality of the preceding section. As an application of these methods, we will utilise the Selberg upper bound sieve as an enveloping sieve to establish Zhang’s theorem on bounded gaps between primes. Finally, we give an informal discussion of the parity barrier which gives some heuristic limitations on what sieve theory is able to accomplish with regards to counting prime patters such as twin primes. These notes are only an introduction to the vast topic of sieve theory; more detailed discussion can be found in the Friedlander-Iwaniec text, in these lecture notes of Selberg, and in many further texts. — 1. Combinatorial sieving and the fundamental lemma of sieve theory —
{ "domain": "wordpress.com", "id": null, "lm_label": "1. YES\n2. YES", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.9886682444653242, "lm_q1q2_score": 0.8012947666000314, "lm_q2_score": 0.8104789155369048, "openwebmath_perplexity": 248.19796379327, "openwebmath_score": 0.9931489825248718, "tags": null, "url": "https://terrytao.wordpress.com/2015/01/21/254a-notes-4-some-sieve-theory/" }