Ramakrishnan

Dr. Ramakrishnan Vaidyanathan

279 Reputation

5 Badges

5 years, 54 days

Social Networks and Content at Maplesoft.com

I have retired as Professor-Mechanical in Sri Venkateswara College of Engineering and Technology under Anna University affiliated colleges in Tamil Nadu, India. I have 19 years of Industrial and 20 years of teaching experience. I am learning Maple for the past four and half years hoping to make at least one appreciable maple presentation.

MaplePrimes Activity


These are replies submitted by Ramakrishnan


 

restart

Digits := 15; print(["Sample", "tDiff", "tDiffPC"]); for i to 10 do t1PC := Now(ProcessClock); t1 := time[real](); for j to 1000 do j := j+1 end do; t2PC := Now(ProcessClock); t2 := time[real](); tDiff := t2-t1; tDiffPC := t2PC-t1PC; v := array([i, tDiff, tDiffPC]); print(v) end do

                 ["Sample", "tDiff", "tDiffPC"]
                      [1, 0.002, Unit(ns)]
                       [2, 0., Unit(ns)]
                      [3, 0.003, Unit(ns)]
                      [4, 0.002, Unit(ns)]
                       [5, 0., Unit(ns)]
                           [6, 0., 0]
                         [7, 0.003, 0]
                       [8, 0., Unit(ns)]
                      [9, 0.002, Unit(ns)]
                         [10, 0.001, 0]
 

(1)

``


 

Download PrecisionAccuracy.mw

@Carl Love 

I understand from your explanation that

The PC timings are more accurate to nanoseconds.

Precision (variation) is due to the processing of inbuilt applications currently running like security apps).

Excellent.

Thank you so much.

@acer 

Dear Sir, I found out the mistake. 
 

t1 := time[real]()

119.603

(1)

"for i = 1 to 1000  i:=i+1  end;"

t2 := time[real]()

119.644

(2)

``

t2-t1

0.41e-1

(3)

Now I again recall the stored time values. (unit: seconds). t1 and t2 are retained for ever until unassigned.

t1

119.603

(4)

``

t2

119.644

(5)

t2-t1

0.41e-1

(6)

``


 

Download timeToRun.mw

It is working fine. Thanks.

Ramakrishnan V

@acer the same t1 value will not be assigned afterwards.

@acer 

Thank you so much.

I tried and got it.

t1 := time[real]();
               "for i = 1 to 1000  i:=i+1  end;"
t2 := time[real]();
                          t2 := 99.705

But t1 is lost and i can not find the difference between t1 and t2.

Could you help me please?

Cheers.

Ramakrishnan
 

t1 := time[real]()

"for i = 1 to 1000  i:=i+1  end;"

t2 := time[real]()

99.705

(1)

t1

t1

(2)

t2

99.705

(3)

t1

t1

(4)

t2-t1

99.705-t1

(5)

t1 := time[real]()

373.384

(6)

``


 

Download timeToRun.mw

 

 

@acer 

Thank you very much. Here I want for only a = 1 and not for varying 'a' values.

Yours is useful for making animation for sinusoidal functions of the form

function = verticalShift + VerticalStretch(Trig.Fn(Frequency*x + HorizontalTranslation)

y = a sin(bx+c)+d

Thank toy so much.

Ramakrishnan V

@tomleslie 

Amazing. One command line added does the trick. 

Do(q = %MathContainer0);
  Do(p = eval(q));
  # Do(%Plot0 = plot(p, x = 0..2*Pi));
  Do(%Plot0 = plots:-animate(plot, [p, x =0..t], t=0..10));
  SetProperty("Plot0", ':-play', true, ':-refresh'=true);

I will try pause command also similarly to make the user use the same button to pause and play.

SetProperty("Plot0", ':-pause', true, ':-refresh'=true);

Thanks.

@Earl 

Thank you very much both of you involved in this conversation. I understood the importance of the Digits command and the accuracy of results. I added the command Digits:=15 and the results and plot tally. Thank you so much.

Download Int_Question_answer.mw
 

restart; with(plots); with(ScientificConstants); Digits := 15

15

(1)

g := GetValue(Constant(g))

9.80665

(2)

TP := proc (R, Vzero) sqrt((1/2)*R/g)*(int(1/sqrt(1+(1/2)*Vzero^2/(g*R)-cos(theta)), theta = 0 .. arccos(2/3+(1/3)*Vzero^2/(g*R)))) end proc

evalf(TP(3, 1.2*10^(-3)))

4.95088511960389

(3)

evalf(TP(3, 1.5*10^(-3)))

4.82746536424607

(4)

evalf(TP(3, 10^(-4)))

6.32528075210332

(5)

R := 3; plot(sqrt(R/(2*g))*(int(1/sqrt(1+Vzero^2/(2*g*R)-cos(theta)), theta = 0 .. arccos(2/3+Vzero^2/(3*g*R)))), Vzero = 10^(-4) .. 1.5*10^(-3))

 

TP(3, 0.2e-3); Vzero := 0.2e-3

5.94189995191646

 

0.2e-3

(6)

sqrt(R/(2*g))*(int(1/sqrt(1+Vzero^2/(2*g*R)-cos(theta)), theta = 0 .. arccos(2/3+Vzero^2/(3*g*R))))

Vzero := 0.4e-4

 

 

5.94189995191646

 

0.4e-4

(7)

sqrt(R/(2*g))*(int(1/sqrt(1+Vzero^2/(2*g*R)-cos(theta)), theta = 0 .. arccos(2/3+Vzero^2/(3*g*R))))

6.83209756585927

(8)

``


 

Download Int_Question_answer.mw

 

Ramakrishnan V

Thank you. Answer is clear now. Ramakrishnan.

@vv 

In line 5,  as shown below, it gives an error msg in doc mode. How do I rectify this?

v / sqrt(v^+ . v):
T := simplify(%)

Error, invalid power
Typesetting:-mambiguous(restartsemi  withApplyFunction(plots)colon  r Assign 

  (xApplyFunction(t)commafApplyFunction(xApplyFunction(t)))colon  v Assign diffApplyFunction

  (rcommat)colon  v sol sqrtApplyFunction(Typesetting:-mambiguous(

  vcirc + , Typesetting:-merror("invalid power")) period v)colon  T Assign simplifyApplyFunction

  (%)colon  N Assign ( uminus0T(2)comma T(1) )colon  F Assign (0

  commauminus0mastg)  +  nastN uminus0 muastnastTastsignumApplyF\

  unction(diffApplyFunction(xApplyFunction(t)commat))colon  mast

  diffApplyFunction(vcommat) equals;&tilde Fcolon  DE Assign 

  convertApplyFunction(%comma list)colon  solveApplyFunction(DE

  comma (diffApplyFunction(xApplyFunction(t)commatcommat)comma n)

  )colon  selectApplyFunction(hascomma %comma diffApplyFunction(x

  ApplyFunction(t)commatcommat))colon  de Assign %()colon   myde 

  Assign evalApplyFunction(decomma (f equals (x rarr xcirc2)comma

   mequals1comma gequals1comma muequals1sol10))colon  ic Assign x

  ApplyFunction(0)equals0comma DApplyFunction(x)ApplyFunction(0)

  equals1colon  dsol1 Assign dsolveApplyFunction((mydecomma ic)

  comma numericcomma outputequalslistprocedure)colon  ptAssignevalApplyFunction

  (tcomma dsol1)colon pxAssignevalApplyFunction(xApplyFunction(t)

  comma dsol1)colon  tmaxAssign13.55colon  parabAssignplotApplyF\

  unction((pxApplyFunction(t)commapxApplyFunction(t)circ2commat

  equals0period;&periodtmax)commacolorequalsblue)colon  animate

  ApplyFunction(plotcomma (((pxApplyFunction(t)commapx

  ApplyFunction(t)circ2))commastyleequalspointcommasymbolsize

  equals30)comma tequals0period;&periodtmaxcomma framesequals100

  comma backgroundequalsparab)semi)

@Joe Riel 

Dear Sir, Thanks for your procedure. It works outside, but when I take it inside textbox edit action, the string remains for one value and one gets converted. I am still working on it and hope to succeed calling the procedure from inside the textarea edit region. Cheers. Ramakrishnan V


 


NULL

NULL

NULL

NULL


 

Download I_gotNumericAnswerinTextArea.mw

 

@Carl Love 

Oh! It is an excellent one line command I used inside the edit changed textbox(0 and 1) content 's and it worked fine. I have not used the word macro (deleted the word macro) and it still works. Why the word macro is there? 

Thanks.

Regards.

RamakrishnanV

 

@Carl Love 

Thanks. Awaiting an example for procedure and module combination. Cheers. Ramki..

 

@Zeineb 

Dear Sir,

I give below the command obtained using explorer (it is a simple exercise in maple)

Explore(evalf(3/13+16/13*x), parameters = [[x = 0 .. 30, controller = slider]], loop = never, size = NoUserValue, numeric = false, echoexpression = true)

I also attach the document for your use.

Make the best use of it for any value of x 


                               x (30) = 483/13 = 37.15 for my data.


 


y := a*x+b; d := [[3, 4], [5, 6], [6, 8], [8, 10]]; c := CurveFitting[LeastSquares](d, x, curve = y); Printf(c)

Printf(3/13+(16/13)*x)

(1)

plot(c, x = 0 .. 10)

 

``

Explore(3/13+(16/13)*x, parameters = [[x = 0 .. 30, controller = slider]], loop = never, size = NoUserValue, numeric = false, echoexpression = true)

(2)

Explore(evalf(3/13+(16/13)*x), parameters = [[x = 0 .. 30, controller = slider]], loop = never, size = NoUserValue, numeric = false, echoexpression = true)

``

NULL

 

Download Fix_plot_stLineData.mw

 

Fix_plot_stLineData.mw


 

 

@Carl Love 

Thank you very much for the detailed clarification. This will be useful very much. Ramakrishnan.V

@Carl Love 

Thank you very much. It works fine both ways now radian to degree and degree to radian.

Why is the if in if statement inside single quotes.

Can we use if statement to assign before the set property statement?

I will be using a procedure outside the table, use 'if else' statement and try to achieve the same results. Hope I will get it..

radianToDegree.mw
 

NULL

``

``

 

``Degrees

``Radians

``

``

To verify 1800  = 6.28 radians

To verify 6.28 radians = 1800  

 

 

``


 

Download radianToDegree.mw

 

Thanks.

Ramakrishnan V 

1 2 3 4 5 6 7 Last Page 2 of 11