Message Boards Message Boards

0
|
3130 Views
|
3 Replies
|
2 Total Likes
View groups...
Share
Share this post:

Enumarate and combine functions?

Posted 7 years ago

How do you enumerate functions? Can i just enumarte them like that:

f1[x[1],x[2],...]=...
f2[x[1],x[2],...]=...

and how do I combine the functions afterwards? I tried it this way, but didnt work:

L[x[1],x[2],...]=f1[x[1],x[2],...]*f2[x[1],x[2],...]...

is this the right way, somehow I'm getting wrong results. Thank you!

POSTED BY: Jakob Weiler
3 Replies

I don't quite understand what you expect as an output. Maybe this:

In[166]:= f1[x1_, x2_] := x1*x2;
f2[x1_, x2_] := x1 + x2;
L[x1_, x2_] := f1[x1, x2]*f2[x1, x2];
L[x1, x2]

Out[169]= x1 x2 (x1 + x2)

You can also try ?L to see the formula associated with the function L.

POSTED BY: Gianluca Gorni
Posted 7 years ago

I tried this, but Mathematica still doesn't output the resulting function. But when I input values it puts out the correct result.

L[1,2]=6

But how can I make Mathematica output the resulting function?

POSTED BY: Jakob Weiler

I would do it like this:

f1[x1_, x2_] := x1*x2;
f2[x1_, x2_] := x1 + x2;
L[x1_, x2_] := f1[x1, x2]*f2[x1, x2]
POSTED BY: Gianluca Gorni
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract