MathGroup Archive 2005

[Date Index] [Thread Index] [Author Index]

Search the Archive

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

  • To: mathgroup at smc.vnet.net
  • Subject: [mg58209] Re: How to remove curly brackets and arrow symbols from a list.
  • From: David Bailey <dave at Remove_Thisdbailey.co.uk>
  • Date: Thu, 23 Jun 2005 05:33:45 -0400 (EDT)
  • References: <d9av83$10a$1@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.
> I solve this equation for a given p:
> w = Solve[f[x]] == 0, X].
> 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}.
> 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. 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.
> 
Hello,

First please note that 'x' and 'X' are distinct variables. If you give a 
quadratic equation to Solve, you will get back a list of TWO solutions - 
because that is the nature of quadratic equations! If you don't care 
which solution you want, you could just select one of these:

w=Solve[f[x] == 0, x][[1]]

At this point w will have a value something like {x->answer}. This is 
extremely useful in general because you can use it to substitute the 
value of x into any expression involving x. In your case you want:

w= x/.Solve[f[x] == 0, x][[1]]

Now w is the answer you want (as a function of p) and you can use it to 
build your table without any curly brackets!

If I were you I would invest some time reading that heavy brick that 
came with your Mathematica disks - or even go on a course - once you 
learn a little more you will see how all this clicks together.

David Bailey
http://www.dbaileyconsultancy.co.uk


  • Prev by Date: Re: How to remove curly brackets and arrow symbols from a list.
  • Next by Date: Re: a question about plot a list of functions.
  • Previous by thread: Re: How to remove curly brackets and arrow symbols from a list.
  • Next by thread: Re: How to remove curly brackets and arrow symbols from a list.