0

I am new to Mathematica and I am having trouble defining a certain composition of functions.

Let m1 and m2 be maps such that m1: R^2 -> R^2 and m2:R^2->R^1 where R is the real line

m1[eta_, zeta_] = {eta^3, zeta^3} m2[x_, y_] = x^2 + y^2 m3[eta_, zeta_] = Composition[m2, m1][eta, zeta] 

On evaluating the last line, i.e. shift+enterI get the output

m2[{eta^3, zeta^3}] 

But the anwer to this should be m3[eta,zeta]=eta^6 + zeta^6

How can I do this?

1
  • 1
    This is the second time you've cross posted a question with minutes of each other. Please give people a chance to answer, first! Commented Jan 10, 2013 at 16:23

2 Answers 2

1

Your function m1 returns a list containing 2 elements, whereas your function m2 requires 2 arguments. Change either what m1 returns or what m2 expects. In this case it might be easier to redefine m2 as

m2[{x_, y_}] = x^2 + y^2 

The clue is that m2[{eta^3, zeta^3}] is just the sort of output Mathematica gives when you provide the wrong sort of arguments to a function -- it returns the input expression unevaluated. You'll see this a lot as you learn.

Oh, and you probably want to use SetDelayed (generally written as :=) rather than Set (or =) in your function definitions. See the documentation for why you probably want this.

Sign up to request clarification or add additional context in comments.

Comments

1

Write: m3[eta_, zeta_] = m2@@m1[eta,zeta]

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.