Discussion Overview
The discussion revolves around replicating the power function in MATLAB without using the power operator. Participants explore how to compute a number raised to a power using loops and multiplication, specifically focusing on positive integer exponents.
Discussion Character
- Homework-related
- Technical explanation
- Debate/contested
Main Points Raised
- The original poster (OP) seeks a method to compute a power function using only loops and multiplication, specifically for positive integers.
- One participant suggests a corrected approach using a separate loop counter variable instead of reusing the input variable, providing a code example that successfully calculates the power.
- Another participant introduces the mathematical expression a^b = exp(b*log(a)), but questions its relevance to the OP's request.
- There is a clarification that in MATLAB, the function log refers to the natural logarithm, while log10 is used for base 10 logarithm.
- One participant notes a potential inconsistency in the OP's request regarding the types of exponents they wish to calculate.
Areas of Agreement / Disagreement
Participants generally agree on the method for calculating powers using loops for positive integers, but there is disagreement regarding the applicability of logarithmic functions to the OP's problem and uncertainty about the OP's requirements.
Contextual Notes
There are limitations in the discussion regarding the types of exponents that can be handled, as well as the OP's conflicting statements about the problem scope.