I am trying to do multi step math and keep returning the wrong answer
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
Matthew
el 19 de Abr. de 2024
Comentada: Dyuman Joshi
el 19 de Abr. de 2024
I am given the equation and this is my code but it keeps telling me that it is returning the wrong value.
b=(1/7)+((72/13)^2)/(sqrt((125/2)-(25/3)))
4 comentarios
Dyuman Joshi
el 19 de Abr. de 2024
The expression and the code match, so you are good.
How is the test case in Grader comparing the value with the output?
Respuesta aceptada
John D'Errico
el 19 de Abr. de 2024
Editada: John D'Errico
el 19 de Abr. de 2024
Of course it is wrong. Why did you write 72/13? Why 25/3?
I think you don't understand that
8(1/3) is NOT the same thing as
8 + 1/3
Similarly, you see essentially
5 (7/13)
and you are trying to add fractions!
b=(1/7)+((5*7/13)^2)/(sqrt((125/2)-8*1/3))
Do you see what you are doing? When you have an expression like that, you should not assume an implicit addition there. I think you are confused because some people will write
5 1/2
as meaning 5 PLUS 1/2, and thus effectively 5.5.
4 comentarios
Sam Chak
el 19 de Abr. de 2024
Also be careful when you guys use WolframAlpha.
Case 1: Without space
Case 2: With space
Dyuman Joshi
el 19 de Abr. de 2024
Even I took them as mixed fractions and responded accordingly. I was going to ask for a clarification but in the mean time John had already answered the question.
Más respuestas (0)
Ver también
Categorías
Más información sobre Matrix Indexing en Help Center y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!