Message Boards Message Boards

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

Plot f[x_,f[x_]]

Posted 8 years ago

Dear all,

I'm a Mathematica beginner and I'm struggling with plotting a nested function.

I have a function f[x,p] - and the variable p is also a function of x. So I basically want to plot a function f[x,f[x]]. So far, I have tried the following things:

a) First, I defined the variable p=... such that if I enter p, I get the right expression with the unknown parameter x. Second, I entered the function f[x,p] - but I do not get any output for that.

b) I defined a function h[x] instead of the variable p and substituted all p in f[x,p] by h[x], such that f[x,h[x]]=... is a function of x and h[x] which leads to the error "pattern x appears on the right hand side.

c) Finally, I plugged the expression of h[x] in f[x,h[x]] such that I only have f[x]. But in this case I get "construct pure function".

I am happy for any hint!

Thank you in advance

Patrick

POSTED BY: Pee Wee
3 Replies
Posted 8 years ago

Thanks, Tom, that solved the issue! I didn't know that I have to substitute x_ by i for plotting it...

POSTED BY: Pee Wee

You used notation: $f[x,f[x]]$ - does this make any sense? Your first f depends on 2 arguments but second f depends just on 1 argument? Why are you not posting actual functions and code that you are using? It gives me impression that you did not really try to actually code it or did not describe actual issue, because there are no problems in plotting nested functions:

Plot[JacobiSN[JacobiSN[x, 1/3], 1/3], {x, -10, 10}]

enter image description here

POSTED BY: Sam Carrettie
Posted 8 years ago

Is it the very same function? Did you try straightforward definition and plotting like this?

f[x_] := x^2;
g[x_] := f[x]*2;

Plot[g[f[i]], {i, 1, 100}]
POSTED BY: Tom Zinger
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