×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Are you an
Engineering professional?
Join Eng-Tips Forums!
• Talk With Other Members
• Be Notified Of Responses
• Keyword Search
Favorite Forums
• Automated Signatures
• Best Of All, It's Free!

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

#### Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

# help with functions and ranged variables

## help with functions and ranged variables

(OP)
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..

### RE: help with functions and ranged variables

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

### RE: help with functions and ranged variables

(OP)
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...

### RE: help with functions and ranged variables

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

#### Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

#### Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Close Box

# Join Eng-Tips® Today!

Join your peers on the Internet's largest technical engineering professional community.
It's easy to join and it's free.

Here's Why Members Love Eng-Tips Forums:

• Talk To Other Members
• Notification Of Responses To Questions
• Favorite Forums One Click Access
• Keyword Search Of All Posts, And More...

Register now while it's still free!