|
|
Michael (Micksa) Slade nous apporta ses lumieres en ce 28/09/2006 09:20:
> On Wed, 27 Sep 2006 20:44:05 +0100, Orchid XP v3 wrote:
>
>> My particular function was something like x^18 + ... = 0. It has almost
>> vertical sides, yet the "interesting" part has a tiny derivative. My
>> using the log() function I can "magnify" the interesting bit, and zoom
>> out the unimportant vertical walls that are confusing the poor root solver.
>>
>> However, note that you must make sure the function is NEVER NEGATIVE,
>> since log(-1) is a complex number, and POV-Ray won't like that. This
>> sometimes requires you to translate the function in the Y-direction,
>> take the log, and then translate the result back again:
>>
>> f2(x) = k + log(f1(x) - k)
>>
>> Selecting the correct k turns out to be very critical. The log function
>> shrinks large features, but it can also "magnify" small ones. If you get
>> the "wrong" value for k, you can end up creating big vertical side RIGHT
>> NEXT TO THE ZEROS. That means you MUST use a high max_gradiant or
>> POV-Ray will overshoot the zeros - the exact thing we were trying to
>> avoid...
>
> Yeah, the magnification of small values (which also applies to, say,
> sqrt(x)), is something I forgot about. I guess real world functions would
> be less trivial to "map" in the sense I was talking about.
>
>> (The problem gets even more fun if you start taking double-logs!)
>
> Why would you want to do that for a function other than a
> double-exponential? Masochism? Maths fetish? :)
>
> Mick.
>
You can come acros functions that have even more extreem gradients and a single
log still give you a max_gradient in the thousands, like a 20th degree or more
or an x^10x kind of case. You then may want to use double logs. In that case, it
can be usefull to use log(max(0, log(YourFunction))) to clip negative values.
--
Alain
-------------------------------------------------
If That Phone Was Up Your Butt, Maybe You Could Drive A Little Better!
Post a reply to this message
|
|