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

Community Tip - New to the community? Learn how to post a question and get help from PTC and industry experts! X

Help needed with programmed function using symbolics

rag
1-Newbie
1-Newbie

Help needed with programmed function using symbolics

As Mathcad seems to offer no possibilities for solving differential equations symbolically other than using the Laplace transform I tried to write my own function.

I succeded, but the independent variable was fixed to "x".My efforts to make that variable selectable failed completely.

The main problem (as I see it now) seems to be the passing of a function as a paraneter of a self written function, but maybe I am missing a point.

I tried to simplified the problem by writing a simple function which should yield the derivative of its argument function. I'd liked to call it Diff and I wanted the following results:

Diff(sin(x),x) --> cos(x)

Diff(sin(a),a) --> cos(a)

but

Diff(sin(a),b) --> 0

I found no way of achieving this. Maybe someone could be so kind and help me out.

A second question about a plot which doesnt work as expected is in the attached worksheet at the end.

I am using Mathcad 14 M030 and the file was saved in MC11-Format

Thanks in advance

Rager

1 ACCEPTED SOLUTION

Accepted Solutions

Rag,

Symbolic evaluation expressions must be typed elsewhere in the sheet and then copied/pasted inside programming blocks.

Aaron

View solution in original post

11 REPLIES 11
RichardJ
19-Tanzanite
(To:rag)

I don't see any way to fix the symbolics issue.

As far as the graph goes, don't use the Quickplot feature with units. It doesn't handle them properly. Explicitly define t. as a range variable.

rag
1-Newbie
1-Newbie
(To:RichardJ)

Richard Jackson schrieb:

I don't see any way to fix the symbolics issue.

As far as the graph goes, don't use the Quickplot feature with units. It doesn't handle them properly. Explicitly define t. as a range variable.

Thanks for the reply.

According to the Plot: Define t. as range variable did not help. The effect puzzles me, because both u(t) and uc(t) are functions which take a time and result in a voltage. u(t) is shown and uc(t) not.

Correction: I forgot adding the units to the range variable. Done correctly both functions plot now - Tnx! Still don't understand why u(t) and uc(t) were treated differently.

The Main problem is, as I see it now, possibly not a problem with the symbolics but seems to have to do with the way Mathcad handles (or can not handle) a function as a parameter in a selfdefined function and how and when the assigned parameters are substituted. I cannot see a pattern or logic in the way, my attempts were handled.

Regards

Rag

RichardJ
19-Tanzanite
(To:rag)

According to the Plot: Define t. as range variable did not help.

Did you define it with units of time?

rag
1-Newbie
1-Newbie
(To:RichardJ)

Did you define it with units of time?

Not in the first place - exactly that was the problem, thanks. But I realized it myself after a while and already edited my reply accordingly quite a while ago. The change in the posting showed up immedeately here, obviously not at your side.

BTW, am i the only one finding this community rather hard to navigate and search? There seems to be kind of an attempt for a treeview using indentations but in a why which is nearly useless. When I come back to poke around older postings it would be useful to have some kind of flag so you know which threads or posting you already read and maybe be presented with the unread ones only. While I see some possible personalisations using the gimmicks called widgets (didn't really found something extremely useful there) I was not able to mark postings as already read and suppress them. Sure I am missing something.

While poking around searching for ODEs and programming I also stumbled over a lot of older posting which seemingly are missing the attachments and with a lot of dead links. Is there something broken on my side or is this supposed to be so?

Regards

Rag

MikeArmstrong
5-Regular Member
(To:rag)

When I come back to poke around older postings it would be useful to have some kind of flag so you know which threads or posting you already read and maybe be presented with the unread ones only.

This has been requested numerous times by multiple collabs. The only logical way I can keep track of new postings is to receive e-mail notifications.

While poking around searching for ODEs and programming I also stumbled over a lot of older posting which seemingly are missing the attachments and with a lot of dead links. Is there something broken on my side or is this supposed to be so?

A lot of the older threads have been corrupted, which happened with the forum change.

You can look around the old site hear.

http://collab.mathsoft.com/~mathcad2000

Mike

RichardJ
19-Tanzanite
(To:rag)

The change in the posting showed up immedeately here, obviously not at your side.

I read your post, went away to do other things, then replied much later without rereading the post

BTW, am i the only one finding this community rather hard to navigate and search?

Unfortunately, no.

When I come back to poke around older postings it would be useful to have some kind of flag so you know which threads or posting you already read and maybe be presented with the unread ones only. While I see some possible personalisations using the gimmicks called widgets (didn't really found something extremely useful there) I was not able to mark postings as already read and suppress them. Sure I am missing something.

No, you are not missing something. I would say this is the single biggest obstacle to navigating the discussions. I know I often miss posts, and even whole threads. PTC is certainly aware of this problem, but I suspect they don't know of any way to address it.

While poking around searching for ODEs and programming I also stumbled over a lot of older posting which seemingly are missing the attachments and with a lot of dead links. Is there something broken on my side or is this supposed to be so?

The older posts in this forum were ported from two previous forums: the old PTC forum and the Mathcad Collaboratory. PTC did a poor job of the port though. The ones from the old PTC forum are the worst. There are many threrads with posts where all that was ported was the quoted text, but not what the poster actually wrote, questions that show up 5 posts later than the reply, etc. Many of those threads are now so garbled they are essentially useless. The posts that were ported from the Collab are generally OK as far as the text goes, but they left all the hyperlinks pointing to the old forum. For now that means at least they point somewhere, but when the old forums come down permanently they will just be dead links, and that will make many of the threads completely useless. They also decided to not port any attachments that are were than 5 years old. Again, as long as the old forum is available you can hunt them down there, but that will not be for ever.

WInfrod,

Tom Gutman's "Jacobian etc" worksheet/library should do what you want with the symbolics, at least with the derivative. It's a gem. It's written in M11 but I don't recall reading anywhere that it doesn't work in 14. I don't know; I don't have 14. Put jacobian gutman in the search box and look for a post in Sep 2007.

Aaron

Thanks alot, Aaron, I found the worksheet and just had a quick look at it. It really looks very interesting.

I tried SymDif(sin,x) but it simplified symbolically to SymDif(sin,x), so it didn't work like I expected at first glance.

Looks like the function should approximately do what I want and maybe I have to investigate a little more. Hope its not a problem with the Mathcadversion.

While trying to retype that function I run into problems - I was not able to do so. I know about the special character insertion, so the problem was not the >X< but I was not able to insert the symbolic evaluation in the brackets. The last evaluation did not result in anything, no error message either - never saw this efect - strange!

Rag

Tom Gutman's "Jacobian etc" worksheet/library should do what you want with the symbolics, at least with the derivative. It's a gem. It's written in M11 but I don't recall reading anywhere that it doesn't work in 14. I don't know; I don't have 14. Put jacobian gutman in the search box and look for a post in Sep 2007.

Aaron

rag
1-Newbie
1-Newbie
(To:rag)

At second glance it works great and does exactly what I tried to achieve.

Great idea to change the nominator in the differential quotient which is necessary beacuase the variable in the demoninator for unknown reasons cannot be replaced by a function parameter.

The problem remaining is now that I am not able to retype this or a similar expression.

How do you input an expression like

P1.png

which changes when the function is used somewhere below

P2.png

Have no clue how to do that, maybe someone could explain the secret.

Again many thanks to Aaron for pointing me to that great collection of Tom Gutman!

Rag

Rag,

Symbolic evaluation expressions must be typed elsewhere in the sheet and then copied/pasted inside programming blocks.

Aaron

Symbolic evaluation expressions must be typed elsewhere in the sheet and then copied/pasted inside programming blocks.

Aaron

I had already tried this, but only with the inner symbolic evaluation and had no success.

Now that I also typed the outer evaluation elsewhere and copied it, it works. That way the outer evaluation is triggered _before_ the assignement to the dummy variable A and that seems to make it work.

Thanks again for your help!

Rag

Top Tags