Take the 2-minute tour ×
Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

while doing optimization in MAPLE, i am getting the output in the form of a list, which is as follows. \begin{equation} t=[.366595121038205462, [pr = 14.2982930082790, ps = 22.5165237470778]] \end{equation} I just want to extract the value $pr \quad\&\quad ps $ from $t$, and store it in x and y respectively. Please help me.

till now i have used whattype() in order to check the type of t. And it comes out to be a list. Now i have to extract the floating values of ps and pr and put them in x and y respectively.

share|improve this question

1 Answer 1

up vote 2 down vote accepted

The following is sometimes referred to as 2-argument eval. It's nicer than assigning those values to pr and ps because it allows those names to continue to be used directly (as names) in forming new expressions.

t:=[.366595121038205462,[pr=14.2982930082790,ps=22.5165237470778]]:

eval(pr,t[2]);

                   14.2982930082790

eval(ps,t[2]);

                   22.5165237470778

And you can use it in compound formula too, all together.

eval(  ps^2 - sin(pr), t[2] );

                     506.0067945
share|improve this answer
    
i salute u sir....thank u very much. actually i have to take this data to matlab and then repeat this for 10000 random values of $\phi1 and \phi2$. see this question if u want math.stackexchange.com/questions/301952/non-linear-optimization . THANKS A TON ACER........ –  nikki baba Feb 18 '13 at 0:53

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.