Skip to main content
1-Visitor
February 25, 2013
Solved

AUTOMATED (PROGRAMMED) CALCULATIONS

  • February 25, 2013
  • 3 replies
  • 9650 views

Hello everybody,

I have attached a MathCad 15 worksheet. I would like to make tables of the following parameters for 3 values of alpha and for different rhos.

rho values: 2, 5, 10, 20, 30, 50 and 60

x1c, x2c and x3c corresponding to alpha=0.50, 0.45 and 0.40 respectively.

Q1c, Q2c and Q3c - same thing.

y1c, y2c and y3c - same thing.

Please go to the "Xc, Qc and Yc Section" on the worksheet.

Also, I would like to make some graphs of these parameters.

Thank you so much for the time and help.

Anousheh

PS final results as an array would be OK. I guess, it can then be exported to excel. OR, can MactCad produce tables?

Best answer by Werner_E

Anousheh Rouzbehani schrieb:

Hi Werner,

My original ODE has 2alpha in the nominator. Yours is alpha. I changed yours to 2alpha and some parts of the worksheet became RED! Could you please tell me why?

Worksheet is beautiful.

Thanks,

Anousheh

My ODE function is identical to your. You may notice the i have multiplied the expression in the brackets with that 2. So there you have 2*M and no 1/2 anymore. This was done as I don't like my expression to go over to the right out of the sheet. So you should not change it.

The reason for part of the worksheet going red could be that the root function, which calculates the xc values, does not find a solution. This part of the sheet is a little bit sensible and this applies to the values and combinations of alpha and rho, too. I have changed the call to root by not providing a guess value but by providing an interval (x0 to xe, 10 to 20 in the sheet) to search for a solution. The function values of S at those interval limits must have different signs, otherwise root fails. I had (shortly) experimented to generalize your version with the guess value. A guess of x:=14 will work with the values in the sheet, but not with all combinations of alpha and rho, too. You know your functions better and have to decide which version of root to use. My first idea was to make the center of the interval 0.5*(x.e+x.0) the guess, but 15 failded with the x1 in the sheet. So I decided to go for the interval. Another appraoch would be to use a parameterized solve block with find.

3 replies

25-Diamond I
February 25, 2013

Most of your function definitions use constant values for alpha and rho which are set differently throughout your worksheet. To achieve what you want you would have to rewrite those function to accommodate the additional parameters rho and alpha and delete all assignments for alpha and rho.

Instead of ff(x):=..... you would write ff_(x,alpha,rho):=.... and then you may define ff(x):=ff_(x,0.5,10), as these are the actual values for alpha and rho at that part of your worksheet and you obviously want your function ff to be defined with those constant values.

The solve blocks with Odesolve may be a bit trickier, you could do it that way (the function name y1 inside the solve block does not matter, it could be anything):

COD1.png

25-Diamond I
February 25, 2013

One additional thought: Making the result of Odesolve, y, a function af alpha, rho and x as you need, is even a bit trickier, I found. You can do it as shown below, but evaluation is quite slow. Anybody having a better idea?

COD2.png

Anousheh1-VisitorAuthor
1-Visitor
February 25, 2013

Hi,

Thank you Werner. I am trying what you have suggested. Let me see if I can get the results I need.

Regards,

Anousheh

25-Diamond I
February 25, 2013

Anousheh Rouzbehani schrieb:

Hi,

Thank you Werner. I am trying what you have suggested. Let me see if I can get the results I need.

Regards,

Anousheh

I think the attached sheet should fulfill your needs.

I deleted the sections above "Xc, Qc and Yc Section" and have not yet integrated Alans suggestion.

Werner

COD3.png

19-Tanzanite
February 25, 2013

The end of the attached file shows a neater way of solving your ODE.

Alan

Anousheh1-VisitorAuthor
1-Visitor
February 25, 2013

Hello Alan,

Thank you for your time. This is really nice way to do the graphs in a neater way.

Would you please help me to put this idea into a simple program that produces the end results, namely: x1c, Q1c and y1c, etc. in an array type form? These are critical values for 3 different alphas and different rhos=2, 5, 10, 20, 30, 50 and 60.

Thank you so much,

Anousheh