>
> My impression is that you apply conjugation only 
> to exponentials with imaginary arguments, then ad-hoc function 
> to negate exponent my do: 
>

In this case it is true, but generally it is not. 
Anyway, this is not something to worry about right now

Using your suggestions I was able to advance to eq. (9).
The next thing I need is to substitute eqns. (10) and (12) into (9).

My idea is to use substitution rules.
For xi ( eq. 10 ) it may look like

  xi_rule := rule xi(t) == Up * t - beta * sin( 2 * omg * t )

However, the application of xi_rule works only for Real-valued exponents 

(16) -> xi_rule( exp( xi(t) ) )

           - beta sin(2omg t) + Up t
   (16)  %e
                                                    Type: 
Expression(Integer)
and fails for complex-valued

(17) -> xi_rule( exp( %i * xi(t) ) )
Cannot find a definition or applicable library operation named 
      xi_rule with argument type(s) 
                        Expression(Complex(Integer))

I was able to bypass this using the following definition

complex_xi_rule := rule xi( complex(t,0) ) == Up * t - beta * sin( 2 * omg 
* t )

(17) -> complex_xi_rule( exp( %i * xi(t) ) )

           - %i beta sin(2omg t) + %i Up t
   (17)  %e
                                           Type: 
Expression(Complex(Integer))
But it doesn't look like the right way to do it.

Eq. (12) is a bigger problem however.
It is necessary to define an identity

  exp( i * z * sin( theta ) ) = sum_{ N = -infty }^{+ infty }  BesselJ_N( z 
) * exp( i * N * theta )

( see http://en.wikipedia.org/wiki/Jacobi–Anger_expansion )
My first idea was to use streams to represent infinite summations.
Unfortunately, stream constructor of the form

  [ besselJ(N, a) * exp( %i * N * t ) for N in 
%minusInfinity..%plusInfinity ]

doesn't allow %plus- and %minusInfinity as it's limits.  

My second attempt was to define a rule without summation

  exp_to_bessel_rule := rule exp( %i * z * sin( t ) ) == besselJ(N, z) * 
exp( %i * N * t )

This is not the best idea, since in the case of expression  

  exp( i * z * sin( theta ) ) * exp( i * x * sin( phi ) ) 

I'll get identical summation indices after substitution.
But I was not able to apply even such simple rule:

 (22) -> exp_to_bessel_rule := rule exp( %i * z * sin( t ) ) == besselJ(N, 
z) * exp( %i * N * t )

           %i z sin(t)                   %i N t
   (22)  %e            == 'besselJ(N,z)%e
     Type: 
RewriteRule(Integer,Complex(Integer),Expression(Complex(Integer)))
(23) ->  exp_to_bessel_rule( exp( %i * z * sin(t) ) )

           %i z sin(t)
   (23)  %e
                                           Type: 
Expression(Complex(Integer))

So, how do I do the substitution? 



пятница, 18 апреля 2014 г., 19:57:09 UTC+4 пользователь Waldek Hebisch 
написал:
>
> a.a.letterbox wrote: 
> > 
> > I want to reproduce analytical calculations from an attached pdf-file 
> with 
> > FriCAS. 
> > 
> > The calculations look rather lengthy, but I do not want (yet) FriCAS to 
> > perform them fully automatically. 
> > Rather, I'd like to reproduce each step manually in an interactive 
> regime. 
> > This should be doable, since it doesn't require anything beyond basic 
> > substitution capabilities and arithmetics. 
> > 
> > My first goal is to reproduce everything in a text regime. 
> > Then I want to do the same using TeXmacs for nice formatting. 
> > Finally I need to output the resulting equation into C or Fortran, or 
> some 
> > other form, suitable for numerical computation. 
> > 
> > So far, my progress was rather limited. 
> > 
> > The first thing to do is to define eq.(1) inside FriCAS. 
> > For this it is necessary do define eqs (3) and (6). 
> > Eq. (3) can be represented by ( see also 'laser_e2e_on_h.input' attached 
> ) 
> > 
> > E := operator 'E 
> > xi := operator 'xi 
> > alpha := operator 'alpha 
> > volkov_wave(r, p, t) == _ 
> >   exp( %i * ( p * r - alpha(p) * cos( omg * t ) - E(p) * t - xi(t) ) ) 
> > 
> > Most of the time I'm not interested in exact expressions for E, xi and 
> > alpha, so I just define them as operators. 
> > However, an attempt to evaluate a complex conjugate 
> > 
> >   conjugate( volkov_wave(r,p,t) ) 
> > 
> > leads to an error. Presumably, I should tell FriCAS, that E, xi and 
> alpha 
> > are not just operators but Complex-valued functions. 
> > How do I do this? 
>
> Currently FriCAS can compute conjugate only if expression is explicitely 
> in rectangular form (more procisely of type Complex(something)). 
> You can convert expression to this form using 'complexForm', but 
> AFAICS you do not want this (this will spoil further calculations). 
> In your case one possibility is to use operator to represent 
> conjugation.  My impression is that you apply conjugation only 
> to exponentials with imaginary arguments, then ad-hoc function 
> to negate exponent my do: 
>
> my_conj(x) == (k := x::Kernel(Expression(Complex(Integer))); _ 
>   is?(k, exp) => operator(k)(-first(argument(k))); error "not exp") 
>
> (21) -> my_conj(volkov_wave(r_0, p_s, t))                                 
>   
>    Compiling function my_conj with type Expression(Complex(Integer)) 
>        -> Expression(Complex(Integer)) 
>
>            %i alpha(p_s)cos(omg t) + %i xi(t) + %i t E(p_s) - %i p_s r_0 
>    (21)  %e 
>                                            Type: 
> Expression(Complex(Integer)) 
>
> > Another couple of questions concern exponents manipulation. 
> > By default FriCAS performs multiplication in exponents of the form exp( 
> %i 
> > (a + b) ), resulting in exp( %i * a + %i * b ). 
> > In my case 
> > 
> > (10) -> volkov_wave( r, p ,t ) 
> >            - %i alpha(p)cos(omg t) - %i xi(t) - %i t E(p) + %i p r 
> > (10)  %e 
> > 
> > How do I suppress that? 
>
> Probably it is better to live with it.  If you really want then 
> use 'paren' like below: 
>
> (13) -> %i*paren(a+b) 
>
>    (13)  %i(b + a) 
>                                            Type: 
> Expression(Complex(Integer)) 
>
> However, 'paren' suppresses any evaluation between what is in parens 
> and outside, so you may get: 
>
> (14) -> paren(a+b) - (a + b) 
>
>    (14)  (b + a) - b - a 
>                                                     Type: 
> Expression(Integer) 
>
> > 
> > Another thing I need is to gather similar factors in exponents. 
> > Namely, how do I transform this 
> > 
> > (12) ->   volkov_wave(r_0, p_s, t) * volkov_wave(r_1, p_e, t) 
> > 
> >    (12) 
> >        - %i alpha(p_s)cos(omg t) - %i xi(t) - %i t E(p_s) + %i p_s r_0 
> >      %e 
> >   * 
> >        - %i alpha(p_e)cos(omg t) - %i xi(t) - %i t E(p_e) + %i p_e r_1 
> >      %e 
> > 
> > into this 
> > 
> >    (12) 
> >        - %i ( ( alpha(p_s) + alpha(p_e) ) cos(omg t) + 2 * xi(t) + ( 
> E(p_s) 
> > + E(p_e) ) t - ( p_s r_0 + p_e r_1 ) ) 
> >      %e 
>
> (8) -> simplify(volkov_wave(r_0, p_s, t) * volkov_wave(r_1, p_e, t)) 
>
>    (8) 
>      %e 
>   ^ 
>        (- %i alpha(p_s) - %i alpha(p_e))cos(omg t) - 2%i xi(t) - %i t 
> E(p_s) 
>      + 
>        - %i t E(p_e) + %i p_e r_1 + %i p_s r_0 
>                                            Type: 
> Expression(Complex(Integer)) 
>
> 'simplify' is doing several things, you may prefer 'simplifyExp' 
> which is doing just this. 
>
> > Finally, one more question. 
> > How do I define delayed integration necessary for eq (1)? 
> > My first idea was to use quote. Something like 'integrate( 
> s_matrix_subint, 
> > t ). But then, how do I unquote s_matrix_subint inside? 
> > Another idea is to define integration as an operator 
> >   I := operator 'I 
> >   s_matrix := I( s_matrix_subint ) 
> > But this is probably not the best approach too. 
>
> FriCAS uses 'integral' to produce unevaluated integrals.  FriCAS 
> currently can not represent unevaluated integrals with infinite 
> integration limits, so all one can do is to fake them using 
> symbol as a limit, like: 
>
> (25) -> integral(volkov_wave(r_0, p_s, t), t=-inf..inf) 
>
>    (25) 
>       inf 
>     ++      - %i alpha(p_s)cos(omg t) - %i xi(t) - %i t E(p_s) + %i p_s 
> r_0 
>     |     %e                                                               
> dt 
>    ++ 
>    - inf 
>                                            Type: 
> Expression(Complex(Integer)) 
>
> Once you create such an integral FriCAS will make no attempt to 
> evaluate it.  It is possible to use 'eval' function to perform 
> operations on integrals, like: 
>
> (48) -> eval(integral(sin(x), x), 'integral, l +-> first(l)) 
>    There are 3 exposed and 4 unexposed library operations named first 
>       having 1 argument(s) but none was determined to be applicable. 
>       Use HyperDoc Browse, or issue 
>                               )display op first 
>       to learn more about the available operations. Perhaps 
>       package-calling the operation or using coercions on the arguments 
>       will allow you to apply the operation. 
>
>    (48)  sin(%B) 
>                                                     Type: 
> Expression(Integer) 
>
> However, FriCAS here is a bit picky about types of involved object. 
> Above l is a list of expression (arguments to "integral"), 
> '+->' creates anonymous function, first takes the first element 
> from the list.  In this case I was able to skip declaring types, 
> but in general I would have to declare types of argument and 
> return value from the function and take care of coercing 
> arguments to proper types.  So it is getting heavy.  Also, 
> evaluating integral in such way depends on internal representation 
> of unevaluated integrals... 
>
> I admit that in similar situations I just keep integrand in a variable, 
> and give it to 'integrate' when needed.  Similarly, when I do 
> not want evaluation I just keep intermediate results in variables. 
> I use unevaluated expression when I expect some simplifiction 
> (for example defivative of unevaluated indefinite interal gives 
> back integrand). 
>
>
> -- 
>                               Waldek Hebisch 
> [email protected] <javascript:> 
>

-- 
You received this message because you are subscribed to the Google Groups 
"FriCAS - computer algebra system" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/fricas-devel.
For more options, visit https://groups.google.com/d/optout.

Reply via email to