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

Community Tip - Need to share some code when posting a question or reply? Make sure to use the "Insert code sample" menu option. Learn more! X

odd even numbers

SFares
13-Aquamarine

odd even numbers

Hello,

my question is inside the mathcad sheet. it is about when the value is odd to return a certain value, and when it is even to return a different value. Thanks!

ACCEPTED SOLUTION

Accepted Solutions
Werner_E
25-Diamond I
(To:SFares)

Find attached one way to do it.

05.05.png

View solution in original post

11 REPLIES 11
Werner_E
25-Diamond I
(To:SFares)

You are making a mistake in thinking that in the odd case you will just get 2,6,,10, etc. Thats simply not true - Ceil will yield any multiples of 2 and because N=4 and 4 IS a multiple of 2 you get N=4.

Fred_Kohlhepp
23-Emerald I
(To:SFares)

Okay, If Npanels = 4 and TC = 18, you want Nf = 6.

Give us a few other examples:

Npanels = 4, TC = 17, Nf = ??

Npanels = 4, TC = 10, Nf = ??

Npanels = 4, TC = 7, Nf = ??

Interesting part would be different values of Npanels, as TC=17 and TC=7 sure should yield the same result (given the same Np).

Maybe something like this

05.05.png

SFares
13-Aquamarine
(To:Fred_Kohlhepp)

TC will always be an even number, but the divsion by 2 can be either odd or even. i have added more clarification in the attached sheet. Please let me know if you need more explanation. Thanks to you all!

Werner_E
25-Diamond I
(To:SFares)

Find attached one way to do it.

05.05.png

SFares
13-Aquamarine
(To:Werner_E)

Thank you Werner so much!

Werner_E
25-Diamond I
(To:SFares)

Here are three more equivalent functions, all based on the same principle

06.05.png

SFares
13-Aquamarine
(To:Werner_E)

Thanks a lot Werner !

Fred_Kohlhepp
23-Emerald I
(To:SFares)

okay, try this:

Nice appraoch, but you you have to replace TC_Panels by the argument tc in the routine.

You may also make it more compact:

05.05.png

SFares
13-Aquamarine
(To:Fred_Kohlhepp)

Thank you Fred! i like your approach too.

Announcements

Top Tags