substitute for step ( wild ( ) ) function derivative

View: New views
4 Messages — Rating Filter:   Alert me  

substitute for step ( wild ( ) ) function derivative

by Javier Ros Ganuza :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


Hello,

If I derive step I obtain D[0](step). I want to substitute for
D[0](step)--> 0 to get a particular behavior.

What should I do?

(e.subs(D[0](step)(wild()) == 0) can't be understand

diff(step(wild()),wild()) neither.

Any clues.

By the way I'm assuming that the step function is the Heaviside function
( step(x)=0 if x<0; 1 otherwise I'm assuming a real argument) .

Thank you in advance.

Javier



_______________________________________________
GiNaC-list mailing list
GiNaC-list@...
https://www.cebix.net/mailman/listinfo/ginac-list

Re: substitute for step ( wild ( ) ) function derivative

by Javier Ros Ganuza :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

        I found this solution, tah I exemplify

        symbol my_wild;
        ex my_wild_ex;
        my_wild_ex=subs(diff(step(my_wild),my_wild), my_wild==wild());
       
        ex U=.....*step(....);
        ex equation_1=diff(U,theta);
        equation_1.subs(my_wild_ex == 0);

        So D[0](step) disappear from equation_1

        Thanks,

        Javier


_______________________________________________
GiNaC-list mailing list
GiNaC-list@...
https://www.cebix.net/mailman/listinfo/ginac-list

BUG or incoherence: matrix A; A*pow(A,-1) =! 1

by Javier Ros Ganuza :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

We now that for matrix class objects A, GiNaC simplifies

matrix A;
cout << A-A << endl;

give 0

The same way that

symbol a
cout << a-a << endl;

gives 0

But I think that for coherence

matrix A;
cout << A*pow(A,-1) << endl;

should give 1, (I mean reduced to numeric(1) regardless the particular
form of A, or at least if it is square)

the  same way as

symbol a
cout << a*pow(a,-1) << endl;

is 1

By the way it would be wonderful if A-A give matrix-es instead of
numeric-s, although I think you've already had long discussions about
that.

Thank you,

Javier
PD: I wouldn't mind to derive a class from matrix to change this
behavior the easy way, but I don't know if this can be done this way.
Any light in this direction would be appreciated.



_______________________________________________
GiNaC-list mailing list
GiNaC-list@...
https://www.cebix.net/mailman/listinfo/ginac-list

Re: BUG or incoherence: matrix A; A*pow(A,-1) =! 1

by Alexei Sheplyakov-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hello,

On Wed, Sep 16, 2009 at 10:46:34AM -0400, jros wrote:

> We now that for matrix class objects A, GiNaC simplifies
>
> matrix A;
> cout << A-A << endl;
>
> give 0
>
> The same way that
>
> symbol a
> cout << a-a << endl;
>
> gives 0
>
> But I think that for coherence
>
> matrix A;
> cout << A*pow(A,-1) << endl;
>
> should give 1,

First of all, GiNaC does not evaluate matrix products and powers automatically,
one should call evalm() for that (this is documented in the manual, see
http://www.ginac.de/tutorial/Matrices.html#Matrices). Secondly, the expression
is ill defined because A is zero (on the other hand, A - A is OK).

> (I mean reduced to numeric(1) regardless the particular form of A,

The expression above is a matrix. Why should we replace it with a number?

> the  same way as
>
> symbol a
> cout << a*pow(a,-1) << endl;
>
> is 1
>
> By the way it would be wonderful if A-A give matrix-es instead of
> numeric-s, although I think you've already had long discussions about
> that.

I agree, it's nice, but also it's very difficult to implement in any
*useful* way.
 
> PD: I wouldn't mind to derive a class from matrix to change this
> behavior the easy way, but I don't know if this can be done this way.

The expr - expr => 0 transformations are done by the `add' class, and
the expr/expr => 1 transformation is done by the `mul' class, respectively.
Therefore subclassing matrix won't help.

Best regards,
        Alexei

_______________________________________________
GiNaC-list mailing list
GiNaC-list@...
https://www.cebix.net/mailman/listinfo/ginac-list