Mathematica 9 is now available
Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2009

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

Search the Archive

Re: How to feed a list of xy pairs into Solve to output xyz triplets

  • To: mathgroup at smc.vnet.net
  • Subject: [mg101179] Re: How to feed a list of xy pairs into Solve to output xyz triplets
  • From: computer algebra <mike.honeychurch at gmail.com>
  • Date: Fri, 26 Jun 2009 06:48:57 -0400 (EDT)
  • References: <h1vm3r$aad$1@smc.vnet.net>

On Jun 25, 6:12 am, Bill <WDWNORW... at aol.com> wrote:
> Hi:
>
> Let's say that I have a list of xy coordinate pairs:
>
> list= {{1,2}},{3,1},{5,4},{6,3},{2,5}}.
>
> Now I'd like to find xyz triplets using Solve for the equation 6*x + 4*y + z == 1.
>
> xyz results:  {{1,2,-13}},{3,1,-21},{5,4,-45},{6,3,-47},{2,5,-31}}. (I used Solve 5 times.)
>
> Question: How do I code that into Mathematica for a "one shot output?" (Use Solve once.)
>
> Thanks,
>
> Bill
>
> Mathematica 6.0.1 using Win XP on a pc.

Solve[6*x + 4*y + z == 1, z] /. {x -> list[[All, 1]], y -> list[[All,
2]]}

gets you a one shot list of z. Mapping list onto the structure you
want gets you a one shot x,y,z

{#[[1]], #[[2]], Solve[6*#[[1]] + 4*#[[2]] + z == 1, z][[1, 1, 2]]} & /
@ list

Mike


  • Prev by Date: Re: Almost finished - my first calculator!
  • Next by Date: Re: Plot with x value in Log
  • Previous by thread: Re: How to feed a list of xy pairs into Solve to output xyz triplets
  • Next by thread: Re: How to feed a list of xy pairs into Solve to output xyz triplets