Get Help

Turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

- Community
- :
- PTC Mathcad
- :
- PTC Mathcad
- :
- Re: for some vector [25 15 23 20 .. n ] i want to ...

Options

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

02-10-2020
09:07 AM

02-10-2020
09:07 AM

Hi,

I want to write a code where for some vector [25 15 23 20 .. n ] i want to find if the ratios of the __adjacent__ values exceed 1.2 of each other. The output result would be like "Yes" or "No". how do i go about doing that?

For example: for vector [15 25 20], because 25/15>1.2, I want the answer as "Yes".

But I would also want the same answer "Yes" if it was [25 15 20] because in this case also for the adjacent values 25/15>1.2.

Thanks.

Edit1: added "ratios of the"

Edit2: added example

Solved! Go to Solution.

Labels:

1 ACCEPTED SOLUTION

Accepted Solutions

Highlighted

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

02-10-2020
12:22 PM

02-10-2020
12:22 PM

7 REPLIES 7

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

02-10-2020
10:17 AM

02-10-2020
10:17 AM

Re: for some vector [25 15 23 20 .. n ] i want to find if the adjacent values exceed 1.2 of each oth

Maybe a custom command like the following will do the job:

In case you are using Prime, use "else" instead of "otherwise".

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

02-10-2020
11:10 AM

02-10-2020
11:10 AM

Re: for some vector [25 15 23 20 .. n ] i want to find if the adjacent values exceed 1.2 of each oth

I'm so sorry that i mistyped the question.

For example: for vector [15 25 20], because 25/15>1.2, I want the answer as "Yes".

But I would also want the same answer "Yes" if it was [25 15 20] because in this case also for the adjacent values 25/15>1.2.

Thanks for your reply

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

02-10-2020
11:43 AM

02-10-2020
11:43 AM

Re: for some vector [25 15 23 20 .. n ] i want to find if the adjacent values exceed 1.2 of each oth

OK, so its the Ratio, not the difference.

And what do you expect as a result? Just one single "Yes" or "No" for the whole Vector if the Ratio of __any__ adjacent pair exceeds 1.2, or a "Yes" or "No" for every triple (or pair?) in the Vector?

If the latter - what about the ends? Do you expect an n x 1 vector, an (n-1) x 1 vector or an (n-2) x 1 vector as a result?

Highlighted

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

02-10-2020
12:22 PM

02-10-2020
12:22 PM

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

02-10-2020
09:02 PM

02-10-2020
09:02 PM

Re: for some vector [25 15 23 20 .. n ] i want to find if the adjacent values exceed 1.2 of each oth

Just one single "Yes" if the Ratio of __all __adjacent pair does not exceeds 1.2, and just a single "No" if the Ratio of __any__ adjacent pair does not exceeds 1.2.

Sorry for my bad english.

Thank you.

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

02-11-2020
09:50 AM

02-11-2020
09:50 AM

Re: for some vector [25 15 23 20 .. n ] i want to find if the adjacent values exceed 1.2 of each oth

OK, so you would have to exchange "Yes" and "No" in my last attempt.

Otherwise it should do what you demand.

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

02-11-2020
11:59 AM

02-11-2020
11:59 AM

Re: for some vector [25 15 23 20 .. n ] i want to find if the adjacent values exceed 1.2 of each oth

Thanks I was looking for the algorithm on how i should work it out;; your last attempt helped me a bunch!! thanks a lot!