Here is my JUnit code for a test case of the cube root method I created that implements Newton's method:  @Test public void standardCase_negative64e9() {   double n = -64E9;   double result = csc143.newton.Roots.cbrt(n);   double delta = n * 1E-8;   assertEquals("Standard cube root -64E9", -4.0E3, result, delta); }   When I do the tests for all my test cases (using DrJave IDE) I only get a failure for this test case, and it reads:  Failure: java.lang.AssertionError: Standard cube root -64E9 expected:&lt;-4000.0&gt; but was:&lt;-4000.0000000003124&gt;   I feel this has something to do with my "delta" value (which is -640 in this case) because when I replace "delta" with 640 (instead of -640) in the assertEquals() method, I do not get a failure...
public class doublePrecision {     public static void main(String[] args) {          double total = 0;         total += 5.6;         total += 5.8;         System.out.println(total);     } }   The above code prints:  11.399999999999   How would I get this to just print (or be able to use it as) 11.4?
How to find chromatic number of the $n$-dimensional hypercube $Q_n$? How are "related" questions selected? What is the best way to "carve" a terrain created from a heightmap? I have a 3d landscape created from a heightmap. I'd like to "carve" some holes in that terrain. That will allow me to create bridges, caverns and tunnels inside it.    That operation will be done in the game editor so it doesn't need to be realtime. In the end, rendering is done using traditional polygons.  What would be the best/easiest way to do that ? I already think about several solutions :  Solution 1  1) Create voxels from the heightmap (very easy). In other words, fill a 3D array like this : voxels[32][32][32] from the heightmap values.  2) Carve holes in the voxels as i want (easy too).  3) Convert voxels to polygons using some iso-surface extraction technique (like marching cubes).  4) Reduce (decimate) polygons created in 3).  This technique seems to be the most promising for giving good results (untested). However the problem with marching cubes is that they tends to produce lots of polygons thus reducing them is mandatory. Implementing 4) also seems not trivial, i have read several papers on the web and it seems pretty complex. I was also unable to find an example, code snippet or something to start writing an algorithm for triangle mesh decimation. Maybe there is a special decimation algorithm (simpler) for meshes created from marching cubes ?  Solution 2  1) Create some triangle mesh from the heighmap (easy).  2) Apply severals 3D boolean operation (eg: subtraction with a sphere) to carve the mesh.  3) apply some procedure to reduce polygons (optional).  Operation 2) seems to be very complex and to be honest i have no idea how to do that. Also applying many boolean operation seems to be slow and will maybe degrade the triangle mesh  every time a boolean operation is applied. Why can mathematical equations describe this world? Since I want to understand the world, I learn physics from textbooks. But I feel there is a gap between the textbook and the world. I do not know     why the equations in the textbook can control the whole world? How can I bridge the gap? In research, how can one distinguish whether what we do is meaningful in reality or not?   Any help or suggestions or comments will be appreciated. What are integers $x$ and $n$ such as $ x^4+x^3+x^2+x+1 = n^2$? What are the integer numbers $x$ such as $x^4+x^3+x^2+x+1$ is the square of an integer?  $0$ and $-1$ are obvious answers, but how many are there? When rolling percentages, do 1d100 and two d10s (percentiles) share the same probabilities? I know d100s are shunned because they take too much time to roll, and 1d10+1percentile is really fun, but do they share the same probabilities? Is it better to use a (digital) d100?  Also, do d100s have 0? You can't roll a 0 with percentiles, I think. What is a bus error? What does the "bus error" message mean, and how does it differ from a segfault? I'd like to loop though each feature in a layer and calculate its ellipsoidal area using QgsDistanceArea() in PyQGIS 3.  Everything works fine on unprojected layers, but I get strange results when input layer is in projected CRS.  So far I have written this:  from qgis.core import *  def calculate_area(in_lyr_name, ellipsoid, units):     input_layer = QgsProject.instance().mapLayersByName(input_lyr_name)[0]      area = QgsDistanceArea()     area.setEllipsoid(ellipsoid)      features = input_layer.getFeatures()     feature_area = 0     error_features_counter = 0      for i, feat in enumerate(features):         geom = feat.geometry()         polygon_area = 0         try:             if geom.isMultipart():                 polygons = geom.asMultiPolygon()                 for polygon in polygons:                     polygon_area += area.measurePolygon(polygon[0])             else:                 polygon = geom.asPolygon()                 polygon_area = area.measurePolygon(polygon[0])              feature_area += polygon_area          except AttributeError:  # catches NoneType geometries (broken etc.)             error_features_counter += 1             pass      # calculated area is in sq. metres (see the "else" case)     if units == 'km²':         final_area = feature_area / 1e6     elif units == 'Ha':         final_area = feature_area / 10000     else:         final_area = feature_area     return final area, error_features_counter   How do I get a constant result that does not depend on the presence of projection? Raise bounty on question How to make a bib entry appear also in the main document I have a reference which has a bib entry and appears in the bibliography. I want to be able to include the entire entry, exactly as it appears in the bibliography, somewhere else in the document.   Is there any way to do that other than to manually write it and format it to look similar? Some of the git commands have many options, and it would often be useful to search through them for the one I need - I was just looking for the option which controls the TAB width in git-gui, but there are about 200 completions for git config. An obvious workaround is to copy all the completions into an editor and search through them, but I'd rather do  [something] | grep tab   There are no man or info pages for compgen, help compgen doesn't even explain its own options, and there's no auto-complete for compgen (how's that for irony?).  PS:  doesn't work.  PPS: This is not a question about git-gui - The  was elsewhere.  PPPS: This is not about auto-completing commands, only command parameters. If $a,b$ are the roots of the equation $2 x^2 -3 x +1 = 0$, find an equation whose roots are $a/(2b +3)$, $b/(2a +3)$ If $a,b$ are the roots of the equation $2 x^2 -3 x +1 = 0$, find an equation whose roots are $a/(2b +3)$, $b/(2a +3)$   I was practicing quadratic equation questions online but I am stuck on this question.  I found the values of roots $a= 1$, $b= 1/2$ RemoveDuplicates gives 1004 error How can I play the same world between PS4 and Mobile? If $x$ is a positive rational but not an integer, is $x^x$ irrational? is_active_sidebar() Always Returns False The problem: The links at the bottom of the Stack&nbsp;Exchange newsletter link to a YouTube video instead of the right place on the website. I´m not sure if this is an oversight or a clever hack.  Screenshot: Let 'A' be a $2 \times 3$ matrix where as B be a $3 \times 2$ matrix if $\det(AB) = 4$ the find value of the $\det(BA)$  My attempt: I took A =  $$         \begin{bmatrix}         2 &amp; 0  &amp;0\\         0 &amp; 0  &amp;2\\         \end{bmatrix} $$  B= $$         \begin{bmatrix}         1 &amp; 0  \\         0 &amp; 0  \\         0 &amp; 1  \\         \end{bmatrix} $$  It satisfies given condition and I get $\det(BA)=0$   But I have not proved it  How do I prove that it is always zero (background)I am 12th grader and I know about adjoint,inverse,determinant,rank of a matrix and the other basics.  However I do NOT know about eigenvalues and eigenvectors. Retrieve the position (X,Y) of an HTML element relative to the browser window I want to know how to get the X and Y position of HTML elements such as img and div in JavaScript relative to the browser window. If $\alpha$ is an algebraic element and $L \subset K$ are both field, does the polynomial ring $L[\alpha]$ is also a field?  I am trying to prove that the ring of fraction $L(\alpha)$ is equal to $L[\alpha]$. To do this, I use an exercise done in class : Let $K$ a field, $\alpha \in K$ and $L$ a subfield of $K$. Then $L(\alpha)$ is the smallest subfield of $K$ containing $L$ and $\alpha$.  Is anyone could help me?