Skip to main content
8-Gravel
February 6, 2024
Solved

Prime 8: Input Vector to For Loop, Get Scalar Back, but Want Vector

  • February 6, 2024
  • 1 reply
  • 1526 views

Hello, I am inputting a vector into a for loop, but struggling to get a vector back for the output.  I would appreciate any help.  I could not figure it out from other examples on this forum.  I am wondering if I am making an error in the initial step of the for loop? 

 

Thank you.

Best answer by DJNewman

DJNewman_0-1707258328916.png

 

Here's what Luc is saying put into practice. You don't need a program, you can just have a vectorised function definition.

1 reply

23-Emerald IV
February 6, 2024

1. You should attach your Prime Worksheet.

2. Your program for delta.x uses i in the for loop, but you are not using i in the index of the vector. This means your program does not create a vector.

3. I think that if you vectorise the expression after 

delta :=

Then delta will be the vector you are looking for, and you don't even need the program for delta.x

 

Success!

Luc

DJNewman
DJNewman18-OpalAnswer
18-Opal
February 6, 2024

DJNewman_0-1707258328916.png

 

Here's what Luc is saying put into practice. You don't need a program, you can just have a vectorised function definition.

PTC Marketer for Creo and Mathcad. I run their YouTube channels, some Creo campaigns, and all Mathcad campaigns and communications.
8-Gravel
February 6, 2024

DJNewman and Luc, thank you so much!  DJ, I appreciate you putting up the image.  Sorry for not including the worksheet, I will definitely do so in the future!