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

Community Tip - Learn all about PTC Community Badges. Engage with PTC and see how many you can earn! X

General Mathcad Question - arguments

Jbryant61
4-Participant

General Mathcad Question - arguments

If I have a set of fucntions, each having say 3 arguments,

f1(p1,p2,p3)
f2(p1,p2,p3)
f3(p1,p2,p3)


If I want to perform some operations, do I have to include the arguments every time I call the functions: i.e.


f4=(f1+f2)/f3, would be written as:

f4(p1,p2,p3) = (f1(p1,p2,p3)+f2(p1,p2,p3))/ f3(p1,p2,p3)



the worksheet gets very messy when the operations are more complicated.



thanks
Jason



15 REPLIES 15
RichardJ
19-Tanzanite
(To:Jbryant61)

Yes, they have to be included.

Richard

Your question is not clear. An argument is never only parameters. It must include the independent variable or a combination of them as computationally associated in the RHS. If: a, b, c, d ... are defined or you can define in-situ where you call f(a,b,c,d,X):= .... just below, then you don't have to write f(a,b,c,d,X):= but simply f(X):=
There may be other ways of doing by local scalar assignment. You must provide a short example.

jmG

The forma arguments in a function definition are bound variables. The names are irrelevant, and can be changed at will to anything you want. In particular, they are completely unrelated to any other variables that might have the same names.

To evaluate a function values must be assigned to the arguments. The only way to do this is to include an argument list with the desired values.

Note that this applies to the numeric processor. The symbolic processor plays with a rather different set of rules, and there are other ways of doing things with it. If you find that the argument lists are getting out of hand, perhaps you should look at reducing the number of arguments. Or using the symbolic processor.
__________________
� � � � Tom Gutman
Jbryant61
4-Participant
(To:TomGutman)

Can you do the equivalent of "Maximise" using the symbolic processor?

Jason

No, you can't do maximize with the symbolic processor. You can try for critical points (zeros of the derivatives), and that may amount to the same thing (depends on the shape of your function). But, like all roots, it only works for very simple functions.

More to the point is that you can use the symbolic processor to create your objective using expressions with free variables, and then make a function out of it at the end. The resulting function might be too big and complicated to actually read, or perhaps even display, but that matters not to the calculations.
__________________
� � � � Tom Gutman

On 3/20/2009 11:59:04 AM, Jbryant61 wrote:
>...
>the worksheet gets very messy
>when the operations are more
>complicated.
>
>
>
>thanks
>Jason

Perhaps something like the following would help?

- Guy
Jbryant61
4-Participant
(To:GuyB)

Hi, thats very useful thanks.

Jason
RichardJ
19-Tanzanite
(To:Jbryant61)

You could make p a vector of three values. Then you would have

f4(p) = (f1(p)+f2(p))/f3(p)

It doesn't get rid of the arguments, but at least the list is shorter.

Richard

On 3/20/2009 6:48:00 PM, rijackson wrote:
>You could make p a vector of
>three values. Then you would
>have
>
>f4(p) = (f1(p)+f2(p))/f3(p)
>
>It doesn't get rid of the
>arguments, but at least the
>list is shorter.
>
>Richard
____________________________

You can even pass it in a "for loop" and treat within the "for loop" itself and carry the processing further down the program.

jmG



Jbryant61
4-Participant
(To:RichardJ)

I like this idea but couldn't get it working with the enclosed example.

thanks
Jason
StuartBruff
23-Emerald II
(To:Jbryant61)

On 3/21/2009 3:56:44 AM, Jbryant61 wrote:
>I like this idea but couldn't get it working with the enclosed example.

Attached?


Jbryant61
4-Participant
(To:StuartBruff)

Hi Stuart, thanks for your help.

so how to then plot the 3D graph showing how the figute now varies with 2of the original arguments (say F1Shift & F17Shift).

Is there a good visual way to plot how the function would vary with the 3 arguments?


thanks
Jason

On 3/23/2009 3:25:02 AM, Jbryant61 wrote:
>Is there a good visual way to
>plot how the function would
>vary with the 3 arguments?

To do this you need to leave in 4th dimensions. But you do! So, you can animate a 3D plot, selecting which parameter could be the time. (You ask for a visual way, not say anything about printing).

Alvaro.
Jbryant61
4-Participant
(To:AlvaroDíaz)

Hi Alvaro, yes I forgot to mention "for printing".

Is there a way such as making the z axis the 3rd argument and using colour to represent the value of the evaluated function?

thanks
Jason

On 3/23/2009 4:48:44 AM, Jbryant61 wrote:
>Is there a way such as making
>the z axis the 3rd argument
>and using colour to represent
>the value of the evaluated
>function?

Yes, there are. I belive that the attached is one. In grayscale for bw printing.

Alvaro.
Top Tags