Tidy up expression after differentiating
Asked Answered
D

1

6

The equations I am working with in this problem contain exponentials. For this reason, after differentiating they appear again pretty much unchanged apart from additional constants and other factors. I was wondering if it might be possible to collect those exponentials back into the name of the expression they where part of. Here is an example:

Given this function definition

f:= x -> A*exp(B/x)

After differentiating, one would get

A*exp(B/x)*(-B/x^2)

And it would be great if I could somehow convert it to

f(x)*(-B/x^2)

Is this possible with MuPad or any other CAS package?

Disconnect answered 5/4, 2013 at 16:39 Comment(3)
If you just want to recognize the functions which are written just the same as the original f function was, you can compare strings (really dumb method). But, if you want the algorithm to extract the function from expressions performing operations it is gonna get damn tricky because it is a search problem with infinite possibilities... Like when: "f:x -> x - 1" with an input function of: (x^2 - 1). It is possible to express the input function in terms of f(x) in many ways: f(x)*(x+1), f(x)^2 + 2*x - 2, or even: (x^2 - 1) + f(x) - (x - 1), etc...Storybook
I think the strign way may work. @Storybook is right, you may have functions that are equal mathemathicaly but not when converted to strings and that may be a problem but I think you can simplify any function usin the simplifycommand in mupad, and you can tell the function in wich way (like polinomial and other stuff).Probably simply commadn would return the same "type" of equation, so the result may be comparable by strings. Not sure it would work, and if it does probably would not work 100% times, but it would be a pretty good aproachGravestone
I understand what you mean, but just like on paper, one has a sense of which expression is better depending on the number of factors and so on. That is why I thought CAS programs would know as well.Disconnect
M
0

It's easy in MAPLE, use general substitution command algsubs

> f:= x -> A*exp(B/x)
> g := diff(f(x), x)
> algsubs(A*exp(B/x) = F, g)

For more complex expressions, try collect

Myriammyriameter answered 23/4, 2013 at 21:3 Comment(1)
In MuPad, the function is named subsex. I haven't tried it yet, but I guess it is the most you can do to clean the expression up. Thanks.Disconnect

© 2022 - 2024 — McMap. All rights reserved.