Blog 1

Random Talk on Random Thoughts

Got a Warning From Octave

| Comments |

Background

To verify the inequality

\[ \left(\sqrt{\frac{a+b}{c}}+\sqrt{\frac{b+c}{a}}+\sqrt{\frac{c+a}{b}} \right)^2\ge\frac{16}{3(a+b)(b+c)(c+a)} \]

found on Math Stack Exchange, I wrote the following Octave script.

A small script to verify the inequality (test.m) download
1
2
3
4
5
a = 0.1; b = 0.2; c = 1 - a - b;
A = ((a+b)*(b+c)*(c+a))^(1/3)
B = (a*b*c)^(1/3)
C = (sqrt((a+b)/c) + sqrt((b+c)/a) + sqrt((c+a)/b))^2
16/(3*A^3)

Problem

The above script did the calculations, but a warning message appeared.

$ octave -q test.m
warning: function ./test.m shadows a core library function
A =  0.60000
B =  0.24101
C =  31.975
ans =  24.691

How can I run this script without the warning?

Solution

Change the file name of the script to an uncommon name.

$ mv test.m test1.m
$ octave -q test1.m
A =  0.60000
B =  0.24101
C =  31.975
ans =  24.691

Comments