Trustar
Trustar

Reputation: 11

Evaluating an expression in maple

I have a complicated expression in maple which depends on four real parameters, say a,b,c,d. Let us call this expression f(a,b,c,d). This expression consists of derivatives, definite and indefinite integrals of hyperbolic functions. By indefinite integral I mean expressions like Int(g(x),x). The expression f is to big for maple to write out, and I would therefore like to evaluate it numerically for different values of a,b,c and d. I tried doing evalf(value(f(a1,b1,c1,d1)), but this never terminates in maple, which I guess means that maple first tries to simplify f algebraically and then plugs in the real values a1,b1,c1, and d1.

Could someone please help me with this?

Upvotes: 1

Views: 1544

Answers (2)

Sourabh Bhat
Sourabh Bhat

Reputation: 1893

After the symbolic manipulation Maple will return an expression in terms of other variables for example:

diff(x^2 + 2, x);  will return "2 x"

now if you write evalf(%), it will not be able to evaluate to any numerical value because it does not know the value of x. Therefore you have to first use subs() function to substitute the value of x where you want to evaluate the resulting expression.

Thus, in your case it will be subs([x=2, y=5], f(a, b, c, d)) assuming that the evaluated expression has variables x and y.

Upvotes: 1

Carl Love
Carl Love

Reputation: 1471

Remove the value command. It tries to evaluate your integrals symbolically, which is probably impossible. Just use evalf.

Upvotes: 0

Related Questions