Skip to main content
1-Visitor
November 7, 2010
Solved

Help needed with programmed function using symbolics

  • November 7, 2010
  • 2 replies
  • 6430 views

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

Best answer by ptc-2128955

Rag,

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

Aaron

2 replies

19-Tanzanite
November 7, 2010

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.

rag1-VisitorAuthor
1-Visitor
November 7, 2010

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

19-Tanzanite
November 7, 2010
According to the Plot: Define t. as range variable did not help.

Did you define it with units of time?

1-Visitor
November 11, 2010

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

rag1-VisitorAuthor
1-Visitor
November 11, 2010

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

rag1-VisitorAuthor
1-Visitor
November 11, 2010

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