(* Fourier transform of c*1_[0,1) *)
unitft[c_,xi_]=If[xi==0,
c,
-((I c (1-Cos[2 π xi]+I Sin[2 π xi]))/(2 π xi))];
(* Nonlinear Fourier transform of c*1_[0,1) *)
unita[c_,xi_]=If[(c-π xi) (c+π xi)>0,
(E^(I π xi)) (Cosh[(Sqrt[(c-π xi) (c+π xi)])]-((I π xi Sinh[(Sqrt[(c-π xi) (c+π xi)])])/(Sqrt[(c-π xi) (c+π xi)]))),
(E^(I π xi)) (Cos[(Sqrt[-(c-π xi) (c+π xi)])]-((I π xi Sin[(Sqrt[-(c-π xi) (c+π xi)])])/(Sqrt[-(c-π xi) (c+π xi)])))];
unitb[c_,xi_]=If[(c-π xi) (c+π xi)>0,
((c (E^(-I π xi)) Sinh[(Sqrt[(c-π xi) (c+π xi)])])/(Sqrt[(c-π xi) (c+π xi)])),
((c (E^(-I π xi)) Sin[(Sqrt[-(c-π xi) (c+π xi)])])/(Sqrt[-(c-π xi) (c+π xi)]))];
(* Left endpoints of intervals [k,k+1) of the step function f *)
int={0,1,2,3,4,5};
(* Coefficients i.e. heights of the step function f *)
coef:=alpha {-1,8,7,-6,5,-3};
Clear[ft,nft];
(* Fourier transform of f *)
ft:=(Sum[unitft[coef[[i]],#] E^(-2Pi I int[[i]] #),{i,1,Length[int]}])&;
(* Nonlinear Fourier transform of f *)
nft:=(prd=(({{1, 0}, {0, 1}}));
For[i=1,i≤Length[int],i++,
prd=prd.(({{unita[coef[[i]],#], unitb[coef[[i]],#] E^(-2Pi I int[[i]] #)}, {Conjugate[unitb[coef[[i]],#]] E^(2Pi I int[[i]] #), Conjugate[unita[coef[[i]],#]]}}))];
prd)&;

(* Linear for alpha = 0.01 *)
alpha=0.01;
Print["Linear FT for alpha = ",alpha];
q=4;
Print["L^",q," norm of the linear FT = ",N[Abs[NIntegrate[Abs[ft[xi]]^q,{xi,-∞,∞},WorkingPrecision->1000,AccuracyGoal->14]]^(1/q),10]];
Plot[Abs[ft[xi]],{xi,-3.5,3.5},PlotRange->{{-3.5,3.5},{0,0.17}},PlotStyle->{Black,Thick},ImageSize->400,Axes->{True,True},Ticks->{{-3,-2,-1,0,1,2,3},{0.05,0.15}},LabelStyle->{FontFamily->"Times",FontSize->17}]

(* Nonlinear for alpha = 1 *)
alpha=1;
Print["Nonlinear FT for alpha = ",alpha];
Plot[Abs[Log[Abs[nft[xi][[1,1]]]^2]]^(1/2),{xi,-3.5,3.5},PlotRange->{{-3.5,3.5},{0,8}},PlotStyle->{Black,Thick},ImageSize->400,Axes->{True,True},Ticks->{{-3,-2,-1,0,1,2,3},{1,2,3,4,7}},LabelStyle->{FontFamily->"Times",FontSize->17}]

(* Nonlinear for alpha = 0.5 *)
alpha=0.5;
Print["Nonlinear FT for alpha = ",alpha];
Plot[Abs[Log[Abs[nft[xi][[1,1]]]^2]]^(1/2),{xi,-3.5,3.5},PlotRange->{{-3.5,3.5},{0,5.5}},PlotStyle->{Black,Thick},ImageSize->400,Axes->{True,True},Ticks->{{-3,-2,-1,0,1,2,3},{1,2,5}},LabelStyle->{FontFamily->"Times",FontSize->17}]

(* Nonlinear for alpha = 0.1 *)
alpha=0.1;
Print["Nonlinear FT for alpha = ",alpha];
Plot[Abs[Log[Abs[nft[xi][[1,1]]]^2]]^(1/2),{xi,-3.5,3.5},PlotRange->{{-3.5,3.5},{0,1.7}},PlotStyle->{Black,Thick},ImageSize->400,Axes->{True,True},Ticks->{{-3,-2,-1,0,1,2,3},{0.5,1.5}},LabelStyle->{FontFamily->"Times",FontSize->17}]

(* Nonlinear for alpha = 0.01 *)
alpha=0.01;
Print["Nonlinear FT for alpha = ",alpha];
q=4;
Print["L^",q," norm of the nonlinear FT = ",N[Abs[NIntegrate[Abs[Log[Abs[nft[xi][[1,1]]]^2]]^(q/2),{xi,-∞,∞},WorkingPrecision->1000,AccuracyGoal->14]]^(1/q),10]];
Plot[Abs[Log[Abs[nft[xi][[1,1]]]^2]]^(1/2),{xi,-3.5,3.5},PlotRange->{{-3.5,3.5},{0,0.17}},PlotStyle->{Black,Thick},ImageSize->400,Axes->{True,True},Ticks->{{-3,-2,-1,0,1,2,3},{0.05,0.15}},LabelStyle->{FontFamily->"Times",FontSize->17}]