cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Help us improve the PTC Community by taking this short Community Survey! X

Problem with Minimization

aclark-3
1-Visitor

Problem with Minimization

Hello.. Apologies if this appears twice. I tried to post a question yesterday but it did not go through.

I am new to Mathcad so I am sure this is a trivial question for the experts.

I am building a program which manipulates a bunch of 1x400 vector arrays then integrates 2 of the arrays (Runge-Kutta). The final result of one of the integrations is then minimized with respect to frequency. No problem with minimizing a simple analytic function, but I must have a bad syntax here.

So I built a simple exercize below to make it easier to see my mistake.

Given

Where am I going wrong?

Thanks, Al

10 REPLIES 10
Werner_E
25-Diamond I
(To:aclark-3)

Its always better to attach the mathcad sheet,istself, not just a picture.

The error occurs becaus temp has to be a function depending on variable f. p(f):=....

In your case temp is a simple variable and so cannot be minimized.

WE

Use please min(P)=

RichardJ
19-Tanzanite
(To:aclark-3)

To minimize P with respect to f, P must be a function of f. That's easy enough to do, but then it's clear that there is no real minimum: as f increases, P decreases:

Maybe you just made the example too simple though, and your real function does have a minimum. In which case you can find it with minimize(P,f)

thanks everyone for your attempt to help. I am more confused, but am definitely trying (in my real program) to minimize P with respect to frequency. I realize that my practice example was pretty bad.

I will study your reponses, do some more homework, and return when I can ask a more intelligent question.

Best, Al

OK, I tried to follow Richard's suggestion, and I made some progress. I also inserted a simpler function, which has a minimum at .577.  But I am still getting the error msg when I try to minimize.

BTW, the program I am building is for modeling the acoustic behavior of a recorder. I have had very good success doing it in Excel. But now I want to add viscous and thermal losses, so I need to use complex impedances. Thus the switch to Mathcad, because Excel is so cumbersome for complex quantities.

I have attached the file.

Thanks in advance, Al

RichardJ
19-Tanzanite
(To:aclark-3)

Minimize expects just the function name, P, as the first argument. So you should have just P, not P(f). However, you have defined P in such a way that it returns a vector, and using P[10 as the function name will not work. So you need this:

StuartBruff
23-Emerald III
(To:RichardJ)

Beat me to it ...

thanks Richard and Stuart.

I'm good to go!

Regards, Al

StuartBruff
23-Emerald III
(To:aclark-3)

Are you really trying to find the minimum of P with respect to f? or just where the minimum is for a given f?

Stuart

Announcements

Top Tags