Is there any way to define an as-yet-unknown function?

i like this post (click again to cancel)
i dont like this post (click again to cancel)

I'd like to know if there's a way of declaring functions in sage that are as-yet unknown. For example, let's say I have a function

p = R*T/v - a(T)/v/(v+b)

And I would like to be able to take a derivative like this


and be given something back a partial derivative something like

R/v - diff(a(T),T)/v/(v+b)

However at present I can't seem to put an abstract function a(T) into my expression or find anything in the documentation that says how this is done.

As I recall there was a way to do this with wxMaxima, so maybe I just haven't found the trick in Sage yet.

asked Mar 23 '12

jdpipe gravatar image jdpipe
13 4

updated Mar 23 '12

i like this answer (click again to cancel)
i dont like this answer (click again to cancel) jdpipe has selected this answer as correct

You can define a function using the keyword function. The script below gives the answer you expect.

p = R*T/v - a(T)/v/(v+b)

posted Mar 23 '12

Shashank gravatar image Shashank flag of United States
1730 9 30 62

Great. seems to work fine. The output is a bit weird though, in typeset sage, the diff(a(T),T) is written as D [ 0 ] ( a ) ( T ), not particular intuitive. But it works! Thank you.

jdpipe (Mar 23 '12)

Your answer

Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!
Login/Signup to Post

Question tools



Asked: Mar 23 '12

Seen: 128 times

Last updated: Mar 23 '12

powered by ASKBOT version 0.7.22
Copyright Sage, 2010. Some rights reserved under creative commons license.