MathGroup Archive 2009

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

Search the Archive

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

  • To: mathgroup at smc.vnet.net
  • Subject: [mg99978] Re: [mg99892] Re: saving initialization cells as a .m file
  • From: dh <dh at metrohm.com>
  • Date: Wed, 20 May 2009 05:33:05 -0400 (EDT)
  • References: <431629.95442.qm@web32705.mail.mud.yahoo.com>

Hi Baris,
here is a work around.
As SuperDagger,Dagger and Power all have predefined meaning, we are not 
using them. Instead we take something that looks similar. E.g. instead 
of Dagger we may use the letter "l" (or anything suitable).
Instead of Power, we use Superscript. Your operator SuperDagger, we 
rename to Super:
======================
Remove[l, Super];
Super[A_?MatrixQ] := Conjugate[Transpose[A]];
Super[A_?NumberQ] := A;
Format[Superscript[A_, l], Super[A_]];
Superscript[A_?MatrixQ, l] = Super[A];
=========================
Now, when you say:
t={{1,2},{3,4}}
Superscript[t,l] you will get:
{{1, 3}, {2, 4}}
The trouble with this is that using the short form of Subscript with 
Control-6 or Control-^, this does not enter Sunbscript[..]  but 
Power[..] and will not work.
Daniel



fractaldimension at yahoo.com wrote:
> Hi Daniel thank you for your response but unfortunately this didn't work for me. b^\[Dagger] // FullForm returns Power[b,\[Dagger]]. I guess since Power is Listable trying to define something like Power[b_List,\[Dagger]]:=Conjugate[Transpose[b]] doesn't work either.
> 
> I think Sjoerd is right and this is probably a bug. I am not exactly sure how to report a bug though. I remember that I've sent an email to bugs at wolfram.com (or bug at wolfram.com) in the past for another bug but nobody replied to me so I am not sure if that's the procedure.
> 
> best regards,
> Baris
> 
> 
> 
> --- On Mon, 5/18/09, dh <dh at metrohm.com> wrote:
> 
>> From: dh <dh at metrohm.com>
>> Subject: [mg99892] Re: saving initialization cells as a .m file
>> To: mathgroup at smc.vnet.net
>> Date: Monday, May 18, 2009, 6:18 AM
>>
>>
>> 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 
>>>         
>>
>>
>>
> 
> 
> 
>       
> 
> 
> 


-- 

Daniel Huber
Metrohm Ltd.
Oberdorfstr. 68
CH-9100 Herisau
Tel. +41 71 353 8585, Fax +41 71 353 8907
E-Mail:<mailto:dh at metrohm.com>
Internet:<http://www.metrohm.com>



  • Prev by Date: Re: Basic question about Mathematica Interface
  • Next by Date: Integrate Bug
  • Previous by thread: Re: Re: saving initialization cells as a .m file
  • Next by thread: Re: Re: Re: saving initialization cells as a .m file