Piecewise and multiple values
- To: mathgroup at smc.vnet.net
- Subject: [mg89980] Piecewise and multiple values
- From: Giacomo Ciani <jackspam79 at gmail.com>
- Date: Wed, 25 Jun 2008 06:31:08 -0400 (EDT)
Hi all, in brief my problem: I'm using mathematica to create the solutions for problems that actually came in few different versions (meaning that the problem in the same, but the initial data change). Suppose I ave version 1 in which m=3,k=1,..., version 2 in which m=5,k=2,... and so on... Typically, I use an approach like: data={m->{3,5,6},k->{1,2,7},...} Then I write and solve the general symbolic equations, and the replace the values with the above rule, like: sol = Solve[...] sol/.data obtaining a list of numerical solutions corresponding to the different set of data contained in the "data" list, like: {(num sol corresponding to m=3,k=5,...),(num sol corresponding to m=5,k=2,...)} This works very well for me, because it allows me to solve the problem once and check the numerical solution for all the different versions at a glance. The problem arises in the case I have to use a Piecewise function. In this case I define: | f x<z h = | | g x>z but when I evaluate f/.data I obtain something like: | {f1,f2,...} x<{z1,z2,...} h = | | {g1,g2,...} x>{z1,z2,...} that I don't know how to plot or "disentagle", i.e. obtain expressions like: | f1 x<z1 h1 = | | g1 x>z1 | f2 x<z2 h2 = | | g2 x>z2 and so on... Do you have any suggestion? I would prefer to retain my data replacement scheme, and just understand how to create "disentangled" piecewise functions... Thaks Giacomo