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

Community Tip - Your Friends List is a way to easily have access to the community members that you interact with the most! X

How to use a result in my next equation? (new to MathCAD)

A.DelNegro
4-Participant

How to use a result in my next equation? (new to MathCAD)

I'm new to MathCAD and do find it much nicer than excel when it comes to handleing units. My question is...

If I create a function, and then use that function to determine a value, how can I then use this value in a following calculation without having to insert the full funtion into my next one. i.e.

screen_capture-20110718-084305.jpg

27 REPLIES 27
MikeArmstrong
5-Regular Member
(To:A.DelNegro)

Something like below?

Clipboard01.jpg

Mike

An alternative approach.

Clipboard01.jpg

Mike

I was reposting while you added this. I think this would work. Thanx

MikeArmstrong
5-Regular Member
(To:A.DelNegro)

Anthony DelNegro wrote:

I was reposting while you added this. I think this would work. Thanx

No problem at all.

Mike

Somthing like that... I'm aware that you can embed the finction in like that, I guess I'm still thinking with my Excel hat on. The issue with embeding it like that is that when you string together 4 or 5 calculations in a chain, you can get a huge equation at the end. I guess what I'm looking for is a way for it to act more like Excel. More like below.... If I assign an X and Y value, I can just use it in the function. In this case, if I want to change the value of x or y, then the answer will change as well. If I could somehow assign the value of "f" to be the answer on line 4, then I could use it in later calculations and it would correct itself if I were to change x or y.

screen_capture-20110718-090407.jpg

Try using the following (I know that the initial version of the example shown in Prime, but it does not matter):

Example.JPG

P.S. Now on the other computer does not have access to the Prime

A.DelNegro
4-Participant
(To:VladimirN)

Thanx Vladimir. That seems like a good way to do it as well. Probably better since it doesn't have the re-definition [f:=f(x,y)] needed.

Well, if you want that in calculation as a variable and user-defined function used by the letter "y", then it can be written in Mathcad 15 so (a little tricky way, anyone can guess which one? 😞

Example.JPG

P.S. Now on the other computer does not have access to the Prime.

MikeArmstrong
5-Regular Member
(To:VladimirN)

Well, if you want that in calculation as a variable and user-defined function used by the letter "y", then it can be written in Mathcad 15 so (a little tricky way, anyone can guess which one? 😞

Example.JPG

Like so?

Clipboard01.jpg

Mike

Yes:

Example.jpg

P.S. Anthony, I attached to the message this file for version MC15 (it will be possible to you interesting).

MikeArmstrong
5-Regular Member
(To:A.DelNegro)

Thanx Vladimir. That seems like a good way to do it as well. Probably better since it doesn't have the re-definition [f:=f(x,y)] needed.

I couldn't disagree more. The more each function is dependant on variables the more complicated the worksheet becomes.

Mike

Look how complicated it starts to get.

Clipboard01.jpg

Mike

The way I would do it.

Clipboard02.jpg

Mike

I did end up doing it your way Mike. It does seem to get a bit coplicated that way and with your way, you only need to use the last defined variable in the equation. It acts more like Excel that way too.

My next question would be is it possible to make a plot of K on the Y-axis and x on the X-axis?

MikeArmstrong
5-Regular Member
(To:A.DelNegro)

My next question would be is it possible to make a plot of K on the Y-axis and x on the X-axis?

Have a look at the Mathcad 15 worksheet attached. I have used a predefined function 'vec' located in the collapsed area to create a vector oif numbers for x.

Clipboard01.jpg

Mike

Anthony DelNegro wrote:

My next question would be is it possible to make a plot of K on the Y-axis and x on the X-axis?

And here is how it is possible to present it in Prime 1.0:

Example_Prime.jpg

P.S. Also, you can see examples of work with the program and examples of problem solving in Mathcad Prime 1.0 in "Mathcad Prime 1.0 Help Center"..

MikeArmstrong
5-Regular Member
(To:VladimirN)

Nice example Valdimir. While we're on the topic of tables in Prime I maze well give my opinion on a additional feature I would like to see implemented.

I like the new format where variables can be defined in a table, but I think the tables should be able to accept variables.

I.e. if x was a 1 row, 5 colunm vector - you could select a table and it asks for a name or varible. If a defined variable is inputted the table should show the vector in a table.

Mike

Mike Armstrong wrote:

Nice example Valdimir. While we're on the topic of tables in Prime I maze well give my opinion on a additional feature I would like to see implemented...

Thanks, Mike. Could you provide a link to the topic in the forum?

P.S. Offtop: Congratulations on a set of ten thousand points on the forum!

Points.JPG

MikeArmstrong
5-Regular Member
(To:VladimirN)

Thanks, Mike. Could you provide a link to the topic in the forum?

What topic? I haven't created one.

Maybe I should create a thread in the Enhancing Mathcad' section????

P.S. Offtop: Congratulations on a set of ten thousand points on the forum!

Points.JPG

Thank you very much. It has taken some time to acrew those points.

Mike

What topic? I haven't created one.

Maybe I should create a thread in the Enhancing Mathcad' section????

My mistake .

Yes, it would be nice.

MikeArmstrong
5-Regular Member
(To:VladimirN)

My mistake .

Yes, it would be nice.

Created here.

http://communities.ptc.com/message/165602#165602

Please feel free to leave any comments or recommendations.

Mike

Hi Mike,

NO matter what, he still has 3 variables.

Sometimes its easier to construct by breaking up, but ultimately, if you are using the function repeatedly, I would much rather have the function in x,y,z than f(x,y),z, and if you have a long file, I am sure it is ultimately faster, and faster yet would be incorporate f(x,y) directly into the final equation.

Anyway, really depends on whether or not you want to see the f(x,y) result as well as the final.

MikeArmstrong
5-Regular Member
(To:wayne)

Sometimes its easier to construct by breaking up, but ultimately, if you are using the function repeatedly, I would much rather have the function in x,y,z than f(x,y),z, and if you have a long file, I am sure it is ultimately faster, and faster yet would be incorporate f(x,y) directly into the final equation.

It is faster, but for this example I doubt speed will be an issue.

Anyway, really depends on whether or not you want to see the f(x,y) result as well as the final.

Exactly, and whether one wants the calculation filled with functions which are dependant on variables. I am all for constructing functions, but only when necessary. We too often see worksheets on this forum filled with functions, which are dependant on multiple variables and the sheets looks horrible.

Just my take on it

Mike

Thanx for the discussion guys. Since I'm new to MathCAD, how then should I approch this problem. Are there any good tutorials on how to construct a good worksheet? BTW, the example I gave you was simplified for ease of explaination. I have used Excel for the last 20+ years for this sort of thing so it will take me a bit to un-learn what I know.

The basic setup is I have 8-10 equations that feed from one to the other (i.e. answer1 goes onto equation2, answer2 goes into equation3, etc...) The final result gives me the number I'm interested in, but then I want to see how the variables in my process affect the final number. I could construct one huge equation that gives me the answer with ALL the variables in it, sure, but that seems pretty cumbersome. (kinda like Excel). The one thing that really attracts me to MathCAD is the unit handling. We have some metric variables and some English. Its a pain, but I didn't invent that mess.

Any advice you can offer a newb would be much appreciated.

Tony

MikeArmstrong
5-Regular Member
(To:A.DelNegro)

The basic setup is I have 8-10 equations that feed from one to the other (i.e. answer1 goes onto equation2, answer2 goes into equation3, etc...) The final result gives me the number I'm interested in, but then I want to see how the variables in my process affect the final number. I could construct one huge equation that gives me the answer with ALL the variables in it, sure, but that seems pretty cumbersome. (kinda like Excel). The one thing that really attracts me to MathCAD is the unit handling. We have some metric variables and some English. Its a pain, but I didn't invent that mess.

Any advice you can offer a newb would be much appreciated.

Tony,

There is no right or wrong way to produce a worksheet. All people have different opinions on how a worksheet should look and be presented, but in the end of the day it is down to yourself or your employer. Mathcad has the capability to produce calculations as they are shown in text book.

Don't be afraid to post the more complex equations and ask for advice/help. People on this forum are not obliged to help, but more than often the majority of queries get answered.

Mike

Exactly, and whether one wants the calculation filled with functions which are dependant on variables. I am all for constructing functions, but only when necessary. We too often see worksheets on this forum filled with functions, which are dependant on multiple variables and the sheets looks horrible.

As always, depends on what you are doing. The picture is wood beam design with uniform and multiple concentrated loads.This was the 15th beam design in this file, which taken from the middle of a file. If I did not use functions, it would be much longer, and slower and I would have to berak up the file. (in addition, the functions are in referenced files).

tmp.png

MikeArmstrong
5-Regular Member
(To:wayne)

Perfect example to prove your point Wayne.

The worksheet seems to complicated for me to comment .

Cheers

Mike

Top Tags