POV-Ray : Newsgroups : povray.programming : "linked" value functions Server Time
18 Apr 2024 06:36:55 EDT (-0400)
  "linked" value functions (Message 1 to 2 of 2)  
From: Bald Eagle
Subject: "linked" value functions
Date: 23 Apr 2020 14:05:01
Message: <web.5ea1d86340a6d7a8fb0b41570@news.povray.org>
So, I've come across this a few times, and I'm not sure if this is a "usual"
operation or a formal function/macro in certain languages.

I want to compare two values, but I want to then utilize a third, linked value.

So in the current situation, I'm looking at the dimensions of vectors during a
rotation, and a typical operation is to do something like:
#local MaxX = max(TestValue, MaxX);

But I don't want to keep track of the magnitude of maximum vector - I want to
keep track of the ANGLE of rotation at which that maximum occurs.

Obviously I can concoct some sort of macro to handle this, but it just seemed to
me that this must be a somewhat common task, to the point where such a function
might exist and have a name.


Post a reply to this message

From: Tor Olav Kristensen
Subject: Re: "linked" value functions
Date: 23 Apr 2020 15:10:01
Message: <web.5ea1e6b4d21148b676d1a4ea0@news.povray.org>
"Bald Eagle" <cre### [at] netscapenet> wrote:
> So, I've come across this a few times, and I'm not sure if this is a "usual"
> operation or a formal function/macro in certain languages.
>
> I want to compare two values, but I want to then utilize a third, linked value.
>
> So in the current situation, I'm looking at the dimensions of vectors during a
> rotation, and a typical operation is to do something like:
> #local MaxX = max(TestValue, MaxX);
>
> But I don't want to keep track of the magnitude of maximum vector - I want to
> keep track of the ANGLE of rotation at which that maximum occurs.
>
> Obviously I can concoct some sort of macro to handle this, but it just seemed to
> me that this must be a somewhat common task, to the point where such a function
> might exist and have a name.

Hi Bill

If the value for each component is a function of an angle - and you know this
function, then it may be that you can find the extreme points analytically.

If you don't know this function, then here's some terms to search for and some
relevant links.

golden section search
Fibonacci search
Newton Raphson optimization
optimization in one dimension
numerical optimization
numerical analysis extremum (or extremes)

https://mathforcollege.com/nm/mws/gen/09opt/mws_gen_opt_txt_newopt.pdf
http://mathforcollege.com/nm/mws/gen/03nle/mws_gen_nle_txt_newton.pdf
http://www.lendek.net/teaching/opt_en/numerical%20optimization.pdf
https://relate.cs.illinois.edu/course/cs357-f15/file-version/03473f64afb954c74c02e8988f518de3eddf49a4/media/cs357-slide
s-newton2.pdf
https://en.wikipedia.org/wiki/Maxima_and_minima
https://en.wikipedia.org/wiki/Golden-section_search

--
Tor Olav
http://subcube.com
https://github.com/t-o-k


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.