MathGroup Archive 2009

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

Search the Archive

Re: i need package help or dyanamic help

  • To: mathgroup at smc.vnet.net
  • Subject: [mg101835] Re: i need package help or dyanamic help
  • From: Albert Retey <awnl at gmx-topmail.de>
  • Date: Sat, 18 Jul 2009 08:00:58 -0400 (EDT)
  • References: <h3s252$66r$1@smc.vnet.net>

terrie riley wrote:
> I have a package that should be called by functions to access mathematica data sources
> In my example program i do want a pull down of the states. In the example it seems easier because the list is already defined by the data source.(?).

you can get a list of the states with:
CountryData["UnitedStates", "Regions"]

> i need the data to be in a list but also to have quotes around it so when it is stuffed into the function the correct syntax is written. i have attached both. i get an error about the list not being properly defined. 
> 
> 
> usingWhere toLive.nb
> 
> << WhereToLive`
> MyManipulation[states]
> 
> the package whereToLive.m
> BeginPackage["WhereToLive`"]
> 
> MyFunction::usage =
>         "MyFunction[state] shows the shape of state and a list of cities.Select a city 
> to see information";
> MyManipulation::usage="MyManipulation[set] sets up a demonstration that shows A group of cities 
> in a state in set,and lists cost of living data about them.";
> Begin["`Private`"]
> 
> 
> states_ = {"\"Alabama\"","\"Ohio\"","\"Florida\""}
> MyFunction[states_] := CityData[{Large,states,"UnitedStates"}];
> 
> MyManipulation[set_:"UN"]:= Manipulate[MyFunction[states],{CityData[Large,set,"UnitedStates"]}];
> 
> End[ ]
> 
> EndPackage[ ]

Honestly, your code does not make much sense to me, and since it obtains
syntax errors, Mathematica also can't interpret it.

1) states_ = ... can never be used, to define a variable states, just
use states = ... the trailing _ defines a pattern which doesn't make
sense here.

2) Your call to Manipulate doesn't contain any valid definition of a
control variable, so it can't work and it also is not clear what the
Manipulate tries to achieve...

maybe you should start with reading the documentation and building some
simple Manipulates and then work to more complicated cases step by step...

probably the following can get you started:

Manipulate[
 CityData[{Large, state, "UnitedStates"}][[All, 1]],
 {state, CountryData["UnitedStates", "Regions"]}
 ]



hth,

albert


  • Prev by Date: Re: Re: another Epilog LogPlot problem
  • Next by Date: Linking Manipulate to arrow keys?
  • Previous by thread: i need package help or dyanamic help
  • Next by thread: rotate but not resize Graphics3D in Dialog