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
- :
- Problem with 'substitute' in Mathcad15

Options

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

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

Showing results for

Highlighted

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

06-09-2019
08:22 AM

06-09-2019
08:22 AM

I tried to follow advice given in another thread to do this (See file):

Mathcad complains about the units of 's', but that's not the problem. I want to substitute i*omega for s. Under Symbolics, Variable > substitute is greyed out. Pressing CTRL-SHFT-. gives a place holder, which disappears, followed by the arrow shown. I tried re-starting Mathcad, but I still get the same problem. Of course, Mathcad says s is undefined, but I suppose it wouldn't need to be defined for the substitution operation.

Solved! Go to Solution.

Labels:

1 ACCEPTED SOLUTION

Accepted Solutions

Highlighted

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

06-09-2019
11:35 AM

06-09-2019
11:35 AM

Not sure what you are looking for at the end of the day, but wouldn't Terry's approach be all you need? Without any symbolic "substitute".

Or is your goal to apply some further symbolic manipulations on F after the substitution?

P.S.: I would suggest to use a literal index for your constants omega.1, etc. instead of a vector index. The way you defined those constants you had defined a 5 element vector omega (first element being 0 as Mathcads first index is by default 0, not 1). I guess you did not intend to define a vector omega, right?

20 REPLIES 20

Highlighted
##

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

06-09-2019
08:49 AM

06-09-2019
08:49 AM

Re: Problem with 'substitute' in Mathcad15

Hi,

Highlighted
##

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

06-09-2019
09:13 AM

06-09-2019
09:13 AM

Re: Problem with 'substitute' in Mathcad15

I adopted your syntax, but I still can't get 'substitute' to appear.

Highlighted
##

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

06-09-2019
09:46 AM

06-09-2019
09:46 AM

Re: Problem with 'substitute' in Mathcad15

You should define omega as an independent variable and define the constant values of omega with the dot and not omega as a vector.. Furthermore I think that you will find difficulties when plotting the function with omega defined as a vector.

About the substitution you should follow the following procedure:

Highlighted
##

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

06-09-2019
10:15 AM

06-09-2019
10:15 AM

Re: Problem with 'substitute' in Mathcad15

Hi,

Enclosed is file. Note the k:=k etc at the top of the file

Highlighted
##

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

06-09-2019
10:52 AM

06-09-2019
10:52 AM

Re: Problem with 'substitute' in Mathcad15

Thank you. The Help is totally silent on the curious need to 'assert' the symbols k, lambda and omega. I will need to wrie a new worksheet to see if the issue is resolved.

Highlighted
##

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

06-09-2019
11:25 AM

06-09-2019
11:25 AM

Re: Problem with 'substitute' in Mathcad15

Highlighted
##

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

06-09-2019
11:45 AM

06-09-2019
11:45 AM

Re: Problem with 'substitute' in Mathcad15

Thank you. Do you mean that the subscript for omega-1 should be '.1', and for omega-n should be '.n'? Is this syntax explained anywhere?

How did you decide about the need for 'Independent variable range' and how to define it?

I think this is getting impracticably complicated, but I see it produces what looks like the correct magnitude response.

Highlighted
##

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

06-09-2019
03:04 PM

06-09-2019
03:04 PM

Re: Problem with 'substitute' in Mathcad15

In the form I used to solve your problem, I cannot use a vector as an independent variable of a function and use constants with the same name as the independent variable. I can define constants as elements of a vector that has a name different from the independent variable. The constant pulsation, for example 1 / (RC), I define it as: omega.1: = 1 / (R C). I have never used vectors as independent variables.

In recent years I have published here, in this community, some files related to analog and digital filters, for example this:https://community.ptc.com/t5/PTC-Mathcad/4-HIGH-PASS-I-order-DIGITAL-FILTERS-EQUIVALENT-TO-LINEAR-CL...

but there are others. In these files the criteria for choosing sampling frequencies are missing. Gap completed in new versions.

Highlighted
##

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

06-09-2019
03:11 PM

06-09-2019
03:11 PM

Re: Problem with 'substitute' in Mathcad15

I understand (for once!). I didn't intend to introduce vectors; I used [ to set subscripts instead of '.'.

Highlighted
##

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

06-09-2019
11:03 AM

06-09-2019
11:03 AM

Re: Problem with 'substitute' in Mathcad15

I can now get 'substitute' to appear by using the symbolic keyword menu, but now 'i' is an undefined variable. See teh attached file.

Highlighted
##

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

06-09-2019
01:10 PM

06-09-2019
01:10 PM

Re: Problem with 'substitute' in Mathcad15

That's correct, *i* is generally an undefined variable in Mathcad.

In order to get i, the unit of imaginary numbers, you have to type 1i.

But if you need 2*pi*i, you can also type 2i*p[Ctl-G]. The important part is that i is immediately preceded by a number.

Success!

Luc

Highlighted
##

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

06-09-2019
10:53 AM

06-09-2019
10:53 AM

Re: Problem with 'substitute' in Mathcad15

I will try to do as you advise.

Highlighted
##

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

06-09-2019
11:05 AM

06-09-2019
11:05 AM

Re: Problem with 'substitute' in Mathcad15

The 'vector' arrow was added by Mathcad, not me. I quite understand that omega is not a vector.

Highlighted
##

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

06-09-2019
10:44 AM

06-09-2019
10:44 AM

Re: Problem with 'substitute' in Mathcad15

In short, you should select the expression of which you want to substitute one variable and use the 'substitute' from the symbolics toolbar, not from the menu.

(The menu will allow you to do symbolics, but they are not 'live' symbolics: if you change the expression later, the substitution will not follow suit automatically; you'd have to redo the substitution...)

To get the toolbar, select (from the menu): View=>Toolbar=>Symbolic.

Success!

Luc

Highlighted
##

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

06-09-2019
11:08 AM

06-09-2019
11:08 AM

Re: Problem with 'substitute' in Mathcad15

Yes, I discovered that one has to use the menu. I wish the Help was a bit more forthcoming on this subject, instead of showing very simple examples which few would need help with.

Highlighted
##

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

06-09-2019
08:55 AM

06-09-2019
08:55 AM

Re: Problem with 'substitute' in Mathcad15

Hi,

The above is a problem as s is undefined so MathCad is taking the value of s as 1 second by default.

In the first function F (which has a green highlight) uses s as a parameter to the function so s is defined in the right hand side as it gets passed into the function. s's scope is limited to the function F. It is not defined as s in the scope of the document.

The green highlight shows that F is also a predefined unit in mathcad. Good habit is to use more than one symbol to define functions

In the above when you call F(the first one) by use of F(gamma). Gamma is defined on the worksheet so the message "undefined variable" message disappears.

Note the second function F(now with a green highlight) is also a redefinition of the first F.

F2 is now a function that does not overwrite first function F.

F2 has as a parameter omega. F2 is simply F with a passed in parameter i*omega that is substituted for s in F

Cheers

Terry

Highlighted
##

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

06-09-2019
09:02 AM

06-09-2019
09:02 AM

Re: Problem with 'substitute' in Mathcad15

Yes, F is a predefined unit, for Farad.

But in this case F gets a green underline because F() is a function (too), the F-distribution...

Luc

Highlighted
##

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

06-09-2019
09:10 AM

06-09-2019
09:10 AM

Re: Problem with 'substitute' in Mathcad15

I think I understand so far. But it's the next step that fails. Neither Symbolics > Variable > Substitute (which is greyed out) or CTRL-SHFT-. give me the keyword 'substitiute' and its placeholders.

By the way, that's 'lambda', not 'gamma'.

Highlighted

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

06-09-2019
11:35 AM

06-09-2019
11:35 AM

Not sure what you are looking for at the end of the day, but wouldn't Terry's approach be all you need? Without any symbolic "substitute".

Or is your goal to apply some further symbolic manipulations on F after the substitution?

P.S.: I would suggest to use a literal index for your constants omega.1, etc. instead of a vector index. The way you defined those constants you had defined a 5 element vector omega (first element being 0 as Mathcads first index is by default 0, not 1). I guess you did not intend to define a vector omega, right?

Highlighted
##

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

06-09-2019
11:52 AM

06-09-2019
11:52 AM

Re: Problem with 'substitute' in Mathcad15

That looks a lot simpler. BIG hidden error using the wrong keys to get the subscripts. That's what comes of using Mathcad only infrequently. When I've used it intensively in the past, I was defining vectors very often.