# How to generate alphabetical parameters in differential solution results

I want to generate alphabetical parameters in the differential solution as shown in the figure below: $$\left(\frac{\mathrm d^2}{\mathrm d r^2}+\frac1{r}\frac{\mathrm d}{\mathrm d r}\right)\left(\frac{\mathrm d^2\phi}{\mathrm d r^2}+\frac1{r}\frac{\mathrm d\phi}{\mathrm d r}\right)=0$$

$$\phi=A\ln r+B r^2\ln r+C r^2+D$$ But I get a lot of error warnings when I do this:

L = (D[#, {r, 2}] + 1/r D[#, r]) &;
f[i_] := FromCharacterCode[i + 64]
DSolve[L[(D[φ[r], {r, 2}] + 1/r D[φ[r], r])] ==
0, φ[r], r, GeneratedParameters -> f]


What can I do to solve this problem better?

• Note that C, D, E, I, etc. are System  symbols, usually with built-in definitions that will cause trouble later. Best to avoid capitals. Perhaps formal capitals?: DSolve[y''[x] == 3 y[x] y'[x] + (3 y[x]^2 + 4 y[x] + 1), y[x], x] /. C[i_] :> FromCharacterCode[ i + 1 + ToCharacterCode["\[FormalCapitalA]"]] – Michael E2 Apr 25 '20 at 15:07

Two issues

1. Define f for Integer.
2. Return a Symbol.

Technically you can return the string as you are now but you will run into issues down the line.

ClearAll[f]
L = (D[#, {r, 2}] + 1/r D[#, r]) &;
f[i_Integer] := Symbol@FromCharacterCode[i + 64]


Then

DSolve[L[(D[φ[r], {r, 2}] + 1/r D[φ[r], r])] == 0, φ[r], r, GeneratedParameters -> f] without errors.

Hope this helps.

PS: You may also run into issues with symbols like C and I. This is why it is not recommended to define symbols (outside of packages) that start with capital letters. See here.

• Thank you very much. In addition, how to generate independent parameters like those in the picture of this problem (for example, only one parameter C)? – A little mouse on the pampas Mar 17 '20 at 2:02
• Try ClearAll[f]; f[i_Integer] := Subscript[\[DoubleStruckF], i]. See the Special Characters guide. – Edmund Mar 17 '20 at 2:23

Why not replacing afterwards?:

i = 65;
DSolve[L[(D[φ[r], {r, 2}] + 1/r D[φ[r], r])] == 0, φ[r], r] /.
C[_] :> FromCharacterCode[i++] • This approach does not work on DSolve[y''[x] == 3 y[x] y'[x] + (3 y[x]^2 + 4 y[x] + 1), y[x], x]. Better to use DSolve[y''[x] == 3 y[x] y'[x] + (3 y[x]^2 + 4 y[x] + 1), y[x], x] /. C[i_] :> FromCharacterCode[i + 64]`, though it's better to avoid capitals. – Michael E2 Apr 25 '20 at 15:04