2
$\begingroup$

I'm very new to Mathematica and I need it to create a (simple) theoretical model.

I'm struggling to plot graphic b[a[x]] after having defined a[x], so far my code is:

a[x_] := Exp[x]; 
b[x_] := (a[x]/(a[x] + 1))^(1 - 3/10);
Plot[b[x], {x, -3, 3}]

What am I missing? Thank you in Advance!

$\endgroup$
3
  • 2
    $\begingroup$ Did you try to restart Mathematica? $\endgroup$
    – Lukas Lang
    Jun 19, 2018 at 15:16
  • $\begingroup$ I just did, Thank you very much! It is working $\endgroup$
    – MarV
    Jun 19, 2018 at 15:21
  • $\begingroup$ Your question may be put on-hold as it seems to be off-topic, i.e it arises from a simple mistake (Needed a fresh Kernel) and is unlikely to help any future visitors, or else it is easily found in the documentation. Don't be discouraged by that cleaning-up policy. Your future good questions are welcome. Learn about common pitfalls here. $\endgroup$
    – rhermans
    Jun 19, 2018 at 16:29

1 Answer 1

0
$\begingroup$

Is this what you want?

a[x_] := Exp[x];
b[x_] := (a[x]/(a[x] + 1))^(1 - 3/10);

Plot[b[a[x]], {x, -3, 3}]

Mathematica graphics

Hope that helps.

Edit

I took your first line literally. As @roman465 suggests do you just want b[x] ?

If so

Plot[b[x], {x, -3, 3}]

Mathematica graphics

Is this what you need? Can't see why it did not work for you although comments now suggest that restarting worked. Before defining a function then ClearAll is useful to remove previous definitions. I would have done

ClearAll[a, b];
a[x_] := Exp[x];
b[x_] := (a[x]/(a[x] + 1))^(1 - 3/10);
$\endgroup$
5
  • $\begingroup$ It doesn't seem to be working still.. And I copied your code. I don't understand if it's a fault in my programme. $\endgroup$
    – MarV
    Jun 19, 2018 at 15:14
  • $\begingroup$ @Hugh notice that b[x] (what OP is actually asking) and b[a[x]] are different functions. $\endgroup$
    – user45937
    Jun 19, 2018 at 15:48
  • $\begingroup$ @roman465 I added an edit. Thanks for noting the alternative interpretation. $\endgroup$
    – Hugh
    Jun 19, 2018 at 15:57
  • $\begingroup$ Thank you both for your help. If my code was correct it must've been that the variables where defined somewhere else or that the programme had too many pages opened. Thank you for your help ! $\endgroup$
    – MarV
    Jun 19, 2018 at 16:17
  • $\begingroup$ @MarV Happy to help. The standard approach for you now is wait for a day or so and if you don't get a better answer then accept mine and the case is then nicely closed. You also might like to see how to post code etc. Welcome to Mathematica stack exchange. $\endgroup$
    – Hugh
    Jun 19, 2018 at 16:21

Not the answer you're looking for? Browse other questions tagged or ask your own question.