Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

I have the following code

Style["("
  InputField[Dynamic[t], Number, ImageSize -> 30]
  ")=" 
  PDF[NormalDistribution[μ, σ], t],
  16]

which doesn't result in

"f(inputfield) = result of PDF calculations based on input"

Any ideas?

share|improve this question

closed as off-topic by Kuba, Sjoerd C. de Vries, Nasser, m_goldberg, bobthechemist Jan 25 at 2:34

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "This question arises due to a simple mistake such as a trivial syntax error, incorrect capitalization, spelling mistake, or other typographical error and is unlikely to help any future visitors, or else it is easily found in the documentation." – Sjoerd C. de Vries, Nasser, m_goldberg, bobthechemist
If this question can be reworded to fit the rules in the help center, please edit the question.

2  
No code formating after 7 questions? Does'nt look like you've put much effort into this Q... –  Ajasja Jan 24 at 20:22
    
?? I've read and tried for the past two hours - wondering if I'm missing something easy or obvious - or trying to do something the wrong way. –  Fred Schenkelberg Jan 24 at 20:40
1  
No, no, I'm talkinig about the time you needed to write the Q. It's very polite to at least format the code you present using either 4 spaces or ``. In the other questions somebody else has taken the time to do that for you. Good formating will increase the chance of a good A. –  Ajasja Jan 24 at 21:24
2  
Ajasja is talking about post formatting. About the question, I think you should keep in mind one commonly quoted phrase: everything is an expression. What your code does is multiplying the parts in Style`s first argument. Take a look ar Row, Grid and related tutorials, e.g: tutorial/FormattedOutput. –  Kuba Jan 24 at 21:25
    

1 Answer 1

You cannot simply put random expression or strings separated by a space in a sequence, because Mathematica interprets this as multiplication:

"oh" "my" "god"
(* "god" "my" "oh" *)

What you probably want is

Style[Row[{"f(", InputField[Dynamic[t], Number, ImageSize -> 30], 
   ")=", Dynamic@PDF[NormalDistribution[\[Mu], \[Sigma]], t]}], 16]

which uses Row.

Mathematica graphics

share|improve this answer

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