# Why in Mathematica and Wolfram Engine the result of this code is different?

f[x_] := Evaluate[Input["Enter a function to sum or integrate:"]]
Print[f[t]]


After starting, I enter x^2. Mathematica outputs $$t^2$$ while Wolfram Engine outputs f[t].

I am trying to execute the following script:

f[x_] := Evaluate[Input["Enter a function to sum or integrate:"]]
Print[f[t]]
g[z_] := Integrate[f[t], {x, 0, z}, {t, 0, x}]
Print["Irregular part of integral or sum in omegas is"]
Print[Evaluate[f[t]]]
Print[FullSimplify[Evaluate[Expand[g[ω_p] - g[ω_m]]] /. ω_p - ω_m -> 1 /.
ω_m - ω_p -> -1, {ω_p > 0, ω_m > 0}] /. ω_p - ω_m -> 1 /.
ω_m - ω_p -> -1]
Print["Irregular part of integral or sum in taus is"]
FullSimplify[%% /. ω_m -> τ - 1/2 /. ω_p -> τ + 1/2]
Print["Regular part of sum is"]
FullSimplify[(1/2)*f + I*Integrate[(f[I*t] - f[(-I)*t])/(E^(2*Pi*t) - 1), {t, 0, Infinity}]]
Print["Regular part of integral is (attempt)"]
FullSimplify[(I/2)*Integrate[(f[I*t] - f[(-I)*t])/(1 - E^(-2*Pi*t)), {t, 0, Infinity}] -
(I/2)*Integrate[(f[I*t] - f[(-I)*t])/(E^(2*Pi*t) - 1), {t, 0, Infinity}]]
Print["Laplace transform of f[x] (for comparison) is"]
FullSimplify[(I/2)*FourierTransform[f[I*t]*Sign[t], t, x, FourierParameters -> {1, -1}]]

• Maybe you need Jupyter notebook etc. as the front end of Wolfram Engine. Nov 20, 2020 at 0:11
• Works fine for me, on command line, Win 10...
– ciao
Nov 20, 2020 at 1:13
• @ciao I am running a script, this is not interactive mode Nov 20, 2020 at 1:13
• @Anixx - then you should state so in your op. In any case, works fine for me in a script also.
– ciao
Nov 20, 2020 at 1:28
• @Anixx: I suggest reviewing the Wolfram language tutorial. The script as presented is a hot mess, frankly. For example, using Out references here is just horrific practice, in addition to yours in one case referring to the output of Print, which is of course null here. Nonetheless, your original question was answered: the engine behaves as expected both interactively and from a script execution in my quick test.
– ciao
Nov 20, 2020 at 2:04