I discovered some very strange behavior, which leads to strange errors. Hope you can explain it for me. It might be a bug.
So, i created a package, where i prepare set of equations to use in NDSolve. Let it be very simple one as an example:
BeginPackage["ErrorPrime2Package`"];
getEqtn::usage = "Get the equation";
Begin["`Private`"];
eq = {
(y^\[Prime]\[Prime])[x] == y[x],
y[0] == 0,
Derivative[1][y][0] == 0
};
funcs = {y};
getEqtn = {eq, funcs, x};
End[];
EndPackage[];
Then in a separate file i load this package and use getEqtn from it:
Needs["ErrorPrime2Package`"];
{eqns, funs, varx} = getEqtn;
NDSolve[eqns, funs, {varx, 0, 1}]
But when i run NDSolve, it gives me error "The function ErrorPrime2Package`Private`y appears with no arguments."
It is very confusing, because as you may see, any y has an [x] argument. So, where is the problem?
If you look at eqns variable:
{(ErrorPrime2Package`Private`y^
ErrorPrime2Package`Private`\[Prime]\[Prime])[
ErrorPrime2Package`Private`x] ==
ErrorPrime2Package`Private`y[ErrorPrime2Package`Private`x],
ErrorPrime2Package`Private`y[0] == 0,
Derivative[1][ErrorPrime2Package`Private`y][0] == 0}
As you can see, for some reason i can't understand there is ErrorPrime2Package`Private` part appear before the first \Prime. Why is it there?
You can avoid this error if use '' or \DoublePrime instead, with them everything works fine.
Feel free to ask me clarifying questions if something is not clear in my description.
y''[x]
not(y^\[Prime]\[Prime])[x]
$\endgroup$ – Kuba♦ May 14 '18 at 15:36y''
, evaluate it, copy the contents of the output cell, then paste it into a plain text editor, you gety^\[Prime]\[Prime]
. However, this is not correct in the sense that it is not equivalent to the original input (in fact it's nonsense). I would call this copying behaviour a bug. $\endgroup$ – Szabolcs May 14 '18 at 15:49y^\[Prime]\[Prime]
in the package or the 2D form of it (I mean something that you obtained by pressingCtrl+Shift+N
)? If the former, it's invalid anywhere, not only in the package. $\endgroup$ – xzczd May 14 '18 at 15:51StandardForm
(Ctrl+Shift+N
etc.) it becomes meaningful again, but this design is indeed a bit annoying. $\endgroup$ – xzczd May 14 '18 at 15:54