568 Views
Asked by
Bumbble Commhttps://math.techqa.club/user/bumbble-comm/detail
At
Well this is basically the problem.
I want to evaluate a function but the variable x is defined inside a, so for some reason maple doesn't substitute 7 for x.
|\^/| Maple 17 (X86 64 LINUX)
._|\| |/|_. Copyright (c) Maplesoft, a division of Waterloo Maple Inc. 2013
\ MAPLE / All rights reserved. Maple is a trademark of
<____ ____> Waterloo Maple Inc.
| Type ? for help.
> a := 3*x+5;
a := 3 x + 5
> f := subs(val=a, x -> val);
f := x -> 3 x + 5
> f(7);
26
0
Bumbble Comm
On
a := 3*x + 5;
f := unapply(a, x);
And then call f(7); etc.
In the incorrect way you were trying before you were mixing up the global name x with the procedure's formal parameter x.
This is a Maple FAQ and the unapply command is intended for doing this kind of thing.
Using substitution works: