>
> Maybe the following session might help you. Maybe it's still not what 
> you want, since you are left with mysum expressions that you have to 
> interpret yourself (by adding even more rules to the system). 
>

 Ok, thanks. That solves the problem.
 
One more question.
How do I change GENSYM-generated variable name to something human-readable?
Eval doesn't work:
 
(1) -> test_eqn := exp( symbol( GENSYM()$Lisp ) * x )
 
      G59678 x
(1) %e
Type: Expression(Integer)
(2) -> test_eqn
 
      G59678 x
(2) %e
Type: Expression(Integer)
(3) -> eval( test_eqn, [ G59678 = N ] )
 
      G59678 x
(3) %e
Type: Expression(Integer)
(4) -> eval( test_eqn, [ x = N ] )
 
      G59678 N
(4) %e
Type: Expression(Integer)
 
 

среда, 23 апреля 2014 г., 19:37:03 UTC+4 пользователь Ralf Hemmecke написал:
>
> > If I simply define and use a rule 
> > 
> >   exp_to_bessel_rule := rule exp( sqrt(-1) * z * sin(t) ) == besselJ( N, 
> z 
> > ) * exp( sqrt( -1 ) * N * t ) 
> >   exp_to_bessel_rule( test_eqn ) 
> > 
> > then I'll get expression with 2 identical summation indices ( 'N' in 
> this 
> > case ), which is clearly not something I want. 
>
> Right. That's clear. The problem is that your besselJ(N, ...) is only a 
> workaround to some other problem. 
>
> You want sum_{N=-\infty}^\infty foo(N) as a result. N is bound. 
>
> As Waldek said, you have to invent your own operator for the infinite sum. 
>
> I experimented with 
>
> mysum := operator 'mysum 
> mysum(minusInf, plusInf, N +-> besselJ(N, a) * exp( %i * N * t )) 
>
> to represent your sum. Unfortunately +-> cannot be used in that place. 
>
> Maybe the following session might help you. Maybe it's still not what 
> you want, since you are left with mysum expressions that you have to 
> interpret yourself (by adding even more rules to the system). 
>
> Anyway, I think what is below is in the spirit of what Waldek suggested. 
>
> Ralf 
>
>
> (1) -> )clear completely 
>    All user variables and function definitions have been cleared. 
>    All )browse facility databases have been cleared. 
>    Internally cached functions and constructors have been cleared. 
>    )clear completely is finished. 
> (1) -> mysum := operator 'mysum 
>
>    (1)  mysum 
>                                                           Type: 
> BasicOperator 
> (2) -> mi -- represents minusInfinity 
>
>    (2)  mi 
>                                                            Type: 
> Variable(mi) 
> (3) -> pi -- represents plusInfinity 
>
>    (3)  pi 
>                                                            Type: 
> Variable(pi) 
> (5) -> B(N, l, h, a, t) == mysum(l, h, N, besselJ(N, a) * exp(sqrt(-1) * 
> N * t )) 
>    Compiled code for bess has been cleared. 
>                                                                    Type: 
> Void 
> (6) -> bess(a,t) == (N:Symbol:=symbol GENSYM()$Lisp;B(N,mi,pi,a,t)) 
>    1 old definition(s) deleted for function or rule bess 
>                                                                    Type: 
> Void 
> (7) -> bess(a,t) 
>    Compiling function B with type (Symbol,Variable(mi),Variable(pi), 
>       Variable(a),Variable(t)) -> Expression(Integer) 
>    Compiling function bess with type (Variable(a),Variable(t)) -> 
>       Expression(Integer) 
>
>                                   +---+ 
>                            G658 t\|- 1 
>    (7)  mysum(mi,pi,G658,%e            besselJ(G658,a)) 
>                                                     Type: 
> Expression(Integer) 
> (8) -> bess(a,t) 
>
>                                   +---+ 
>                            G659 t\|- 1 
>    (8)  mysum(mi,pi,G659,%e            besselJ(G659,a)) 
>                                                     Type: 
> Expression(Integer) 
> (9) -> test_eqn := exp(sqrt(-1)*a*sin(omg*t))*exp(sqrt(-1)*b*sin(2*omg*t)) 
>
>             +---+              +---+ 
>           a\|- 1 sin(omg t)  b\|- 1 sin(2omg t) 
>    (9)  %e                 %e 
>                                                     Type: 
> Expression(Integer) 
> (10) -> exp_to_bessel_rule := rule exp(sqrt(-1)*z*sin(t)) == bess(z,t) 
>
>              +---+ 
>            z\|- 1 sin(t) 
>    (10)  %e              == 'bess(z,t) 
>                        Type: 
> RewriteRule(Integer,Integer,Expression(Integer)) 
> (11) -> exp_to_bessel_rule( test_eqn ) 
>    Compiling function B with type (Symbol,Variable(mi),Variable(pi), 
>       Variable(b),Polynomial(Integer)) -> Expression(Integer) 
>    Compiling function bess with type (Variable(b),Polynomial(Integer)) 
>        -> Expression(Integer) 
>    Compiling function B with type (Symbol,Variable(mi),Variable(pi), 
>       Variable(a),Polynomial(Integer)) -> Expression(Integer) 
>    Compiling function bess with type (Variable(a),Polynomial(Integer)) 
>        -> Expression(Integer) 
>
>    (11) 
>                                     +---+ 
>                         2G688 omg t\|- 1 
>      mysum(mi,pi,G688,%e                 besselJ(G688,b)) 
>   * 
>                                    +---+ 
>                         G691 omg t\|- 1 
>      mysum(mi,pi,G691,%e                besselJ(G691,a)) 
>                                                     Type: 
> Expression(Integer) 
>
>
>

-- 
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