Re: saving initialization cells as a .m file
- To: mathgroup at smc.vnet.net
- Subject: [mg99875] Re: saving initialization cells as a .m file
- From: "Sjoerd C. de Vries" <sjoerd.c.devries at gmail.com>
- Date: Mon, 18 May 2009 02:30:17 -0400 (EDT)
- References: <guj87p$hr4$1@smc.vnet.net>
Hi Baris,
I think this is a Mathematica bug involving SuperDagger.
SuperDagger[x] prints as an x with a superscripted dagger.
When you type x ctrl-^ esc dg esc == SuperDagger[x] you get True.
However, x ^ esc dg esc (without ctrl together with ^) prints as
something very similar, but it isn't. Check the two for equality and
you get False. Internally, the first one is represented as SuperDagger
[x] and the second one as Power[x, \[Dagger]].
Now, the bug is that if you copy the real SuperDagger (x ctrl-^ esc dg
esc) to a text file, it is stored as ^\[Dagger]. If this is read in on
its turn it is interpreted as a dagger power which doesn't work.
Mathematica should have copied it as SuperDagger[ ].
If I run the code directly as shown in your post I get the same error
you are reporting. If I replace the dagger with the ctrl-^ version it
works. So, the workaround is changing the f[t]^\[Dagger] part in
your .m file in SuperDagger[f[t]].
I guess you should send in a bug report.
Cheers -- Sjoerd
On May 15, 10:13 am, Baris Altunkaynak <fractaldimens... at yahoo.com>
wrote:
> Hi,
>
> I have the following code which runs fine in a notebook:
>
> SuperDagger[A_List] := Conjugate[Transpose[A]]
> eqn = {f'[t] == -f[t]^\[Dagger].f[t], f[0] == RandomReal[{0, 0.=
1}, {3, 3}]};
> NDSolve[eqn, f, {t, 0, 10}]
>
> but when I save the first two lines (definition of SuperDagger and eqn) i=
n a .m file and load them with a Get command, although Mathematica loads th=
e definitions, NDSolve doesn't like the input and complains that derivative=
at t=0 is not defined. Weirdly if I copy and paste the output of NDSolve=
and evaluate it, it runs fine. Do you know how can I fix this?
>
> best regards,
>
> Baris Altunkaynak