enter image description here

I would like to maximize the function $U$ with respect to $\theta_0$ in order to find $S_0$.

That's, I want to take derivative the function $U$ with respect to $\theta_0$ in order to find $S_0$.

Which program should I use in order to calculate this derivative ? because it is a bit complicated.

Is it possible to use Matlab for that? Please help me writing Matlab code for this?

Thank you!

(Note: Sorry for not writing the function U directly. But, I hope it is readable.)

  • $\begingroup$ I've used Maple and Mathematica. Wolfram|Alpha too. Symbolab is a nice online platform, and there are other similar ones. They all have different limitations and benefits. Nothing better than good old fashioned by-hand though as a human mind can usually find more helpful and efficient ways to rewrite and structure things. $\endgroup$
    – jdods
    May 28 at 23:48
  • 1
    $\begingroup$ Your function can be written in the form $U(\theta_0) = A \exp(B \theta_0)$ for some $A$ and $B$ that do not depend on $\theta_0$, and so $U'(\theta_0) = A B \exp(B \theta_0)$, hence $U'(\theta_0) = 0$ exactly when $A B = 0$. $\endgroup$ May 29 at 0:14
  • $\begingroup$ Wow! Thank you! :) Can you please write your solution more explicitly in the answer part? How you define A and B explicitly? dear @TravisWillse $\endgroup$
    – 1190
    May 29 at 0:45
  • 2
    $\begingroup$ So, according to @TravisWillse, if the derivative is zero anywhere, then the function is constant. $\endgroup$
    – GEdgar
    May 29 at 0:51
  • $\begingroup$ I know you didn't ask about this, but "take derivative [of] the function $U$ with respect to $\theta_0$ in order to find $S_0$" doesn't quite sound right to me. I'll assume that there's some context I don't know, and you know what you're doing. But @GEdgar 's comment hints that you may not be looking at your problem quite right. $\endgroup$ May 29 at 1:30

1 Answer 1


It's not a program, but rather a library for a programming language: SymPy for Python. It has a tool for differentiation (as well as integration, limits, etc).

The obvious downside is that you have to be fluent in Python.

  • $\begingroup$ I don't know Python ? Is it possible to use Matlab? But I don't know coding perfectly. Please help me to write Matlab code for this question? $\endgroup$
    – 1190
    May 29 at 0:21
  • $\begingroup$ It works with Matlab too. It has a toolbox for symbolic mathematics. It's been a loooong time since I haven't used Matlab tough. But if I'm not wrong it's called "syms". At their site there's a good enough tutorial. $\endgroup$ May 29 at 0:30
  • $\begingroup$ Thanks a lot :) $\endgroup$
    – 1190
    May 29 at 0:41

Not the answer you're looking for? Browse other questions tagged or ask your own question.