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

Community Tip - Did you get an answer that solved your problem? Please mark it as an Accepted Solution so others with the same problem can find the answer easily. X

Why the derivation calculation can't be done in the function block?

ptc-4622978
1-Newbie

Why the derivation calculation can't be done in the function block?

Attached pls find my mathcad worksheet. In this worksheet, I define a function Vout. First I calculate the R1 derivative of the function (step 1), it works. Then I use a function block to do the sensitivity analysis of R1 for the function Vout (step 2), but it report that "Can't calculate the expression". Why the step 1 can work, but step 2 can't?

Thanks,

Simon

12 REPLIES 12

May be the attach help You

You have to define your Sen_R1 either as a function of the variables R1, R2 and Vin or as a constant derived from the defined constants R1, R2 and Vin.

You have done the latter and failed, because you tried a symbolic evaluation.

Symbolic evaluation of Sen_R1 does not work, because the symbolic engine in Mathcad does not know that V=ohm*A, in fact it does not know anything about units. So ohm, V and A, which are part of your derivation, are not cancelling and are seen as variables.Therefore the condition ...>0 cannot be decided and evaluated.

Look if the attached helps.

WE

P.S.: While playing around with that sheet I realized, that in contrary to Version 15 and below, the "trick" x:=x to "reset/clear" a variable for the symbolic engine does not work anymore in Prime. I have not done a lot with prime 'til now and I must confess that i don't like it at all. Nevertheless: ist there a posibility in Prime to achieve the same effect as x:=x has done in the adult Mathcad versions?

Use clear(x) to clear a definition of a variable (both symbolic and numeric). Use clear_sym(x) ("_sym" is subscript) to clear only symbolic defintion.

Hello Werner,

Thanks! But I still don't understand why the expression in the first step can work? It's also a symbolic evaluation.

Simon

The conditional

Screen+Shot+2012-11-14+at+9.25.04+AM.png

Does not evaluate to true (non-zero) or false (zero) under symbolic evaluaiton. This is because SIUnitOf does not evaluate symbolically.

In this case, the numeric evalualiton will give you the required result. Note also that dividing with SIUnitsOf is not necessary. It will not change the symbolic evaluaiton outcome, since units will not be simplified symbolically (something that we can work on as an enhancement).

--Jakov

Hello Simon!

Thanks! But I still don't understand why the expression in the first step can work? It's also a symbolic evaluation.

In your step 1 you have used a symbolic evaluation AND a numeric one (=). The symbolic evaluation produced an expression with V, kohm and and the unevaluated function SiUnitsOf(...). This expression is, what in you step 2 can not be compared to >0 symbolically - mainly, as Jakov pointed out, because SIUnitsOf is not avaluetd symbolicalle and so the units don't cancel and are treated as unknow variables. The symbol processor is not able to simply that to 1/900. The numeric evaluation of that expression can be done, results in -0.001 and is saved in step 1 to the Variable Deri_R1. This is all as it should be (not really, as we all wish that the symbilic engine should be aware of units, too) or better as we are used from former MC versions, but:

What I don't understand is, why I see

15.11_1.png

when I open your worksheet, but if I recalculate this expression or the whole worksheet and also if I retype that expression myself, I get the error "this value has to be a function". The numeric evaluation seems to fail:

15.11_2.png

But doing all the conversions in two steps it works as expected:

15.11_3.png

I would call that a bug, but it seems that it works for you as it should. No clue why it doesn't work here for me. I am using the newest Mathcad Prime 2.0 M010 in the German version and can not find a way to switch the language. On the other other hand as I understand the language set at installation time only affects the menues and not, as in MC15, the keywords or anything else. So the problems with "variable" t being interpreted as tons, s as second (e.g. with laplace resp. invlaplace) are history with Prime. So this is a clear improvement over Mathcad 15 as is the new function clear() which Jacov has pointed me to.

Nevertheless the question remains, why does the chain "sybolic and then numeric evaluation" works for you and not for me? Perhaps Jakov can shed some light on this!?

WE

Let me try to replicate your issue, and I will report back.

Mathad UI language can be set with command-line parameter (/culture:en-US for example). It defaults to whatever your OS is using. See Read This First under Getting Started tab for full details.

The error looks like a bug. I will report it to dev. If you delete division by SIUnitsOf (which is not necessary anyways) it works as expected.

Screen+Shot+2012-11-15+at+9.57.38+AM.png

Thanks for for pointing it out.

Werner_E
24-Ruby V
(To:jkucan)

Jakov Kucan schrieb:

The error looks like a bug. I will report it to dev. If you delete division by SIUnitsOf (which is not necessary anyways) it works as expected.

Yes, looks like a bug. But why do I see the correct evaluation when I open Simon's worksheet the first time? As I just tried out it has nothing to do with the language.

@Simon: Which version of Mathcad Prime did you use? 2.0 I guess, but is it F001 or M010?

WE

When you open a worksheet, it does _not_ recalculate. So, you see what was last calculated. This might be soething that is different in the two different verisons of the product.

Werner_E
24-Ruby V
(To:jkucan)

Jakov Kucan schrieb:

When you open a worksheet, it does _not_ recalculate. So, you see what was last calculated.

This might be soething that is different in the two different verisons of the product.

That was my point. It could be that the bug was introduced with Prime 2 M010 and was not present in F001.

When I look at Simon's file (docProps\app.xml) I see that "appVersion" and "serializationVersion" are 2.0.0.0. When I save the file with Prime2 M010, I get 2.0.1.0 for both. Does this mean that Simon uses F001?

WE

Just for the records: The bug is fixed in Prime3 - inline eval works OK as it was in Prime1.

Top Tags