Error In Tools/add Invalid Subscript Selector
Selector Edit Posted: April 03 2009 by Manny_Maple 12 Product: Maple 0 Hi everyone, I am trying to write a proc for the binomial method for option prices. I have the following code: treeStockPrices := proc (s0, X, r, sigma, T, N) local dt, u, d, a, b, p, L, i, j, k, m; global f; dt := evalf(T/N); u := evalf(exp(sigma*sqrt(dt))); d := 1/u; a := evalf(exp(r*dt)); b := evalf(exp(-r*dt)); p := (a-d)/(u-d); L := [[s0]]; for i from 1 to N do L := [op(L), [seq(s0*u^j*d^(i-j), j = 0 .. i)]] end do; f := L; for i from 1 to N+1 do f[N+1] := [seq(max(L[N+1, i]-X, 0), i = 1 .. N+1)] end do; for i from 1 to N do for j from 1 to i do f[N-i+1, j] := b*(p*f[N-i+2, j+1]+(1-p)*f[N-i+2, j]); L[N, j] := f[N, j] end do end do end proc I got no errors pushing enter, but when I write treeStockPrices(50.0, 50.0, .10, .40, .4167, 5) and push enter i get invalid subscript selector? I have been working on this for a while but I can't make it work! It seems that maple doesn't know what these are. Please, Please someone help! Thanks, Manny
error maple + Manage Tags Short words that describe your content. Used to categorize content. Combine multiple words with dashes(-). Separate tags with spaces. Tools Answer Reply Share Branch Create a new Post in reply Ask a related Question Flag More Contact Author Generate PDF 2310 views Preview You must enter a body with at least 15 characters That username is already taken by another member User name doesn't fit requirements Title: Comment: Enter your comment below. For information on using the editor, view the MaplePrimes Help. Subscribe: E-mail me when new comments are added to this You do not yet have a MaplePrimes user name, one is required to post to MaplePrimes, please enter one here. User Name: Cancel Preview Submit Answer this Question Add a Comment Preview You must enter a body with at least 15 characters That username is already taken by another member User name doesn't fit requirements Title: Comment: Enter your comment below. For information on using the editor, view the MaplePrimes Help. Subscribe: E-mail me when new comments are added to this You do not yet have a MaplePrimes user name, one is required to post to MaplePrimes, please enter one here. User Name: Cancel Preview Submit Share via: Share via e-mail: From: To: Custom Message (optional): Share on Facebook: You must be logged into your Facebook account in order to share via Facebook. Login to Facebook Share via GooglePlus: Click the button below to share this on Google+. A new window will open. Click Here to Share on Google+ Share via Twitter: You must be logged in to your Twitter account in order to share. Click the button below toselector Edit Posted: November 22 2012 by bet 0 Product: Maple 0 balle := proc (L) local K, a, i, c, J; J := L; c := nops(J); while J <> K do K := J; for i from 0 to c-1 do if J[i+1] < J[i] then a := J[i]; J[i] := J[i+1]; J[i+1] := a end if end do end do; return J end procI got the error "Error, (in balle) invalid subscript selector" even if L is a list. I don't understand. Could you help me, pretty please? student + Manage Tags Short words that describe your content. Used to categorize content. Combine multiple words http://www.mapleprimes.com/questions/37565-Invalid-Subscript-Selector with dashes(-). Separate tags with spaces. Tools Answer Reply Share Branch Create a new Post in reply Ask a related Question Flag More Contact Author Generate PDF 1781 views Preview You must enter a body with at least 15 characters That username is already taken by another member User name doesn't fit requirements Title: Comment: Enter your comment below. For information on using the editor, view the MaplePrimes Help. Subscribe: http://www.mapleprimes.com/questions/140703-Invalid-Subscript-Selector E-mail me when new comments are added to this You do not yet have a MaplePrimes user name, one is required to post to MaplePrimes, please enter one here. User Name: Cancel Preview Submit Answer this Question Add a Comment Preview You must enter a body with at least 15 characters That username is already taken by another member User name doesn't fit requirements Title: Comment: Enter your comment below. For information on using the editor, view the MaplePrimes Help. Subscribe: E-mail me when new comments are added to this You do not yet have a MaplePrimes user name, one is required to post to MaplePrimes, please enter one here. User Name: Cancel Preview Submit Share via: Share via e-mail: From: To: Custom Message (optional): Share on Facebook: You must be logged into your Facebook account in order to share via Facebook. Login to Facebook Share via GooglePlus: Click the button below to share this on Google+. A new window will open. Click Here to Share on Google+ Share via Twitter: You must be logged in to your Twitter account in order to share. Click the button below to login (a new window will open.) Login to Twitter Your message was sent! Send another message Pl
• MapleSim Academic • MapleSim Server • MapleSim Modelica Engine • Connectors & Component Libraries Online Education • Maple T.A. - http://www.maplesoft.com/support/help/errors/view.aspx?path=Error,%20invalid%20subscript%20selector Testing & Assessment • Maple T.A. MAA Placement Test Suite • Möbius - Online Courseware Other Products • Toolboxes & Connectors • E-Books & http://stackoverflow.com/questions/8275876/r-invalid-subscript-type-list Study Guides • Professional Services • Partnerships and OEM Opportunities Solutions Education • Mathematics Education • Engineering Education • High Schools & Two-Year Colleges • error in Testing & Assessment • Developmental Math • Students Applied Research • Financial Modeling • Operations Research • High Performance Computing • Physics • Life Sciences • Virtual Prototyping Engineering: Industry Solutions • Manufacturing • Mining & Oil Production Equipment • Aircraft Systems • Space Systems • Electric & Hybrid-Electric Vehicles error in tools/add • Powertrain • Vehicle Dynamics • Heavy Vehicles (including trucks, off-road) • Robotics Research • Robotics/Motion Control/Mechatronics • Power Industries • Medical Devices Engineering: Application Areas • System Simulation & Analysis • Model development for HIL • Plant Modeling for Control Design • Robotics/Motion Control/Mechatronics • Vibration Analysis & Attenuation • Battery Design • Training Simulators • Model-Predictive Control • Product Design Validation & Optimization • Analysis & Design Calculation Tools • Machine Design Purchase • Purchase & Pricing • Maplesoft Web Store • Request a Price Quote • Contact Maplesoft Sales • Elite Maintenance Program Support & Resources Support • Tech Support & Customer Service • Frequently Asked Questions • Online Product Help • Product Documentation • Download Product Updates Product Training • Online Product Training • On-Site Training Webinars & Events • Live Webinars • Recorded Webinars • Upcoming Events Content Hubs • Teacher Resource Ce
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up R: invalid subscript type 'list' up vote 11 down vote favorite I'm trying to use the indices of a sorted column of a dataset. I want to reorder the entire dataset by one sorted column. area.sort<-sort(xsample$area1, index.return=TRUE)[2] The output is a list, so I can't use it index through the whole dataset. Error in xj[i] : invalid subscript type 'list' Someone suggested using unlist but I can't get rid of the ix*. Any ideas? Thanks > area.sort<-unlist(area.sort) ix1 ix2 ix3 ix4 ix5 ix6 ix7 ix8 ix9 ix10 ix11 ix12 ix13 45 96 92 80 53 54 24 21 63 81 40 66 64 list r subscript share|improve this question edited Apr 24 '14 at 18:27 Waldir Leoncio 3,06783458 asked Nov 26 '11 at 2:36 Peter Becich 3311516 add a comment| 2 Answers 2 active oldest votes up vote 13 down vote accepted The call to sort with index.return=TRUE returns a list with two components: x and ix. Indexing with [2] returns a subset of the list - still a list. If you index using [[2]] it should work better. That returns the element in the list. But indexing using $ix is perhaps a bit clearer. But then again, if you only need the sorted indices, you should call order instead of sort... share|improve this answer edited Nov 26 '11 at 16:00 42- 166k8147277 answered Nov 26 '11 at 2:56 Tommy 23.7k36067 3 +1 for mentioning order, which is what they probably want instead. –joran Nov 26 '11 at 3:18 Awesome, order works well; and the double brackets work well too, thanks –Peter Becich Nov 26 '11 at 3:32 add a comment| up vote 0 down vote Most the time, this kind of error is caused by misspell