manipulate with user entered functions and variables
- To: mathgroup at smc.vnet.net
- Subject: [mg130890] manipulate with user entered functions and variables
- From: nmueggen at gmail.com
- Date: Thu, 23 May 2013 04:11:18 -0400 (EDT)
- Delivered-to: l-mathgroup@mail-archive0.wolfram.com
- Delivered-to: l-mathgroup@wolfram.com
- Delivered-to: mathgroup-outx@smc.vnet.net
- Delivered-to: mathgroup-newsendx@smc.vnet.net
I am trying to create a manipulate interface that would allow a user to enter a set of independent variables and a function of these variables. The program would then return calculations based on partial derivatives of the function with respect to the given variables. Eventually this would lead to an error propagation program for undergraduate physics labs. This program allows for 2 variables and produces a list of partial derivatives of the function with respect to the variables. It works just fine. Manipulate[{D[f, var[1]], D[f, var[2]]}, {var[1], x}, {var[2], y}, {f, x^2 + y^3}] I would like to extend it to an adjustable number of variables, which I think I can do with nested manipulate commands, but I also need the code to adjust how many derivatives need to be calculated, so I want to replace the list of derivative commands with a Table. I tried this: Manipulate[ Table[D[f, var[i]], {i, 1, 2}], {var[1], x}, {var[2], y}, {f, x^2 + y^3}] This program doesn't work. I suspect that the Table command is somehow causing it to calculate the derivatives before the expressions for the variables and/or function are defined from the manipulate controls. I get the same problem when using Sum or Do commands instead of Table. Any suggestions would be appreciated. Thankyou, Nathan