Re: How to remove curly brackets and arrow symbols from a list.

*To*: mathgroup at smc.vnet.net*Subject*: [mg58218] Re: [mg58204] How to remove curly brackets and arrow symbols from a list.*From*: Pratik Desai <pdesai1 at umbc.edu>*Date*: Thu, 23 Jun 2005 05:33:55 -0400 (EDT)*References*: <200506220555.BAA00719@smc.vnet.net>*Sender*: owner-wri-mathgroup at wolfram.com

T. K. Ghosh wrote: >Hi Math Guru, > >I will be very happy if you could help me to solve the following problem. >The simplified version of my problem is the following. >I have a quadratic equation with a parameter, say "p". > >Define the function: >f[x_] := A*X^2 + B*X*p + D with A, B and D are given. >"p" is a parameter. > > First things first, using D as a variable will not work as it is a protected symbol. Try it by typing ??D . Infact using capital letters to define your variables is not a good idea (it is my opinion ofcourse) >I solve this equation for a given p: >w = Solve[f[x]] == 0, X]. > > You mean Solve[f[x]==0,x] f[x_] := a*x^2 + b*x*p + d The way I have learned to do this is sol1=Solve[f[x]==0,x] w1[a_,b_,d_,p_]=x/.sol1[[1]] w2[a_,b_,d_,p_]=x/.sol1[[2]] This will give you a function w1 and w2 in terms of your parameters without the curly brackets >Now I want to make a Table for the solutions of this >quadratic equation for different values of "p". >So I write, >Table[{p,sol},{p,0,10,1}. > > dat=Table[{p,w1[a,b,d,p],w2[a,b,d,p]},{p,0,10,1}] Here you can input your values for a,b &d etc p is iterated in your table >I will get a table which will look like, >0 {w -> a} {w -> -a} >1 {w -> b} {w -> -b} >2 {w -> c} {w -> -c} >and so on......... > > >How can I remove the curly brackets and the arrow symbol >from the TableForm? I would like to plot the 1st column >vs. 2nd or 3rd column. > This is a little tricky, maybe some one can provide a simpler way to do this. I have used the MatrixManipulation package to get plot the first columns vs the other two, note if you have complex solution you have to modify your plot commands. You may also try the multiple list package dat = Table[{p, w1[1, 1,0, p], w1[1, 1, 0, p]}, {p, 0, 10, 1}] dat // MatrixForm << LinearAlgebra`MatrixManipulation` ListPlot[TakeColumns[dat, 2]] ListPlot[Table[{Flatten[TakeColumns[dat, 1]][[b]], Flatten[TakeColumns[dat, \ -1]][[b]]}, {b, 1, Length[dat]}]] > I must remove those brackets. >and I wish to get the following form: >0 a -a >1 b -b >2 c -c > > >Hope this can be done easily which I am not aware. >Any suggestion/solution to this problem is most welcome. >Thanking you in advance. >TKG. > > > > Hope this helps Best regards Pratik -- Pratik Desai Graduate Student UMBC Department of Mechanical Engineering Phone: 410 455 8134

**References**:**How to remove curly brackets and arrow symbols from a list.***From:*"T. K. Ghosh" <tkghosh@mp.okayama-u.ac.jp>