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

MathGroup Archive 2008

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

Search the Archive

Re: Inequalities or histogram or something.......

  • To: mathgroup at smc.vnet.net
  • Subject: [mg89359] Re: [mg89338] Inequalities or histogram or something.......
  • From: Curtis Osterhoudt <cfo at lanl.gov>
  • Date: Sat, 7 Jun 2008 02:57:36 -0400 (EDT)
  • Organization: LANL
  • References: <200806061047.GAA24209@smc.vnet.net>
  • Reply-to: cfo at lanl.gov

Hi, Steve, 

   What follows is NOT a symbolic solution, but a numeric approach. I'll keep 
working on finding a symbolic solution (I love this kind of thing), but 
probably someone from the list has already beaten me to it. 



(* Create a list of solutions up v = 50. If the upper limit on v is changed, 
the number of solutions sought in FindInstance may need to be changed, too*)
solns = Table[{k, v, 
    Evaluate[
     FindInstance[
      k == x1 + x3 - x2 - 2 && 
       Inequality[1, LessEqual, x1, Less, x2, 
                 Less, x3, LessEqual, v], {x1, x2, x3}, Integers, 
      1000]]}, {v, 3, 50}, {k, 1, v - 1}]; 

(* Curry the solutions to pick out the Lengths of the solution sets *)
nums1 = solns /. {a_, b_, c_} :> {a, b, Length[c]}; 

(* Further curry the result to extract non-anomalous results. I don't know why 
my "nums1" list sometimes has non-numeric values for the lengths*)
nums2 = Select[Flatten[nums1, 1], NumberQ[#1[[3]]] & ]; 

(* Plot the result as a tabulation vs. k and v *)
ListPlot3D[nums2, PlotRange -> All, InterpolationOrder -> 0, 
 AxesLabel -> {k, v}]


On Friday 06 June 2008 04:47:03 Steve Gray wrote:
> Can Mathematica help with this? Or can someone?
>
> I have positive integers x1,x2,x3,k,v.
>
> There are assumptions:
> 1 <= k < v and
> 1 <= x1 < x2 < x3 <= v.
>
> There is one equation:
> k = x1 + x3 - x2 - 2.
>
> I need a symbolic solution for the number of combinations of x1,x2,x3
> that satisfy the equation under the assumptions.
>
> This will be a histogram of k vs. the number of solutions.
> One numeric point on the histo: if v=8 and k=0, there are 6 solutions,
> x1,x2,x3 = 1,2,3; 1,3,4; 1,4,5; 1,5,6; 1,6,7; 1,7,8; none with x1 > 1.
>
> I need a general symbolic solution in terms of D(v,k). I need a way to
> show its derivation for a paper. I happen to know that
> D(v,k) + D(v,v-k-3) = 2(k+1)(v-k-2).
>
> This is not overwhelmingly complicated but I don't know a decent way
> to go about it. Thank you for any help, using Mathematica or not. (I have
> version 6.)
>
> Steve Gray



-- 
==========================================================
Curtis Osterhoudt
cfo at remove_this.lanl.and_this.gov
PGP Key ID: 0x4DCA2A10
Please avoid sending me Word or PowerPoint attachments
See http://www.gnu.org/philosophy/no-word-attachments.html
==========================================================


  • Prev by Date: Re: Integral Questions
  • Next by Date: Re: Adding markers on the surface of a Plot3D?
  • Previous by thread: Inequalities or histogram or something.......
  • Next by thread: Re: Inequalities or histogram or something.......