in matlab coding how to write Big-O notation
8 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
lokireddy sarala
el 9 de En. de 2018
Respondida: lokireddy sarala
el 17 de Mzo. de 2018
e=O(log(n))
0 comentarios
Respuesta aceptada
Walter Roberson
el 9 de En. de 2018
MATLAB in general has no concept of Big-O notation, and cannot compute it or use it.
The closest that MATLAB gets to this is that inside the MuPAD symbolic engine, series are represented with an order term, such as
1 + x + x^2/2 + x^3/6 + x^4/24 + x^5/120 + O(x^6)
This is related to big-O notation in that both have to do with order approximations, but the symbolic engine use does not have to do with code complexity in either time or space.
5 comentarios
Walter Roberson
el 1 de Feb. de 2018
When lamda is 2 or more and t is > 1, then your formula gives a complex result.
"but i need code for Big-O and Small o notations in matlab."
There is no code for that. They are theoretical analysis, not something that can be easily computed.
Walter Roberson
el 1 de Feb. de 2018
I see from https://en.wikipedia.org/wiki/Big_O_notation#Family_of_Bachmann%E2%80%93Landau_notations that in Small-O notation, o(g(n)) means "f is dominated by g asymptotically" and that there is a formal limit involved, lim n->0 f(n)/g(n) = 0.
In order prove such a thing in MATLAB, you would need to have the formula f(n) and g(n), and you would need to use the symbolic toolbox to take limit(f(n)/g(n), n, inf) and show that it was 0. This is not always practical to do by the symbolic toolbox but it does work sometimes. But proving that g(n) is the "smallest" function with this property requires mathematical analysis that is difficult to impossible to do through symbolic computations.
Más respuestas (1)
Ver también
Categorías
Más información sobre Special Values 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!