[GiNaC-list] Forge it !. WAS: Re: Weird: symbol * ddq_i, my_ex.subs((*ddq_i)==0) my_ex.subs(*ddq_i==0)my_ex.subs(symbol(*ddq_i)==0) ??

Javier Ros jros at unavarra.es
Thu Jul 28 02:23:39 CEST 2011


Sorry for disturbing,

I solved the problem. For if some body is interested:

I use a class symbol_numeric derived from symbol.

the expression that was offending was conceptually of the type

my_expression = symbol * (my_symbol_numeric) +my_symbol_numeric

the result didn't simplified. I suppose this is CORRECT BEHAVIOR.

My fault was the typecast removing it or changing it to
symbol_numeric, solves the problem.

That's why

my_expression.subs(lst(symbol(my_symbol_numeric)==0,my_symbol_numeric ==0))

was needed.

Now standard simplification

my_expression.subs(my_symbol_numeric ==0)

 works.

 so I think the problem was related, although in a really involved
manner, to the symbol factory known issue referred in GiNaC's
Tutorial.

Thank you again,

Javier

On Wed, Jul 27, 2011 at 11:09 PM, Javier Ros <jros at unavarra.es> wrote:
> Jens,
>
> On Wed, Jul 27, 2011 at 8:41 PM, Jens Vollinga
> <jens.vollinga at googlemail.com> wrote:
>> Hi Javier,
>>
>> your information is a bit confusing. First you write:
>>
> I'm sorry.
>
>> On 27.07.2011 19:23, Javier Ros wrote:
>>>
>>> the following trivial simplifications
>>>
>>> my_ex.subs((*ddq_i)==0)
>>
>> ...
>>>
>>> go wrong no correct substitution, in different ways
>>
>> then you write:
>>
>>> Interestingly  until now I was simplifying correctly using
>>>
>>> my_ex.subs((*ddq_i)==0)
>
> You can disregard this sentence.
>
>> So, once it goes wrong, then it goes well?!? Did you upgrade GiNaC to a
>> newer version, maybe?
>
> Disregard the my_ex.subs((*ddq_i)==0) goes OK thing,
>
>> Anyway, could you, if possible, send a complete code example to explain your
>> problem? It is hard to guess what the problem might be, otherwise.
>
> It's going to take some time to isolate, as I'm using a library that
> I've build on top of GiNaC to generate the offending my, but I'll try
> if I can reproduce it using plain GiNaC, writing and reading it back
> in a plain
> GiNaC program.
>
> In any case I suppose that the trivial simplifications
>
> my_ex.subs((*ddq_i)==0)
>
> my_ex.subs(*ddq_i==0)
>
> my_ex.subs(symbol(*ddq_i)==0)
>
> should coincident with these
>
> my_ex.subs(lst(symbol(*ddq_i)==0,*ddq_i==0))
>
> my_ex.subs(lst(symbol(*ddq_i)==0,(*ddq_i)==0))
>
> But unfortunately only the last two are working.
>
> Do you agree that this is not normal behavior?.
>
> Thank you,
>
> Javier
>


More information about the GiNaC-list mailing list