# Evaluate an expression at a specific point

In Maple, you right click and can evaluate an expression (whatever it is) at a specific point say:

Expr.= abcddafjosjfoj, then right click and simply evaluate at c=-34 say. But how does one do the correspoinding operation in Mathematica? Must one define a function first for this simple task?

• Right click and then evaluate c=-34? Huh, because c is present in abcddafjosjfoj? What do you mean? If there were spaces between the characters here, you could use the menu item evaluate in place. Jun 5 '13 at 15:40
• Yes exactly you right click whatever expression you like and evaluate at whatever you like. So my question is how to do that in Mathematica? Jun 5 '13 at 15:41
• For instance if I have an expression called E so that E=abcde...*f, then I right click on it and evaluate at point c=-34 so that E becomes E=-34*abd*...*f. Nice and simple, but what is the corr. operation in Mathematica? Jun 5 '13 at 15:45
• I added an image - is this what you're describing? Jun 5 '13 at 15:52
• Yes exactly cormullion. Great job! Jun 5 '13 at 15:54

In Mathematica this can be done any number of different ways, but the spirit of your question suggests replacement rules as the solution you're looking for.

Consider x (a delayed expession; will re-evaluate RHS each time 'x' is evaluated)

x := 4*c^2


Now use ReplaceAll (shorthand notation is /.) and a Rule (shorthand notation is ->)

x /. c -> 2.5

(*25.*)


Note you can also try a number of these at once:

x /. c -> {2.5, 3, 8}

(*{25., 36, 256}*)


See the docs on ReplaceAll and Rule for more examples. An alternative approach would be to define a function and pass values explicitly.

• I think you nailed it bro. I'll try it out and comment soon. Jun 5 '13 at 15:50