saving . . . saved entering fraction has been deleted. entering fraction has been hidden .
entering fraction
Title
Question
sir, while doing the second exercise, I encountered a problem in \r\nprinting the fractions. while entering the elements of the matrix I \r\nentered the fractions but got the results as decimals.
I want to get the fractions as output. please guide me in the same.

Scilab Vector-Operations 05-06 min 40-50 sec 30-04-16, 11:41 a.m. AMBIKAPRASAD

Answers:

You will have to use the rat function. Examples are given below
n- numerator, d- denominator

[n,d]=rat(2/3)
d  =
 
    3. 
 n  =
 
    2. 
-->a=[1/2;4/5;6/7]
 a  =
 
    0.5       
    0.8       
    0.8571429 
 
-->[n,d]=rat(a)
 d  =
 
    2. 
    5. 
    7. 
 n  =
 
    1. 
    4. 
    6. 
->[n,d]=rat(0.1/5)
 d  =m
 
    50. 
 n  =
 
    1. 

If you want to display the output strictly in the form numerator/denominator (with the division symbol), then you would have to install the Symbolic toolbox.


30-04-16, 1:09 p.m. smohanan
Sir following error I got for Exercise 2

-> A*C-C*A

Inconsistent row/column dimensions.

--> 2*C-6*A

Inconsistent row/column dimensions.

--> (2*C-^*A')*B'
(2*C-^*A')*B'
     ^^
Error: syntax error, unexpected ** or ^

--> (2*C-6*A')*B'

Inconsistent row/column dimensions.

--> A'
 ans  =

   1.    0.3333333   0.2      
   0.5   0.25        0.1666667

--> B'
 ans  =

   5.
   2.

--> (2*C-6*A')*B'

Inconsistent row/column dimensions.

--> A
 A  = 

   1.          0.5      
   0.3333333   0.25     
   0.2         0.1666667

--> (2*C-6*A')*B'

Inconsistent row/column dimensions.

--> (2*C-6*A')*C

Inconsistent row/column dimensions.
20-04-20, 2:27 p.m. sujata_magdum

Login to add comment


Log-in to answer to this question.