|
[Sponsors] |
April 21, 2005, 08:25 |
optimisation
|
#1 |
Guest
Posts: n/a
|
Hi
I need a bit of help please, I need to minimize the following function: a(sin(theta)+cos(theta))+b(sin(2*theta)+cos(2*thet a))+ c(sin(3*theta)+cos(3*theta))+ .... up to 100 terms. a, b, c etc are known and interchangable. Theta is known. Any help would be greatly appreciated. Thanks in advance. allan |
|
April 21, 2005, 12:15 |
Re: optimisation
|
#2 |
Guest
Posts: n/a
|
If a, b, c, and theta are all known there are no free parameters to minimize on.
|
|
April 21, 2005, 15:58 |
Re: optimisation
|
#3 |
Guest
Posts: n/a
|
Perhaps optimization means reduced computational cost in this context. In that case, it appears to me that one possibility is to perform a series expansion of sin() and cos() functions to a desired level of accuracy and collect like terms in terms of polynomial orders (use nested multiplication for the series, not exponentiation). Some preliminary work is needed, of course.
Another possibility might be to use tables for the functions. Either way, the performance will depend greatly on the capability of the compiler used - some compilers do an excellent job of optimizing math functions (to the point of providing the best possible performance, in which case there is nothing one can do) Adrin Gharakhani |
|
April 22, 2005, 04:43 |
Re: optimisation
|
#4 |
Guest
Posts: n/a
|
Sorry, I've not made myself clear. The letters a,b,c etc have different values and can be attached to any one of the (sin(theta) + cos(theta)) terms. What I am looking for is a method that will allow me to quickly determine the minimum value of this function rather than going through each combination i.e. 3 factors have 9 combinations. I will have at least 64 factors which corresponds to 64^64 combinations, which would take a while to calculate the value of every combination to determine the minimum.
Thanks for your response. allan |
|
April 22, 2005, 13:10 |
Re: optimisation
|
#5 |
Guest
Posts: n/a
|
Do you have any constraints on possible values of (a,b,c,...)? For example, if (a,b,c,...) >= 0, then you could possibly use a double sort. Compute the sinusoids and sort the values from largest to smallest. If any of the values are negative, then sort (a,b,c,..) from smallest to largest and multiply the largest value with the most negative sinusoid. If none of the sinusoids are negative then sort the (a,b,c,...) from largest to smallest and multiply the smallest sinusoid by the smallest value of (a,b,c,...). You'd have to work out the details but that may be one way of solving your problem.
|
|
April 22, 2005, 22:13 |
Re: optimisation
|
#6 |
Guest
Posts: n/a
|
Looks like a Fourier infinite series expansion to me...
If so, the a,b,c terms are the Fourier Coefficients derived for the function f(theta) you are evaluating... diaw... |
|
April 24, 2005, 19:20 |
Re: optimisation
|
#7 |
Guest
Posts: n/a
|
and since calculatiing sins and coss are time consuming sometime its better to create tables for them and then use them rather than calculating them again and again.
|
|
April 25, 2005, 02:00 |
Re: optimisation
|
#8 |
Guest
Posts: n/a
|
Step back & look at the 'big picture'... What do lots of sines & cosines tell you?
diaw... |
|
April 25, 2005, 03:21 |
Re: optimisation
|
#9 |
Guest
Posts: n/a
|
Well, evaluating sin() and cos() isn't really the issue here. But if it were , the cost could be (almost) halved using the following:
sin(alpha)+cos(alpha)=sqrt(2)*sin(alpha+Pi/4)=sqrt(2)*cos(alpha-Pi/4) Adrin Gharakhani |
|
April 25, 2005, 06:20 |
Re: optimisation
|
#10 |
Guest
Posts: n/a
|
yaa i agree with you that this is really not a issue here, and i feel that the solution suggested by ag is best for the problem he mentioned.
i mentioned that becuae i was reading about efficiency of code someone had to write for a commercial software and he could speed up his code by storing sin and cos, so i was just trying to hint, we never know what thing could be useful. |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
2D airfoil optimisation: the mesh | Marta | Main CFD Forum | 5 | February 6, 2008 01:07 |
Wing Optimisation | Miqdad | FLUENT | 3 | October 14, 2005 09:12 |
Optimisation tools on Fluent? | steve | Main CFD Forum | 2 | July 4, 2004 17:22 |
Design Optimisation | Abhinav Sona | Main CFD Forum | 5 | June 30, 2004 11:13 |
Optimisation | Peter | Main CFD Forum | 1 | October 15, 2002 04:43 |