MATLAB Python: Difference between revisions
Jump to navigation
Jump to search
Bradley Monk (talk | contribs) (Created page with "{| class="wikitable sortable" |- ! Header text !! Header text !! Header text |- | A = [1 2 3] || Example || Example |- | Example || Example || Example |- | Example || Example...") |
Bradley Monk (talk | contribs) mNo edit summary |
||
(6 intermediate revisions by the same user not shown) | |||
Line 9: | Line 9: | ||
| Example || Example || Example | | Example || Example || Example | ||
|} | |} | ||
{{Matpy|<syntaxhighlight lang="Matlab"> | |||
A = [1 2 3] | |||
</syntaxhighlight> | |||
|<syntaxhighlight lang="Python"> | |||
A = np.array([1, 2, 3]).reshape(1, 3) | |||
</syntaxhighlight> | |||
}} | |||
<!-- <syntaxhighlight lang="Matlab" line='line'> --> | |||
<syntaxhighlight lang="Matlab"> | |||
A = [1 2 3] | |||
</syntaxhighlight> | |||
<syntaxhighlight lang="Python"> | |||
A = np.array([1, 2, 3]).reshape(1, 3) | |||
</syntaxhighlight> | |||
<syntaxhighlight lang="python" style="font-weight:bold;"> | |||
def quick_sort(arr): | |||
less = [] | |||
pivot_list = [] | |||
more = [] | |||
if len(arr) <= 1: | |||
return arr | |||
else: | |||
pass | |||
</syntaxhighlight> | |||
help func info(func) or help(func) or func? (in Ipython) get help on the function func | help func info(func) or help(func) or func? (in Ipython) get help on the function func |
Latest revision as of 05:48, 18 May 2020
Header text | Header text | Header text |
---|---|---|
A = [1 2 3] | Example | Example |
Example | Example | Example |
Example | Example | Example |
A = [1 2 3]
A = np.array([1, 2, 3]).reshape(1, 3)
def quick_sort(arr):
less = []
pivot_list = []
more = []
if len(arr) <= 1:
return arr
else:
pass
help func info(func) or help(func) or func? (in Ipython) get help on the function func
which func see note HELP find out where func is defined
type func source(func) or func?? (in Ipython) print source for func (if not a native function)
a && b a and b short-circuiting logical AND operator (Python native operator); scalar arguments only
a || b a or b short-circuiting logical OR operator (Python native operator); scalar arguments only
1*i, 1*j, 1i, 1j 1j complex numbers
eps np.spacing(1) Distance between 1 and the nearest floating point number.
ode45 scipy.integrate.solve_ivp(f) integrate an ODE with Runge-Kutta 4,5
ode15s scipy.integrate.solve_ivp(f, method='BDF') integrate an ODE with BDF method