The Math Forum

Search All of the Math Forum:

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

Math Forum » Discussions » Software » comp.soft-sys.matlab

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

Topic: symbolic toolbox - diffentiating symbolic expressions
Replies: 2   Last Post: Oct 26, 2013 9:22 PM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]

Posts: 8
Registered: 4/24/09
symbolic toolbox - diffentiating symbolic expressions
Posted: Oct 26, 2013 6:40 PM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

I'm starting out with the symbolic toolbox to derive/verify some lengthy expressions for derivatives of products of trig functions of a single variable.

As the simplest example of what I want to do with the toolbox, consider the function
f = cos(g) where g is a function of a real variable x. I don't want to specify any further functional form for g; instead I want the result in symbolic terms of g and its derivative with respect to x.

From the chain rule, df/dx = - sin(g) dg/dt

I tried various things like:

syms x g
f = cos(g)
Df = diff ( f , x )

which just returns 0 (i.e. doesn't treat g as a function; f is constant therefore its derivative is zero)

If I leave out the g in the syms, I get an error re g undefined which makes sense as I haven't told it about g

syms x
f = cos(g)
Df = diff ( f , x )

How can I let Matlab know that g is an arbitrary function and get symbolic results in terms of that function and its derivatives? I expect Matlab to give me a result similar to - sin(g) g' I would think this is something the toolbox ought to do but I'm not sure how to do this.

Thanks very much..

Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© The Math Forum at NCTM 1994-2018. All Rights Reserved.