Register to reply

Mathematica beginner question: Function nesting

by physicsan
Tags: nesting function
Share this thread:
Nov23-11, 09:21 AM
P: 2
I'm quite new to Mathematica and stuck at a point, where I have searched for hours to find a solution, but there seems no way out.

Let's say we have two functions,

How can a build a function f3, which is e.g. the sum of the other functions f1 and f2, i.e. f3[x_, y_]=x+y+x*y, but without copy&paste, but with direct dependency on f1 and f2?

With f3=f1[x,y]+f2[x,y], the functional dependency on x and y is missing. I need a f3, which also has the same input arguments as f1 and f2 (namely x and y).
With f3[x_,y_]==f1[x,y]+f2[x,y] the functional dependency on the parameters is also not working.

Thanks you for your help,
I'm really desperate :(
Phys.Org News Partner Science news on
Experts defend operational earthquake forecasting, counter critiques
EU urged to convert TV frequencies to mobile broadband
Sierra Nevada freshwater runoff could drop 26 percent by 2100
Nov23-11, 09:29 AM
P: 2,179
I think that you don't understand the difference between =(immediate assignment), :=(delayed assignment) and == (test for equality). You want to use := in function assignments so that the assignment is not made until you request evaluation. Try the attached notebook - I think it does what you want.
Attached Files
File Type: nb Functions.nb (3.8 KB, 10 views)
Nov23-11, 04:49 PM
P: 2

a thousand thanks! This is exactly what I was looking for! Sorry for my dummy question, it really seems so dummy now :s
Thank you again for your profound and amazingly fast help, you really made my day! :)

Nov23-11, 05:33 PM
P: 2,179
Mathematica beginner question: Function nesting

You're welcome. Glad I could help.

Register to reply

Related Discussions
Mathematica Beginner question: Nested loops Math & Science Software 6
Beginner Function Calling Question Programming & Computer Science 2
Beginner to Mathematica's question! using Module! Math & Science Software 1
Innanely stupid beginner Mathematica question Math & Science Software 0
Mathematica question - Beginner. Math & Science Software 4