# Creating a grid that deducts a sum from a total

Posted 6 months ago
284 Views
|
2 Replies
|
1 Total Likes
|
 Hello everyone,I've only been using Mathematica for the past five days, so please bear with me as I fumble about. I've been reading up as much as I can (and still am) and using the introductory videos, but there are some concepts I'm still struggling with.What I'm trying to do is to create a grid of 150 buttons. Each button has an integer value of 1 to 150). That's the easy part: Grid[Partition[Button[#, Appearance -> "Palette"] & /@ Range[150], 15], Spacings -> {1, 1}] The buttons can be depressed, and as I depress the buttons, they stay depressed and sends the corresponding numbers to be added up to a list, then deducted from a 11325. Eg if I press the buttons 1, 5, 10, and 100, it will deduct 1, 5, 10 and 100 and the result would be 11209. I think using delayed values is the key here. I think the way to this would to assign functions:a=11325 y=[total of listed numbers] x= a-yThe trouble is, I haven't been able to find an example of how to create the conditions to produce y. I haven't been able to express this in a way that integrates all of these ideas either.I would very much like to figure this out myself, so instead of asking if you would solve this for me, I would ask if you would point me in the right direction. Math was never my strong point, and I've been looking at using Mathematica to relearn math think computationally. I think a lot of the challenges for me right now comes from not knowing the terms used to express the language.Thank you for your help!Tom