MathGroup Archive 2011

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

Search the Archive

Using a Mathematica Program to write a Mathematica Program

  • To: mathgroup at smc.vnet.net
  • Subject: [mg119270] Using a Mathematica Program to write a Mathematica Program
  • From: "Harvey P. Dale" <hpd1 at nyu.edu>
  • Date: Sat, 28 May 2011 07:18:57 -0400 (EDT)

	How can one write a Mathematica program the output of which is
itself a Mathematica program?
	 Here is a specific example.  Suppose one runs
FindLinearRecurrence on a sequence of numbers and Mathematica provides a
list of the recurrence factors.  What I would like is to run a program
that would (1) enter the command "Linear Recurrence" plus the opening
square bracket, (2) copy the output of the FindLinearRecurrence program,
i.e., the recurrence factors (as a list), (3) determine the length of
the list of those recurrence factors, (4) take from the sequence of
numbers that had been provided to FindLinearRecurrence the same (first)
number of numbers that corresponds to the length of the recurrence
factors, (5) insert those numbers, as a list, into the program being
created for Linear Recurrence, separated from the recurrence-factor list
by a comma, (6) insert a comma following that, (7) insert a number and
closing square bracket following that, in turn, and (8) provide that
output as a program that could be copied from the output line into a new
input line and run.
	For example, suppose FindLinearRecurrence is run on this list
{2,5,8,11,14,17} producing {2,-1}.  The output I want from the program
to be written would be LinearRecurrence[{2,-1},{2,5},30].
	Any ideas would be welcome.
	Thanks.
	Harvey P. Dale

______________________________________________________________________
This email has been scanned by the MessageLabs Email Security System.
For more information please visit http://www.messagelabs.com/email
______________________________________________________________________


  • Prev by Date: Re: Rounding to a certain number of decimal places
  • Next by Date: Re: Rounding to a certain number of decimal places
  • Previous by thread: Re: how to calculate an index and vice versa
  • Next by thread: Re: Using a Mathematica Program to write a Mathematica Program