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

Community Tip - Want the oppurtunity to discuss enhancements to PTC products? Join a working group! X

Magnitude of a Simple Vector

hhamm
1-Newbie

Magnitude of a Simple Vector

I defined a simple symbolic vector (sin(a), cos(a),0) yet it does not simplify to 1 when I take the magnitude, as it should. I might be doing something wrong but I can't figure it out
18 REPLIES 18

I'm guessing that it has something to do with the way the symbolic processor handles the solution. As you can see, a straightforward symbolic calculation yields 1 for the answer, but the equivalent using || does not.

Rich
http://www.downeastengineering.com/

Actually, that should not simplify to 1 unless α is real. But there is a problem in that even assuming α=real does not result in proper simplification.

It works correctly in MC11, simplifying based on the assumption of α=real. But MC14 has a general failure in that it does not remove the superfluous absolute value from |x|2 when x is known to be real. There are a number of issues with the MC14 symbolic processor.
__________________
� � � � Tom Gutman

A bit more complicated than that. It seems that that simplification can be done in isolation, but fails in context.
__________________
� � � � Tom Gutman

Thanks for the reply. I wasn't aware that I had to explicitly tell MC alpha was real.



Regards
hhamm
1-Newbie
(To:hhamm)

I got a response from MathCAD developement. You have to specify "simplify, max"

Why???? i have no clue.
RichardJ
19-Tanzanite
(To:hhamm)

From the help:

"To increase the number of steps performed by the simplification algorithm, type a comma after "simplify" and add the modifier "max." In some cases, this returns a simpler result than does "simplify" by itself."

So it's a barely documented modifier that doesn't appear on the modifiers toolbar. I wasn't even aware it existed.

Richard
hhamm
1-Newbie
(To:hhamm)

I talked to MathCAD developement team again...they said this is an error and should simplify and they are hoping to have it fixed by the next release.

Regards,

HH

Yep -- in MC14 adding max does get the desired simplification. Applies to all the cases in my example sheet.

But in MC11 adding the max keyword prevents the simplification that would otherwise occur.

Looks like simp accepts modifiers of min, max, and trig (and possibly others). Meaning what???
__________________
� � � � Tom Gutman
ELSID
4-Participant
(To:TomGutman)

Really? Check out my screenshot from version 14 M030. I am not using M035 due to memory bug.
RichardJ
19-Tanzanite
(To:ELSID)

You still need to assume alpha is real.

Richard

On 11/9/2009 2:28:31 PM, ElSid wrote:
>Really? Check out my
>screenshot from version 14
>M030. I am not using M035 due
>to memory bug.
_______________________________

Nothing to check, really.
This vector sum is probably native-unique,
a well as the symbolic result = 1

jmG


RichardJ
19-Tanzanite
(To:TomGutman)

On 11/9/2009 2:15:59 PM, Tom_Gutman wrote:

>Looks like simp accepts
>modifiers of min, max, and
>trig (and possibly others).
>Meaning what???

I also discovered the undocumented "min" modifier. Given what "max" does, I would guess "min" reduces the number of steps taken by the symbolic processor, producing a less simplified result. The "trig" modifier doesn't seem to be documented either, but I would guess it forces the result in the form of trig functions?

Another interesting modifier that simplify accepts is "raw". This is what the help says about raw: "Return results in unsimplified form." 🙂 In practice, it appears to be ignored when used with simplify.

Richard

RichardJ
19-Tanzanite
(To:RichardJ)

On 11/9/2009 2:42:09 PM, rijackson wrote:
>On 11/9/2009 2:15:59 PM, Tom_Gutman
>wrote:
>
>>Looks like simp accepts
>>modifiers of min, max, and
>>trig (and possibly others).
>>Meaning what???
>
>I also discovered the undocumented "min"
>modifier. Given what "max" does, I would
>guess "min" reduces the number of steps
>taken by the symbolic processor,
>producing a less simplified result. The
>"trig" modifier doesn't seem to be
>documented either, but I would guess it
>forces the result in the form of trig
>functions?

Interesting. It would be more useful if it were supported. In the past, unsupported functions, keywords, etc, have been deprecated, breaking worksheets.

Richard

On 11/9/2009 2:15:59 PM, Tom_Gutman wrote:

>Looks like simp accepts modifiers of min, max, and trig (and possibly others). Meaning what???

MuPad have two simp routines: low case simplify, and upper case Simplify. Second is more efficient. Syntax for the lower case it's basically:

Calls:
simplify(f,target )
Simplify(f,Steps = n )

Parameters:
f: an arithmetical expression
target: one of the identifiers cos, sin, exp, ln, sqrt, unit, (logic, condition, or relation)

unit was introduced at version 3.2 and condition in 4.0. I don't remember which version it's mathcad's kernel.

simplify(f, target) restricts the simplification to term rewriting rules applicable to the target functions.

Example:
f := sin(x)^2 + cos(x)^2 + (exp(x) - 1)/(exp(x/2) + 1):
Try: simplify(f)

Only special simplifications occur if special target functions are specified:

Try: simplify(f, sin)
Try: simplify(f, exp)

Example:
x := 1/2 + sqrt(23/108):
y := x^(1/3) + 1/3/x^(1/3):
z := y^3 - y
Try: simplify(z) and simplify(z,sqrt) (must to return 1 if all things works well).

But the options max, min as 'target' I don't know why these particular names. Also, don't know an option like simplify(f, symbolic) like maple (or the option Analytic in Mathematica).

Regards. Alvaro.

Your original sin(a), cos(a) does not have much use, unless one has not plotted the functions and forgotten elementary trig. Try the same symbolic command with sin(a), erf(a) and check against the numerically valued functions or the quick plot. The vector sum of 'n' functions is simply their sum. That "simplify,max" looks like some left over trig work before a coffee break, never resumed and now pending a symbolic and documentation fix.

jmG

On 11/4/2009 6:51:31 PM, hhamm wrote:
>I defined a simple symbolic
>vector (sin(a), cos(a),0) yet
>it does not simplify to 1 when
>I take the magnitude, as it
>should. I might be doing
>something wrong but I can't
>figure it out
_______________________________

Read what I wrote today and exercise +.
Try something that makes sense.
The magnitude of a numerical vector is not the same than the sum of functions. The magnitude of a numerical vector is single number. The magnitude of a vector of functions is simply the sum of the components over the range as adequately evaluated, i.e: a data set ... a vector of values.
...............................
...............................

"To increase the number of steps performed by the simplification algorithm, type a comma after "simplify" and add the modifier "max." In some cases, this returns a simpler result than does "simplify" by itself."

>I talked to MathCAD development team again...they said this is an error and should simplify and they are hoping to have it fixed by the next release. [[HH]<<br> ===================================
On 11/9/2009 2:15:59 PM, Tom_Gutman wrote:
...
>Looks like simp accepts
>modifiers of min, max, and
>trig (and possibly others).
>Meaning what???
>__________________
> Tom Gutman
==================================

"Doing what": that is the question ?

==> maybe doing what it should but otherwise than "jargoned" in the above doc !
==> read again
"To increase the number of steps performed by the simplification algorithm, type a comma after "simplify" and add the modifier "max." In some cases, this returns a simpler result than does "simplify" by itself."
==> min/max ... my interpretation is "plot each within their respective domain"
==> i.e:: apply the maths as required.
==> for some simplist it might have meant "mim/max" domain of respective existence.

Maybe just to accommodate the quickplot if the same as previous versions. Hope PTC designers will understand themselves between the doc and the product.

jmG

Seems like that mupad Simplify(expr,Steps = n) can be called with max, min. But this is only mathcad dialect.

I have not mathcad 14, and have not also documentation avaible, which isn't the same to not have the product. It's amazing the sources to learn about mathcad:

http://www.mathworks.com/access/helpdesk/help/toolbox/mupad/stdlib/simplify.html

My matlab it's old and have not mupad.

Regards. Alvaro.

"simplify" is a popular word but not a mathematical word. In maths we collect, factor expand ... Often, it is possible to "recast" expressions containing elementary functions in terms of other elementary functions, mostly: trig, ln, exp, sqrt. Even an expression like a0 + a1x + a2x� + a3x� ... is totally incorrect. What CAS can't do is "recast" a formula into an "equivalent" form. Several examples were treated in this collab. The matter of an equivalent vs another equivalent concerns the designer: numerical stability, execution times, how the preference goes for the related arguments & parameters, but especially for a formula to be plugged in RPN [Reverse Polish Notation]. The Matlab/MuPad web sheet does nothing useful for Engineers. Through my 10 years Mathcad & Mathematica 4.0, occasionally Mathematica will have a preferred "recast", but Mathcad/Maple beats them all.

Attached, 5 of the most demonstrative equivalent/recast. What's interesting from the Matlab/MuPad web is the documentation about attempting to recast the solution form solvers, but it does not even branch the reader about the possible source of their example. It should say: "here are some examples from the books you didn't read", or more wisely: "here are some examples from solvers".

Another good example is the solar cell Eq1. done several times this summer.

jmG
Top Tags