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

Community Tip - Need help navigating or using the PTC Community? Contact the community team. X

Create Vector of Vectors that is sorted?

dsochor
5-Regular Member

Create Vector of Vectors that is sorted?

The attached Mathcad 15 worksheet (hopefully more folks can open this instead of Prime 3.1 format) is being created to determine the shear, moment, slope, and deflection of a simply supported beam. Towards the end of the worksheet I am attempting to create a vector that includes the point loads (y), distributed load start points (zs), and distributed load end points (ze). Is it possible to write a function that creates a vector with a total length of the sum of these smaller vectors and sorts the values by increasing length? The points in this vector give the points where the moment function is discontinuous .The total length of the vector will change as the number of point loads and distributed loads change.

Once this vector is created I'd like to use it as integral bounds to determine the centroid of the moment function between discontinuous points. Is it possible to set the vector and the vector +1 as integral bounds?

As always, thank you for your help.

1 ACCEPTED SOLUTION

Accepted Solutions
RichardJ
19-Tanzanite
(To:dsochor)

Is this what you are after?

View solution in original post

6 REPLIES 6
RichardJ
19-Tanzanite
(To:dsochor)

Is this what you are after?

dsochor
5-Regular Member
(To:RichardJ)

Thank you Richard, this is great! Is there a way to suppress excess 0s in the case where one of the loads is 0 such as in the attached?

Additionally, is there a to multiply the centroid function by another function, valve by value? It appears the vectorize function won't allow this.

RichardJ
19-Tanzanite
(To:dsochor)

Is there a way to suppress excess 0s in the case where one of the loads is 0 such as in the attached?

Yes, by deleting them

Additionally, is there a to multiply the centroid function by another function, valve by value? It appears the vectorize function won't allow this.

Your Reaction function? The problem is the inline evaluation. You can't have that with a function definition, because there are no values to display.

dsochor
5-Regular Member
(To:RichardJ)

Thank you Richard, currently the Centroid function excludes the outer values in xx. In this example it calculates the centroid between x-values 1 and 4, 4 and 8, 8 and 11. Is it possible to modify it such that it also calculates the centroid between 0 and 1, 8 and 11 (or any future extreme values)? I’ve tried changing the values of i but am only able to capture one of the two extremes. As you can see in the attached, trying to capture both cause the Centroid function to error.

Additionally, is it possible to create a function that uses each successive set of two values from vector xx as bounds of integrations, for example and integral from 0 to 1, 1 to 4, etc.

RichardJ
19-Tanzanite
(To:dsochor)

Thank you Richard, currently the Centroid function excludes the outer values in xx. In this example it calculates the centroid between x-values 1 and 4, 4 and 8, 8 and 11. Is it possible to modify it such that it also calculates the centroid between 0 and 1, 8 and 11 (or any future extreme values)? I’ve tried changing the values of i but am only able to capture one of the two extremes. As you can see in the attached, trying to capture both cause the Centroid function to error.

The problem seems to be a bug. If you define a range variable from 0 to last(xx)-1 it works (assuming you get the other indexing right). But if you add an inline evaluation to that range variable, it fails. The solution is to not use inline evaluations with range variables.

Additionally, is it possible to create a function that uses each successive set of two values from vector xx as bounds of integrations, for example and integral from 0 to 1, 1 to 4, etc.

Most things are possible

dsochor
5-Regular Member
(To:RichardJ)

Thank you very much Richard, this is very helpful!

Top Tags