help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Auto-inflating series


From: Doug Stewart
Subject: Re: Auto-inflating series
Date: Tue, 8 Mar 2016 06:07:27 -0500



On Tue, Mar 8, 2016 at 3:25 AM, Richard Mayo <address@hidden> wrote:
I say chaps,
    I need to generate a series _expression_, like a Fourier series, but with a finite number of terms, that number being an integer variable. Coefficients within each term will also be variables, but that's not the problem.
It sounds like some string manipulation is called for, with a loop statement concatenating terms as required. Then I need to turn that string into an _expression_ to be evaluated. How do I do that? All help gratefully received.

TTFN
    Richard.

_

I am not sure what you are talking about, but here is what I did with strings and functions.

There are other ways also.

http://wiki.octave.org/Symbolic_package

 # This prog. shows how to take a
# sring input and make it into an anonymous function
# this uses the symbolic pkg.
disp("Example input")
disp("x^2 + 3*x - 1 + 5*x*sin(x)")
str_fucn=input("please enter your function  ","s")
fucn_sym=sym(str_fucn)
f=function_handle(fucn_sym)
# now back to symbolic
syms x;
ff=formula(f(x));
etc.
-- 
HTH
DAS


reply via email to

[Prev in Thread] Current Thread [Next in Thread]