Search All of the Math Forum:

Views expressed in these public forums are not endorsed by NCTM or The Math Forum.

Notice: We are no longer accepting new posts, but the forums will continue to be readable.

Topic: Evaluating symbolic functions at specific values of the symbols
Replies: 4   Last Post: Mar 10, 2013 1:03 AM

 Messages: [ Previous | Next ]
 Kaitlin Posts: 2 Registered: 2/22/12
Evaluating symbolic functions at specific values of the symbols
Posted: Feb 22, 2012 7:09 PM

Hello,
I am trying to evaluate a symbolically integrated or differentiated function at a specific value of x or t.

x=sym('x','positive')
t=sym('t','positive')

% That tells the program to treat x and t as symbols so that I can do symbolic differentiation.

u = sin(t*x)
% u is my function of interest

w=diff(u)
%This differentiates sin(t*x) with respect to x, giving me t*cos(t*x), as hoped.

But now, I would like to evaluate w at some value, for instance t = 2 and x = 3, so that I could put:
t=2
x=3
neww = "evaluate" w @ t=2 and x=3

Which would hopefully yield 1.923 as the value for w at this point "2*cos(2*3)" .

I have been trying to make function handles for w, using t and x as inputs, but I apparently need the symbols for x and t to use the differentiation command, so it isn't working. I have been looking at assignin, evalin, clearvars, vpa, and pretty much anything I could think of, but I haven't figured out a way to do it. Any ideas? Help is greatly appreciated.

Date Subject Author
2/22/12 Kaitlin
2/22/12 Kaitlin
2/23/12 Christopher Creutzig
3/10/13 Michael Bernard
3/10/13 Michael Bernard