Conversion from Mathematica to Matlab

조회 수: 2 (최근 30일)
Sammy Al-Hashmi
Sammy Al-Hashmi 2015년 7월 17일
답변: Walter Roberson 2015년 7월 17일
Hi there. I am trying to convert a piece of code from Mathematica to Matlab. The code is given in the picture. In the mathematica code snippet, there is a section where it defines:
st= FindRoot[V[s] == em, {s,em}][[1,2]]
I am unsure, what is the double sqaure brackets at the end of the expression, [[1,2]]? I have never seen this before nor am I familiar with mathematica. The attached file gives a better idea of what I am asking about. Thanks.

답변 (1개)

Walter Roberson
Walter Roberson 2015년 7월 17일
In Mathematica, [[1,2]] is indexing at location (1,2); see https://reference.wolfram.com/language/tutorial/ManipulatingListsByTheirIndices.html
In context, they are expecting multiple roots and are extracting the second root.

카테고리

Help CenterFile Exchange에서 MATLAB에 대해 자세히 알아보기

제품

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by