MathGroup Archive 2009

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: saving initialization cells as a .m file

  • To: mathgroup at smc.vnet.net
  • Subject: [mg99892] Re: saving initialization cells as a .m file
  • From: dh <dh at metrohm.com>
  • Date: Mon, 18 May 2009 06:18:26 -0400 (EDT)
  • References: <gum0er$q4k$1@smc.vnet.net>


Hi Baris,

if you want b^\[Dagger] to mean SuperDagger[b] internall, you may define 

this e.g. by:



Clear[SuperDagger, A];

SuperDagger[A_List] := Conjugate[Transpose[A]];

Format[A_^\[Dagger], SuperDagger[A_]];

SuperDagger /; A_^\[Dagger] := SuperDagger[A];



The Format line ensures that Dagger is printed instead of SuperDagger. 

The next line transforms an input of SuperDagger to Dagger. You may 

check the working by:



b =.;

SuperDagger[b]

b^\[Dagger] // FullForm



Daniel



Baris Altunkaynak wrote:

> Hi thank you for your response, I actually copied this from a working notebook. I used Ctrl+^ Esc dg Esc to get the dagger symbol and when I copy and paste it in the email it becomes this. Also in the .m file it looks the sam e way. So I guess that's why it doesn't work.  Is there anyway to do this without typing the full function name? I want to keep the notation because I have really really long equations to enter which I would like to finally convert to a .m file and the notation is the most important thing for me.  best regards, Baris

> 

>      --- On Fri, 5/15/09, dh <dh at metrohm.com> wrote:  >

> From: dh <dh at metrohm.com 

> Subject:  Re: saving initialization cells as a .m file 

> Date: Friday, May 15, 2009, 6:26 AM

> 

> Hi Baris,

> f[t]= ^\[Dagger] does not apply SuperDagger. 

> You would have to say SuperDagger[f[t]] 

> Daniel 

> 

> Baris Altunkaynak 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) in a .m file and load them with a Get 

> command, although Mathematica loads the 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 

>        

> 




  • Prev by Date: Use of names
  • Next by Date: Re: How to resize elements in GraphicsGrid
  • Previous by thread: Re: saving initialization cells as a .m file
  • Next by thread: Re: Re: saving initialization cells as a .m file