Thread: Looking to give script-like interface to program. (or something)

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Ethernal Noob
    Join Date
    Nov 2001
    Posts
    1,901

    Looking to give script-like interface to program. (or something)

    Basically I'm doing a small project for a math course that does root finding of functions, both polynomial and standard functions (using at most cos, sin, x, etc). Now I have a library with a class that acts as standard integer polynomial which takes in an array of coefficients and spreads it across an nth degree polynomial. It also calculates the polynomial at a given value (also integer). For the polynomial root finding algorithm it's pretty straightforward since the most I'm given is an array or vector of numbers.

    On the other hand I am to create a library for other functions such as cos(x) + x-2 - x^2, and the like.

    The problem is with the input. I can make the library take as parameters function objects as callbacks and just have the main program(mer) modify the source files. The only thing is I'm giving this as a program to the teacher, I don't want him to have to test if it works with different functions and modify and recompile everything himself (considering it's spread across three seperate projects).

    What I imagine is one of two things.
    1) design a "function" class that like the polynomial class represents an arbitrary function that's not a polynomial, and can evaluate it at x
    2) take a file that has functions typed in it and my program parses it for what it is and can evaluate it.

    I personally don't know what to choose as I don't know how I can represent an arbitrary function as completely as I can a polynomial outside of a string.

    Anyone have an idea if I can have input as a script, and it could just use basic <cmath> library functions, or do I need to parse everything myself?
    Last edited by indigo0086; 01-26-2008 at 03:40 PM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. How to get RSSI value, send to sensor, sensor receive package, repackage it?
    By techissue2008 in forum Networking/Device Communication
    Replies: 1
    Last Post: 03-04-2009, 10:13 AM
  2. BOOKKEEPING PROGRAM, need help!
    By yabud in forum C Programming
    Replies: 3
    Last Post: 11-16-2006, 11:17 PM
  3. Script in games
    By Shakti in forum Game Programming
    Replies: 7
    Last Post: 09-27-2006, 12:27 AM
  4. Execute Program Using VB Script
    By brett2 in forum Windows Programming
    Replies: 0
    Last Post: 08-30-2003, 12:40 PM
  5. Replies: 1
    Last Post: 10-01-2001, 10:39 AM