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

Community Tip - Need to share some code when posting a question or reply? Make sure to use the "Insert code sample" menu option. Learn more! X

Mathad prime problems with equation

D_man_123
2-Explorer

Mathad prime problems with equation

Hi.

I'm a new one here.

 

Maybe somebody knows where is the catch why the result is a matrix with [1x1] result (pic. in attachment).

 

Thank you in advance for your help.

 

Regards,

D

ACCEPTED SOLUTION

Accepted Solutions
Werner_E
25-Diamond I
(To:D_man_123)

Whenever you type a square bracket, Prime creates a matrix. You did so in the denomiinator and when you evaluate that expression you divide a scalar by a 1x1 matrix. This is mathematical nonsense and so Mathcad applies automatic vectorization. That way the result is a vector, too.

Solution: Type a normal, round, parenthesis or do completetly without as its not needed anyway.

 

As for you second picture you should take care to distinguish between ranges (as you used) and vectors. They may look similar or even alike, but they sure aren't.  You may have already noticed that you can't assign the result list of b0(t0) to a variable or access a single element of it.

The correct way to do it is to create t0 as vector. When fed into a function Prime may apply automatic vectorization but to be on the safe side  you should vectorize the function call yourself.

A range is just sort of an implicit loop and should be uses just for three things:

.) plotting

.) indexing vectors and matrices

.) for-loop in a program

 

View solution in original post

4 REPLIES 4
vlehner
14-Alexandrite
(To:D_man_123)

Hi,

 

maybe this helps you:

10-08-2017 10-45-42.jpg

Pleas see attached MathCad-File.

 

Volker
Werner_E
25-Diamond I
(To:D_man_123)

Whenever you type a square bracket, Prime creates a matrix. You did so in the denomiinator and when you evaluate that expression you divide a scalar by a 1x1 matrix. This is mathematical nonsense and so Mathcad applies automatic vectorization. That way the result is a vector, too.

Solution: Type a normal, round, parenthesis or do completetly without as its not needed anyway.

 

As for you second picture you should take care to distinguish between ranges (as you used) and vectors. They may look similar or even alike, but they sure aren't.  You may have already noticed that you can't assign the result list of b0(t0) to a variable or access a single element of it.

The correct way to do it is to create t0 as vector. When fed into a function Prime may apply automatic vectorization but to be on the safe side  you should vectorize the function call yourself.

A range is just sort of an implicit loop and should be uses just for three things:

.) plotting

.) indexing vectors and matrices

.) for-loop in a program

 

Thank you for explanation. It works now.

Werner_E
25-Diamond I
(To:Werner_E)

Here is in more detail what I was talking about.

The attached sheet also shows a few ways to create the neccessary vector

Bild.png

Announcements

Top Tags