Welcome Guest! To enable all features please Login. New Registrations are disabled.

Notification

Icon
Error

Login


Options
Go to last post Go to first unread
Offline justhumm  
#1 Posted : 26 January 2019 22:37:00(UTC)
justhumm


Rank: Member

Groups: Registered
Joined: 02/03/2016(UTC)
Posts: 18
United States

I'm putting together a worksheet that assembles and manipulates a piecewise function.

The user enters X and Y coordinates in one matrix. And then uses a second matrix to describe how those points are connected.

I am getting incorrect values from a For Loop that calculates geometric properties for each line (or curve) segment (length, slope, y-intercept, etc.).

The slope (m = dy / dx) of the first two segments are being output as Zero, but the values (based on the input coordinates) should both be c. 3.7.

The third segment is a curve and those values (radius, chord length, etc.) are being calculated correctly.

The fourth segment is another line and the slope (c. 2.9) is being calculated correctly, this time.

I'm assuming that there is something wrong with my loop, but I am having trouble figuring it out. Any suggestions?

Thanks!





piecewise-forum.sm (60kb) downloaded 19 time(s).

Wanna join the discussion?! Login to your SMath Studio Forum forum account. New Registrations are disabled.

Offline Razonar  
#2 Posted : 27 January 2019 05:03:52(UTC)
Razonar


Rank: Advanced Member

Groups: Registered
Joined: 28/08/2014(UTC)
Posts: 1,356
Uruguay

Was thanked: 815 time(s) in 516 post(s)
Hi. Near the end, in the loop, you use "slope:=0" for the case circle. Change it by "slope[i:=0".

Best regards.

Alvaro.
thanks 1 user thanked Razonar for this useful post.
on 27/01/2019(UTC)
Offline justhumm  
#3 Posted : 27 January 2019 08:12:53(UTC)
justhumm


Rank: Member

Groups: Registered
Joined: 02/03/2016(UTC)
Posts: 18
United States

Wow. I completely missed that. Thanks for the reply!

Edited by moderator 27 January 2019 13:47:45(UTC)  | Reason: marked as Solved

Users browsing this topic
Guest
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.