【深度学习笔记】(一)Octave

【深度学习笔记】(一)Octave

介绍Octave

Octave是一种面向科学数学运算的原型语言,内置了强大的数学函数及图形展示工具。原型prototyping设计的意思是使用ovtave进行算法设计、实现、验证等过程。 推荐Octave快速实现算法原型


安装Octave

以mac为例:

1、安装Homebrew

/usr/bin/ruby -e “$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)”

2、更新Homebrew

sudo ln -sf /Applications/Utilities/XQuartz.app/ /Applications/Utilities/X11.app
brew update && brew upgrade

3、安装Gcc

brew install gcc

4、安装Octave

brew install octave

5、验证安装成功

jasondeMacBook-Pro:~ jasonhu$ octave

GNU Octave, version 4.2.1
Copyright (C) 2017 John W. Eaton and others.
This is free software; see the source code for copying conditions.
There is ABSOLUTELY NO WARRANTY; not even for MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. For details, type ‘warranty’.
Octave was configured for “x86_64-apple-darwin16.7.0”.
Additional information about Octave is available at http://www.octave.org.
Please contribute if you find this software useful.
For more information, visit http://www.octave.org/get-involved.html
Read http://www.octave.org/bugs.html to learn how to submit bug reports.
For information about changes from previous versions, type ‘news’.

octave:1>


使用Octave

1、逻辑运算

octave:1> 1==3
ans = 0
octave:2> 1|0
ans = 1
octave:3> 1|3
ans = 1
octave:4> 4~=5
ans = 1
octave:5> 9>10
ans = 0
octave:6> 2&&0
ans = 0
octave:7>

2、线性代数运算

octave:7> b = [4;9;2]
b =
4
9
2

octave:8> A = [3 4 5;1 3 1;3 5 9]
A =
3 4 5
1 3 1
3 5 9

octave:9> x = A \ b
x =
-1.5000
4.0000
-1.5000

3、sin(x)函数图

octave:4> x = -10:0.1:10;
octave:5> y = sin(x);
octave:6> plot(x,y);title(“Simple 2-D Plot”);xlabel(“x”);ylabel(“sin(x)”);

【深度学习笔记】(一)Octave

上一篇:"高频面试知识点总结,看看你能答对多少 (下)"


下一篇:【python】]SyntaxError: Missing parentheses in call to 'print'