command log(2) give value as 500

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

command log(2) give value as 500

behindvampire
Hi  all,I am new to this octave world so please bear my foolish question.i am
trying to find the natural log value of 2 but the value it generate is
500.Plz guide me where am i doing wrong.
<http://octave.1599824.n4.nabble.com/file/t372735/img.png>



--
Sent from: http://octave.1599824.n4.nabble.com/Octave-General-f1599825.html


-----------------------------------------
Join us March 12-15 at CERN near Geneva
Switzerland for OctConf 2018.  More info:
https://wiki.octave.org/OctConf_2018
-----------------------------------------
Reply | Threaded
Open this post in threaded view
|

Re: command log(2) give value as 500

marco atzeri-2
On 12/02/2018 15:29, behindvampire wrote:
> Hi  all,I am new to this octave world so please bear my foolish question.i am
> trying to find the natural log value of 2 but the value it generate is
> 500.Plz guide me where am i doing wrong.
> <http://octave.1599824.n4.nabble.com/file/t372735/img.png>

Please note that "copy and paste" is always better.

octave:1> log(e)
ans =  1
octave:2> log(2)
ans =  0.69315
octave:3> which log
'log' is a built-in function from the file libinterp/corefcn/mappers.cc
octave:4>
I guess you have redefined log somewhere,
what is the output of "which log" ?

Regards
Marco


-----------------------------------------
Join us March 12-15 at CERN near Geneva
Switzerland for OctConf 2018.  More info:
https://wiki.octave.org/OctConf_2018
-----------------------------------------
Reply | Threaded
Open this post in threaded view
|

Re: command log(2) give value as 500

Przemek Klosowski-7
In reply to this post by behindvampire
On 02/12/2018 09:29 AM, behindvampire wrote:
> Hi  all,I am new to this octave world so please bear my foolish question.i am
> trying to find the natural log value of 2 but the value it generate is
> 500.
Normally, log() is the function:

octave:1> which log
'log' is a built-in function from the file libinterp/corefcn/mappers.cc
octave:1> log(2)
ans =  0.69315

but you can define your own data array called log() which will then
shadow the log() function:

octave:2> log(1)=1
log =  1
octave:3> log(2)
error: log(2): out of bound 1octave:3> log(e)
error: log(2.71828): subscripts must be either integers 1 to (2^31)-1 or
logicals
octave:3> which log
'log' is a variable

If you can remember defining data that shadows the log() function,
great---if not, it could be some code that is automatically loaded in
your environment and it would require some investigation to figure out
where it's coming from.



-----------------------------------------
Join us March 12-15 at CERN near Geneva
Switzerland for OctConf 2018.  More info:
https://wiki.octave.org/OctConf_2018
-----------------------------------------
Reply | Threaded
Open this post in threaded view
|

Re: command log(2) give value as 500

behindvampire
In reply to this post by marco atzeri-2
Well most probably the issue is that the log as a variable is masking the
in-built function. A fresh start do give me the correct value. Thanks for
helping.



--
Sent from: http://octave.1599824.n4.nabble.com/Octave-General-f1599825.html


-----------------------------------------
Join us March 12-15 at CERN near Geneva
Switzerland for OctConf 2018.  More info:
https://wiki.octave.org/OctConf_2018
-----------------------------------------