maximize function over a range of constant
maximize function over a range of constant
(OP)
Hi all,
I'm trying to find a way to find the maximum of a function for a range of coefficient/s
The simplified function is as follows:
0<x<1
f(x):=ax^3+6*x
I would like to get the x value for that makes f(x) maximum for a different values of "a" lets say a=0.01,0.02,...0.19
I know the function above is very simple there may be other solutions else than using maximize function. However the actual function is too large that it cannot display even the first derivative.
Any ideas?
thanks in advance
I'm trying to find a way to find the maximum of a function for a range of coefficient/s
The simplified function is as follows:
0<x<1
f(x):=ax^3+6*x
I would like to get the x value for that makes f(x) maximum for a different values of "a" lets say a=0.01,0.02,...0.19
I know the function above is very simple there may be other solutions else than using maximize function. However the actual function is too large that it cannot display even the first derivative.
Any ideas?
thanks in advance





RE: maximize function over a range of constant
TTFN
FAQ731-376: Eng-Tips.com Forum Policies
RE: maximize function over a range of constant
RE: maximize function over a range of constant
Cheers
Greg Locock
SIG:Please see FAQ731-376: Eng-Tips.com Forum Policies for tips on how to make the best use of Eng-Tips.
RE: maximize function over a range of constant
I'm not asking for a symbolic solution.
The reason I mentioned about taking the first derivative and so on was because, it(derivative=0 ->solve block for a range of constants) is another way to find the maximum of the f(x) for a given "a" value. Which is not feasible for me.
What I'm trying to do is to use maximize function in mathcad with a range of constants Is this possible?
In other words let me write down which is not working
i:=0,0.001..0.19
b:=0.2
f(x):=a(sub i)x^3+6*x
Given
0<x<1
maximize(f,x)
=I would like to get the maximum for different a values as a list instead of changing value of "a" every time.
RE: maximize function over a range of constant
Cheers
Greg Locock
SIG:Please see FAQ731-376: Eng-Tips.com Forum Policies for tips on how to make the best use of Eng-Tips.
RE: maximize function over a range of constant
then func(i)= will display results for each i
HOWEVER, subscripts cannot be fractional
so, i := 0;19
a[i := i*.01
TTFN
FAQ731-376: Eng-Tips.com Forum Policies
RE: maximize function over a range of constant
However...
[quote=simyotic]
The reason I mentioned about taking the first derivative and so on was because, it(derivative=0 ->solve block for a range of constants) is another way to find the maximum of the f(x) for a given "a" value. Which is not feasible for me.
[/quote]
Use the minerr function. Normally the minerr function is used to minimize error. Therefore you must subtract your f(x) from some constant that will not be exceeded. I have found minerr works better than minimize. In your example 'a' will always be bigger at x=1. Do you have a better example? It would be good to know what you are really trying to do.
Here is an example of finding coefficients of a differential equation that minimize the integrate absolute error. This is used in control. Note, I couldn't simply take the derivative of the resulting equation and find the minimum so one must use an optimizer.
ftp://ftp
I have an equations where IAE(A1,A2) = 0. That is because I am trying to get the error close to 0. In your case you need to replace the IAE(A1,A2) with f(a,x) = C. Where C is a constant you will approach but not reach.
Better yet is to convert your f(a,x) to minimize error so you can just use f(a,x) = 0 like I did.
Note, my worksheet allows me to find the coefficients for any linear third order differential equation.
RE: maximize function over a range of constant
I'm uploading one of the files that I'm working on, in principle it is the same as a f(x):=a(sub i)x^3+6*x.
IRstuff:
What you wrote in the reply is exactly what I'm looking for but I couldn't manage to get it through would you mind uploading an example file for me? Because this is where I'm puzzled: Can we use a range variable in Maximize function in Mathcad.
GregLocock:
The reason I don't want to use your approach is to avoid large equation size When I substitute x with another function lets say substitute every x with exp(2.32*(x^2-1) etc it would be even larger. Infact I should do it for 16 different functions and that's why I'm trying to avoid it.
PNachtwey:
I'm amazed with your file however I'm a bit newbee and I'm a bit lost in that. Probably the question I'm asking for you (and everyone here) is very simple but as I said I'm at the very begining. On the other hand we are working on the same thing in a sense (this function is the excess flow in a 3 way control valve when you have different circuit pressure ratios and valve authority (alfa and beta) for different opening of the valve x). It is nice to meet you.
Thanks all again.
regards