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
- :
- Assignment breaks solve (Mathcad 15.0)

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

08-05-2020
08:13 AM

08-05-2020
08:13 AM

I repeatedly encounter the following problem: When I use 'solve' to solve an equation or a system of equations, it works fine as long as I don't try to assign the result (see minimal example below and in the attachment), which is quite essential. It just starts to complain with 'This variable is undefined' but does not even mark any single variable.

- swapping the working and not working solve around does not change anything

- giving the output variables different names does not help

P.S.: This must have been answered somewhere. I did find some similar posts but none helped me.

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

08-05-2020
09:18 AM

08-05-2020
09:18 AM

This is a fairly known effect and the symbolic still works OK. *[EDIT: No, it doesn't. Look at the auxiliary variables X58 and E1491 which show up and cause the numeric error message]*

Its simply the numeric engine throwing the error because of the assignment to variables.

The variables get a [*EDIT: unusable]* symbolic result anyway and you may display and use them after the calculation as desired.

A strange side effect is that if you move the region with your mouse (left mouse button pressed down) the symbolic result is shown (but only until you recalculate the sheet).

P.S.: When showing picture belonging to a question about symbolic evaluation its better not to show the evaluation as equal sign as it might be confused with numeric evaluation.

BTW, you wrote *"it works fine as long as I don't try to assign the result".* Did you really expected variables X1, E13 or X58 and E1491 in the result? 🙂

Mathcads symbolic engine unfortunately does not know anything about units and so A and V are treated as unknown variables (which may be negative or even not real). So given those unknowns, the expression seems to hard for muPad to solve and it shows some auxiliary variables in the result. I don't know what exactly is happening here but it seems to be caused by the conflict between forced to float mode (because of the float numbers provided) and the aim to solve as exact as possible using the ln. As Alan shows muPad sure is capable to solve the equation with variables only (no numeric values provided) and you showed in your second post that muPad is able to solve the equation if only numeric values are provided (even the Euler number).

As you are just looking for a numeric result, why not just use a numeric method like a solve block?

10 REPLIES 10

Highlighted
##

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

08-05-2020
08:43 AM

08-05-2020
08:43 AM

Re: Assignment breaks solve (Mathcad 15.0)

Ok, more weird stuff is coming:

when I replace 'e' with the value of e, suddenly the solve with assignment works (and also the other result provides a human-readable form, but that's probably just a side effect).

I placed a print for 'e' in there as a proof that it is defined correctly.

Highlighted
##

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

08-05-2020
09:40 AM

08-05-2020
09:40 AM

Re: Assignment breaks solve (Mathcad 15.0)

@MichalPribil wrote:

Ok, more weird stuff is coming:

when I replace 'e' with the value of e, suddenly the solve with assignment works (and also the other result provides a human-readable form, but that's probably just a side effect).

I placed a print for 'e' in there as a proof that it is defined correctly.

Thats indeed strange. Obviously muPad tries to solve exact (and fails) using ln if you use the built in constant e but switches to float mode from start when a numeric approximation of e is used.

Nonetheless I'd vote for using a solve block as shown in my first answer (which is shown below(!)).

Highlighted
##

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

08-05-2020
11:00 AM

08-05-2020
11:00 AM

Re: Assignment breaks solve (Mathcad 15.0)

I'm getting this problem inconsistently also with the solve block.

However, I can use e when I redefine it, it's probably not what should be done, but it is a solution for me:

Highlighted

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

08-05-2020
09:18 AM

08-05-2020
09:18 AM

This is a fairly known effect and the symbolic still works OK. *[EDIT: No, it doesn't. Look at the auxiliary variables X58 and E1491 which show up and cause the numeric error message]*

Its simply the numeric engine throwing the error because of the assignment to variables.

The variables get a [*EDIT: unusable]* symbolic result anyway and you may display and use them after the calculation as desired.

A strange side effect is that if you move the region with your mouse (left mouse button pressed down) the symbolic result is shown (but only until you recalculate the sheet).

P.S.: When showing picture belonging to a question about symbolic evaluation its better not to show the evaluation as equal sign as it might be confused with numeric evaluation.

BTW, you wrote *"it works fine as long as I don't try to assign the result".* Did you really expected variables X1, E13 or X58 and E1491 in the result? 🙂

Mathcads symbolic engine unfortunately does not know anything about units and so A and V are treated as unknown variables (which may be negative or even not real). So given those unknowns, the expression seems to hard for muPad to solve and it shows some auxiliary variables in the result. I don't know what exactly is happening here but it seems to be caused by the conflict between forced to float mode (because of the float numbers provided) and the aim to solve as exact as possible using the ln. As Alan shows muPad sure is capable to solve the equation with variables only (no numeric values provided) and you showed in your second post that muPad is able to solve the equation if only numeric values are provided (even the Euler number).

As you are just looking for a numeric result, why not just use a numeric method like a solve block?

Highlighted
##

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

08-05-2020
11:04 AM

08-05-2020
11:04 AM

Re: Assignment breaks solve (Mathcad 15.0)

"Did you really expected variables X1, E13 or X58 and E1491 in the result?"

I naively thought that if I manage to get it assigned to a variable and print the variable out, those variables would just magically get some desirable value.

I agree that solve block is probably the best way for me to do my calculations. I learned about it just recently and I would have been using if I knew it existed.

Thank you very much once again for your fast response!

Highlighted
##

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

08-05-2020
11:17 AM

08-05-2020
11:17 AM

Re: Assignment breaks solve (Mathcad 15.0)

@MichalPribil wrote:

"Did you really expected variables X1, E13 or X58 and E1491 in the result?"

I naively thought that if I manage to get it assigned to a variable and print the variable out, those variables would just magically get some desirable value.

I agree that solve block is probably the best way for me to do my calculations. I learned about it just recently and I would have been using if I knew it existed.

Thank you very much once again for your fast response!

At first glance I didn't notice those silly auxiliary variables which were thrown out by the symbolics (so I edited my first answer slightly to draw attention to it). Its really very strange that the mixture of float variables and "exact" Euler number messes up the symbolic calculation so much.

Highlighted
##

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

08-05-2020
09:26 AM

08-05-2020
09:26 AM

Re: Assignment breaks solve (Mathcad 15.0)

Looks better to me if you do it this way:

Alan

Highlighted
##

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

08-05-2020
09:31 AM

08-05-2020
09:31 AM

Re: Assignment breaks solve (Mathcad 15.0)

Or like this if you want to keep the Ks as functions:

Alan

Highlighted
##

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

08-05-2020
10:22 AM

08-05-2020
10:22 AM

Re: Assignment breaks solve (Mathcad 15.0)

I would do so:

Highlighted
##

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

08-05-2020
10:59 AM

08-05-2020
10:59 AM

Re: Assignment breaks solve (Mathcad 15.0)

Thats similiar to Alan's approach (he turned the calc into a function for later use).

Its interesting that the symbolic is able to solve with all variables and also with all numeric values (even Euler number). But it does not work OK with numeric values for most variables but the "exact" Euler number.

Its interesting that is suffices to make any one of the two voltages variable for the symbolics to get a reasonable result:

As soon as we delete the assignment V.2 := V.2 the symbolic solve comes up with its auxiliary variables X... and E... which the numerics don't known and therefore throws the error. Its somewhat strange.