Re: Problem with FullSimplify in Version 5: Rationals are converted to Reals

• To: mathgroup at smc.vnet.net
• Subject: [mg46307] Re: [mg45482] Problem with FullSimplify in Version 5: Rationals are converted to Reals
• From: Andrzej Kozlowski <akoz at mimuw.edu.pl>
• Date: Fri, 13 Feb 2004 21:57:38 -0500 (EST)
• References: <402D01EB.6040505@uni-mainz.de> <9347FA52-5E55-11D8-B94B-00039311C1CC@mimuw.edu.pl>
• Sender: owner-wri-mathgroup at wolfram.com

I forgot to add, that if you are going to do this frequently there is
no need to write this code every time. Just define your own function
MySimplify:

MySimplify[expr,opts___]:
Real,Hold[#],#]&)//@expr]]

and now use:

Solve[MySimplify[expr],deltaL]

Of course you can do the same thing using Rationalize.

Andrzej Kozlowski

On 13 Feb 2004, at 19:51, Andrzej Kozlowski wrote:

> For all its worth here is another way that uses Hold instead of
> Rationalize:
>
>
> Solve[ReleaseHold[Simplify[(If[NumericQ[#] && Head[#] =!= Real,
> Hold[#],
>        #] & ) //@ expr]], deltaL]
>
>
> Inverse functions are being used by Solve so some solutions may not be
> found; use Reduce for complete solution information.
>
>
> {{deltaL -> 3.7998970410976023,
>    Erf[(0.3070925731856876*(2.302585092994046*(0.1*deltaL - 10.) +
>         23.025850929940457))/
>       Sqrt[(0.6089140226261116 - 0.005294904544574884*(deltaL +
> 20.))^2 +
>         0.25302502757884177]] -> 0.41421356237309503}}
>
> The "two rule" form of the solution is curious and surprised me, but
> we can check that the solution is self-consistent:
>
>
> %[[1,2]]/.%[[1,1]]
>
> 0.414214->0.414214
>
>
>
>
> On 13 Feb 2004, at 17:57, oberfeld wrote:
>
>> Dear list,
>>
>> some weeks ago, I posted a question concerning FullSimplify in Ma 5.0
>> which seems to occur because Rationals are converted to Reals.
>>
>> Thanks to those who suggested work-arounds! Unfortunately, I was not
>> able to resolve my problem following the suggestions. Wolfram support
>> meanwhile confirmed this to be a problem of version 5.0.0 and said
>> that the problem were   resolved in Ma 5.0.1. However, after
>> installing the update I had to realize that this is *not correct*.
>>
>> So, for all who are interested, here comes the 'full problem' (and
>> its solution) again:
>>
>> I have to solve a rather nasty expr for a variable deltaL:
>>
>> expr=1/Sqrt[2] ==
>>   (1/2)*(1 + (1/2)*(-1 - Erf[(-(Log[10000000000]/Log[10]) -
>> Log[10^(-12 + (20 + deltaL)/10)]/Log[10])/
>>          (Sqrt[2]*Sqrt[0.25302502757884177 + (0.6089140226261116 -
>> 0.005294904544574884*(20 + deltaL))^2])])) +
>>    (1/4)*(1 + Erf[(Log[10000000000]/Log[10] + Log[10^(-12 + (20 +
>> deltaL)/10)]/Log[10])/
>>        (Sqrt[2]*Sqrt[0.25302502757884177 + (0.6089140226261116 -
>> 0.005294904544574884*(20 + deltaL))^2])]);
>>
>> In Ma 3+4, the following straightforward expression works:
>>
>> Solve[FullSimplify[expr],deltaL]
>>
>> In Ma 5, however, the same expression produces the all-too-well-known
>> message "Solve::tdep: The equations appear to involve the variables
>> to be solved for in an essentially non-algebraic way."
>>
>> Switching to Simplify (instead of FullSimplify), as Andrzej & Bob
>> suggested, does not help (at least on my machine).
>>
>> The only solution I found (thank's for the idea, Bob!), was to use
>> Rationalize:
>>
>> N[Solve[Simplify[Rationalize[expr,0]],deltaL]]
>> Out:={deltaL->3.7999}
>>
>> Note, that *FullSimplify* still does not work!!
>>
>> N[Solve[FullSimplify[Rationalize[expr,0]],deltaL]]
>>
>>
>>
>> Would be no problem were it not for many of such expressions
>> lingering in my code, so that I have to step through it and insert
>> that "Rationalize magic" each and every time... ;-(
>>
>> Best wishes
>>
>> Daniel
>>
>>
>> -------------------------------------
>> Dipl. Psych. Daniel Oberfeld-Twistel
>> University of Mainz
>> Institute of Psychology
>> Experimental Psychology
>>
>> Staudingerweg 9
>> 55099 Mainz
>> Germany
>>
>> T.   ++49 (0) 6131 39 22423
>> Fax. ++49 (0) 6131 39 22480
>>
>>
>>
>>
> Andrzej Kozlowski
> Chiba, Japan
> http://www.mimuw.edu.pl/~akoz/
>

• Prev by Date: Re: significant digits in random numbers in scientificform
• Next by Date: Re: Estimating parameters p and q in y'' + p y' + q y = Tide(t)
• Previous by thread: Re: Problem with FullSimplify in Version 5: Rationals are converted to Reals
• Next by thread: Re: Need definitions for lhs=rhs