Drexel dragonThe Math ForumDonate to the Math Forum



Search All of the Math Forum:

Views expressed in these public forums are not endorsed by Drexel University or The Math Forum.


Math Forum » Discussions » Software » comp.soft-sys.math.mathematica

Topic: How to convert the expression 3*x to a function in Mathematica?
Replies: 2   Last Post: Oct 22, 2012 2:11 AM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
pw

Posts: 14
Registered: 10/3/12
Re: How to convert the expression 3*x to a function in
Posted: Oct 22, 2012 2:11 AM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

On 10/20/2012 11:10 PM, pedro_fr_22@hotmail.com wrote:
> In doing a program in Mathematica that receives an expression called f and converts it to a function. However the command Function[x,f] doesn't work, what do I do?
>
>


(*---The Function Declaration---*)

MyFunction[x_, c_] := x*c



(*---Calling The Function---*)

x = 12


B = MyFunction[x , 3]





Or if you always want to multiply by 3,

MyFunction[x_] := x*3

x = 12

B = MyFunction[x]



Peter




Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2014. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.