Why is square root not following square properties?
    3 visualizaciones (últimos 30 días)
  
       Mostrar comentarios más antiguos
    
    Jamie
 el 11 de Jul. de 2014
  
    
    
    
    
    Comentada: Jamie
 el 11 de Jul. de 2014
            Hello,
When I run this segment of code. The two different ways of writing the square roots don't equal (this can obviously vary with the random values in matrix "a").
a = rand(4);
sqrt(5)./sqrt(a)==sqrt(5./a)
 ans =  
        0     1     0     1
        1     0     0     0
        0     1     0     1
        1     0     1     1
As far as I know, this property of square roots should be valid, however it seems to not be giving an answer consistent with my understanding.
Any help would be greatly appreciated
0 comentarios
Respuesta aceptada
  Image Analyst
      
      
 el 11 de Jul. de 2014
        I think because they're computed in different ways, the expressions on each side are different from each other way out in the 7th or 8th decimal place. To understand this you should read the FAQ: http://matlab.wikia.com/wiki/FAQ#Why_is_0.3_-_0.2_-_0.1_.28or_similar.29_not_equal_to_zero.3F Some of them might match exactly and those locations give a 1 but where they don't exactly match all the way out to the last decimal place, those locations will be a 0, indicating "no equality".
Más respuestas (0)
Ver también
Categorías
				Más información sobre Creating and Concatenating Matrices en Help Center y File Exchange.
			
	Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

