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

Is there method fastly to solve about "condition" ?

SOLVED
Newbie

Is there method fastly to solve about "condition" ?

I used "if" to my work because I need to constraint.

i.x) I have some data(CL, CD) each section "r=2.8667, 5.6....61.6333"

These data are 8.(CL1,CD1.....CL8,CD8)

when r are 2.8667,5.6 , CL1,CD1 is used.

when r is 61.6333, CL8,CD8 is used.

I used "if" to constraint so that data used each section.

But It made my work slowly.

So I want to change or improve so that it is fast.

I attaced my files. Please help me. it spend long time....

And I also want to review my work whether it is efficient about my work.

1 ACCEPTED SOLUTION

Accepted Solutions

Re: Is there method fastly to solve about "condition" ?

jinsuk Lee wrote:

if r=7m, I don't have a data(CL, CD)

I just have data in my excel file.

Yes, but you could use interploation here, too.

I am not sure if you need it, but her is a way how it could be done:

1.png

2.png

I also noticed that you redefined the function CL and CD inmidst of your sheet - confusing and bad behaviour.

I am not sure abou your calculation of ar and ar' via the solve blocks. In a prior post you wrote that you want to solve for both at once but this is not what you do now. Now you solve for a and hold a' constant to zero and then the other way round. i guess this is not what you inteded.

According the slowness of the sheet: Thats the integrations you are evaluating. The function th() takes a long time to calculate and is called many time by the itegral. Not sure but I don't think the if conditions are the cause for this. I can not be bothered to trace all of your function all the way back to their origin but this sure is something you should do yourself. Look how many calculation and which (interpolation, ...) Mathcad has to do to just calculate a single value of th().

Why not calcuate the integral by simple trapezoid approximation? After all you just have a bunch of points an not a continous function anyway.

View solution in original post

13 REPLIES 13

Re: Is there method fastly to solve about "condition" ?

jinsuk Lee wrote:

I used "if" to my work because I need to constraint.

i.x) I have some data(CL, CD) each section "r=2.8667, 5.6....61.6333"

These data are 8.(CL1,CD1.....CL8,CD8)

when r are 2.8667,5.6 , CL1,CD1 is used.

when r is 61.6333, CL8,CD8 is used.

And what if r=7m ??

BTW, the Mathcad sheet you posted does not use the Excel sheet you posted but two other Excel files.

Re: Is there method fastly to solve about "condition" ?

if r=7m, I don't have a data(CL, CD)

I just have data in my excel file.

ah.. I had a mistaken to post

I attached starnge file. i am sorry

I again attached

13.PNG

AND I have airfoil data along RNodes.

I need to read eah node to airfoil data.

it make me crazy..... I couldn't solve this problem for a long time.

Re: Is there method fastly to solve about "condition" ?

jinsuk Lee wrote:

if r=7m, I don't have a data(CL, CD)

I just have data in my excel file.

Yes, but you could use interploation here, too.

I am not sure if you need it, but her is a way how it could be done:

1.png

2.png

I also noticed that you redefined the function CL and CD inmidst of your sheet - confusing and bad behaviour.

I am not sure abou your calculation of ar and ar' via the solve blocks. In a prior post you wrote that you want to solve for both at once but this is not what you do now. Now you solve for a and hold a' constant to zero and then the other way round. i guess this is not what you inteded.

According the slowness of the sheet: Thats the integrations you are evaluating. The function th() takes a long time to calculate and is called many time by the itegral. Not sure but I don't think the if conditions are the cause for this. I can not be bothered to trace all of your function all the way back to their origin but this sure is something you should do yourself. Look how many calculation and which (interpolation, ...) Mathcad has to do to just calculate a single value of th().

Why not calcuate the integral by simple trapezoid approximation? After all you just have a bunch of points an not a continous function anyway.

View solution in original post

Re: Is there method fastly to solve about "condition" ?

thank you.

anyway Do you mean this picture about trapezoid?

14.PNG

Re: Is there method fastly to solve about "condition" ?

Thats nonsense! What are you using the indices for here?? In the meantime you should really know more about vectors and indices!!

I was talking about somthing like this:

trapezoid.png

and concerning ar and ar' about something like this:

arar%27.png

Furthermore I would suggest you adopt Freds suggestion and use angles and their pseudounit degree in a more natural way. Add deg when you read in angles and for the rest let Mathcad handle the unit.

Re: Is there method fastly to solve about "condition" ?

thank you...

But don't get me wrong..

I just posted past my file, not present my file.

so it exist indices such as i, j, k.

anyway thank you for help continually.

Re: Is there method fastly to solve about "condition" ?

In case you are interested why the intergral took so long:

Thanks to your heavily nested functions the calculation of a single value of t() requires evaluationg the solve block(s) for ar resp. a'r 15 time !! Thats quite inefficient!

But it comes better. For the function th() you try to integrate those solveblocks are called 17*15=255 times just to calculate one single value. Thats more than inefficient - thats a total waste of ressources.

So the cause for the desaster is not the use of the if statements.

You would have to design all of your functions completely different and more efficient. For instance your CL() should have only alpha as argument and should not csall alpha.r. If you use sin(Phi) and cos(Phi) in one expression, you should calculate Phi only once, store it in a temporary variable and use this, E.g. a simple call to alpha.r evaluates the solve blocks four times as it is written now,

A lot of work to be done.

Re: Is there method fastly to solve about "condition" ?

I am sorry I can't understand almost....

anyway thank you for consideration.

Re: Is there method fastly to solve about "condition" ?

19.PNG

I am sorry to contact often.

But I can't handle this problem... I already spent few hours..

you used "solve block" such as upper picture.

when I saw your answer, I realized that your value "a,a' is different compared to my value "a, a'"

so I guess that it is due to "solve block". I used it two times to caculate each value.

so I wonder if I want to solve at the same time about "a, a', how can I handle my work....

I looked for "PTC site" and "my book" and "help menu". but I don't know.....

Re: Is there method fastly to solve about "condition" ?

I am not sure what your problem is,

Of course the results are different.

Your solve block for a.r solves for a so that a2=a AND a'=0 and the second solve block does it the other way round (a=0).

My solve block should yield values for a AND a' so that a2=a AND a'2=a' at the same time and none of those values would be zero normally. I got the impression that this is what you want.

You can get two separate functions if you defiine

a.r(r1,v,theta):=aa'.r(r1,v,theta)[1 and index 2 for a'.r().

But here when you call both of those functions one after the other, the solve block is called every time, its evaluated twice. So its more efficent as I showed in the definition of Phi. Evaluate the solve block once and store both results in variables.

But as i said in a reply above - the whole setup is quite inefficient as one single evaluation of alpha.r calls the solve block four times. One single evalualtion of t() calls it 15 times and one single eval of th() calls it 255 times. Thats the reason the plot and especially the integral takes so long to calculate.

Re: Is there method fastly to solve about "condition" ?

I can success to sepeate. I was very surprised because it is very simple. I have a question.

Actually, I also thought your method to seperate.

But I gave up because aa'.r(r1,v,theta)[1 gave [0.07184, -0.07184]

I think ar(r1,v,theta):=aa'.r(r1,v,theta)[1 may be same.

that is, a.r(r1,v,theta)=[0.07184, -0.07184]

So Why are they different? I can't understand well.

20.PNG

And then I have another question.

I got result value.

But I can't understand because your result value is different with my result value.

this is your value

21.PNG

this is my value.

22.PNG

I attached my file.

I think your result may be right because my result is strange.

Re: Is there method fastly to solve about "condition" ?

jinsuk Lee wrote:

I can success to sepeate. I was very surprised because it is very simple. I have a question.

Actually, I also thought your method to seperate.

But I gave up because aa'.r(r1,v,theta)[1 gave [0.07184, -0.07184]

I think ar(r1,v,theta):=aa'.r(r1,v,theta)[1 may be same.

that is, a.r(r1,v,theta)=[0.07184, -0.07184]

So Why are they different? I can't understand well.

It has to do with the way you set up your equations. Mathcad can not find a solution with a=a'. The values Mathcad finds are a valid solution of your equations - if you set a for a' you get a value close bu not exactly to the value you demanded.

1.png

And then I have another question.

I got result value.

But I can't understand because your result value is different with my result value.

this is your value

I don't know what I did to get that value. Maybe I used your functions a.r and a'.r or played around with something else.

Anyway, I get the same result as yours now.

See attached for proper handling of degrees.

Re: Is there method fastly to solve about "condition" ?

Okay thank you,

I thought past's your value was right because it is similar to real data

( I need to compare real data with my result data and they should be similiar..

so I asked how you get this value (TT= 8.40816*10^5)

Announcements