Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations GregLocock on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

help with functions and ranged variables

Status
Not open for further replies.

jtrox

New member
May 31, 2004
2
hello just a newbee question...
I wanted to assign the result of a function with a ranged variable as input to another variable... but mathcad13 gives an error saying "this value must be a scalar or a matrix"..
example:
i:=1..10
f(x):=x^2

cd:=f(i) <<<<<error f(i) must be a scalar or matrix..

is there a way to get the result as a list..

thanks, anyone..
 
Replies continue below

Recommended for you

The argument of function f should be a vector (2nd line below):

i := 1..10
j[i := i (if ORIGIN=1), or j[i-1 := i (if ORIGIN=0)
f(x) := x^2
cd := f(j)

Peter
 
this works... thanks..
and pls. one more question..
is there a built in function in mathcad that does something like this.. ie create a vector from a list with specific stepsize.. something like..
i := 0.1,0.2..10
j[(i*10)-1 := i

I just thought something like this this is somewhat very common and there might be some kind of builtin functions for this... instead of having to write a temporary list for every vector variable I wana create..

thankyou very much...
 
For linearly spaced points, no. If you had log spaced points you could use the built-in 'logspace' function. A built-in 'linspace' function would be useful though, and if you like you can send a feature request to Mathsoft support.

In the meantime you can create a worksheet with your own user defined functions and include it at the top of each worksheet as a reference (Insert > reference).

Peter
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor