Questions tagged [concatenation]

Questions on how to concatenate/join/merge lists/arrays of symbols/numbers/strings/etc. to obtain a given form of the output.

A good start: Combining Lists.

27 questions
11
votes
5 answers

Convert a list to an integer

How can we convert a list to an integer correctly? {5, 22, 4, 5} -> 52245? When I use the command FromDigits in Mathematica FromDigits[{5, 22, 4, 5}] The result is incorrect, namely 7245
ABCDEMMM
  • 1,816
  • 1
  • 9
  • 17
7
votes
2 answers

Joining Together Strings and variables

I am trying to join together strings and variables as part of formatting the output of my code. For example how do I print the line "5 trees" where the number 5 is a variable n that could be changing. I've tried the following, which doesn't work: …
lwcarani
  • 179
  • 1
  • 5
0
votes
1 answer

How to use Strings and Functions With Conditions

Very new to Mathematica so this might be really simple. I have the function pow[x_,r_]:= x^r where r is rational due to rationalQ[r_] := IntegerQ[Numerator[r]] && IntegerQ[Denominator[r]] I'm trying to use conditions so that when I test pow[0,0]…
user58133
  • 3
  • 1
0
votes
2 answers

How to concatenate functions and strings

I have f[x_]=Log[1+x] g[x_]=TraditionalForm[Series[f[x], {x, 0, 4}]] Is there a way to get the answer to print out as Ln(1+x) = x-x^2/2+x^3/3-x^4/4+O(x^5) I've tried to use StringJoin but this doesn't seem to work Thanks for the help in advance