Hello,
Thank you all for responding. I still have a question regarding numerical evaluation. This is part of a longer symbolic expressions which I am satisfied with. I am not just trying to evaluate dot product (which in the case of symbolic expression can be verified to show that dot product is zero-as shown in the input). When I remove
keepfloat:true I get very large numbers with exponents 10^. I am computing my symbolic expressions for some particular cases. Am I losing precision when I see these large numbers due to ratsubst . My numbers seems to be very manageable from numerical point of view. Can I trust Maxima for numerical evaluations to back up my symbolic expresions? Thank you.
Ram
/** A sample input **/
v1:[1,-(sqrt(4*t^2+q^2-2*p*q+p^2)-q+p)/(2*t),0];
v2:[1,(sqrt(4*t^2+q^2-2*p*q+p^2)+q-p)/(2*t),0];
radcan(v1.v2);
p:192.6988*sin(th)^2+4.9619*cos(th)^2;
q:4.9619*sin(th)^2+8.0665*cos(th)^2;
r:4.9619*sin(th)^2+2.4489*cos(th)^2;
t:-7.69*cos(th)*sin(th);
v11:ratsubst(1-sin(th)^2,cos(th)^2,ev(v1));
v22:ratsubst(1-sin(th)^2,cos(th)^2,ev(v2));
ratsubst(%pi/3,th,[v1,v2,v1.v2]);
ratsubst(%pi/3,th,[v11,v22,v11.v22]);
sol2:[[1,-(sqrt(4*t^2+q^2-2*p*q+p^2)-q+p)/(2*t),0],
[-1,-(sqrt(4*t^2+q^2-2*p*q+p^2)+q-p)/(2*t),0]];
print("dot product of 2 vect in sol2");
radcan(sol2[1].sol2[2]);
p:192.6988*sin(th)^2+4.9619*cos(th)^2$
q:4.9619*sin(th)^2+8.0665*cos(th)^2$
r:4.9619*sin(th)^2+2.4489*cos(th)^2$
t:-7.69*cos(th)*sin(th)$
dd:ev(sol2[1].sol2[2]);
radcan(dd);
ratsubst(%pi/3,th,dd);
ratsubst(%pi/3,th,ev(sol2[1].sol2[2]));
/** sample output of the same input with keepfloat:true replaced by false **/
(%o1) [1,(-sqrt(4*t^2+q^2-2*p*q+p^2)+q-p)/(2*t),0](%o2) [1,(sqrt(4*t^2+q^2-2*p*q+p^2)+q-p)/(2*t),0](%o3) 0(%o4) 192.6988*sin(th)^2+4.9619*cos(th)^2(%o5) 4.9619*sin(th)^2+8.0665*cos(th)^2(%o6) 4.9619*sin(th)^2+2.4489*cos(th)^2(%o7) -7.69*cos(th)*sin(th)`rat' replaced 236.5444 by 61265/259 = 236.5444015444016`rat' replaced 8.0665 by 16133/2000 = 8.0665`rat' replaced 4.9619 by 10028/2021 = 4.961900049480455`rat' replaced 8.0665 by 16133/2000 = 8.0665`rat' replaced 4.9619 by 10028/2021 = 4.961900049480455`rat' replaced 4.9619 by 10028/2021 = 4.961900049480455`rat' replaced 192.6988 by 465753/2417 = 192.6988001654944`rat' replaced 4.9619 by 10028/2021 = 4.961900049480455`rat' replaced 192.6988 by 465753/2417 = 192.6988001654944`rat' replaced -0.06501950585176 by -50/769 = -0.06501950585176`rat' replaced 3.1046 by 15523/5000 = 3.1046`rat' replaced -187.7369 by -168400/897 = -187.736900780379(%o8) [1,(4485000*sqrt(894461110061138312575262099*sin(th)^4-23445005283459250158832198*sin(th)^2+
238263202973718267570099)+8361962780742334000*sqrt(259)*sin(th)^2-136031992742334000*sqrt(259))/(673894237060200000*sqrt(259)*cos(th)*sin(th)),0]`rat' replaced 236.5444 by 61265/259 = 236.5444015444016`rat' replaced 8.0665 by 16133/2000 = 8.0665`rat' replaced 4.9619 by 10028/2021 = 4.961900049480455`rat' replaced 8.0665 by 16133/2000 = 8.0665`rat' replaced 4.9619 by 10028/2021 = 4.961900049480455`rat' replaced 4.9619 by 10028/2021 = 4.961900049480455`rat' replaced 192.6988 by 465753/2417 = 192.6988001654944`rat' replaced 4.9619 by 10028/2021 = 4.961900049480455`rat' replaced 192.6988 by 465753/2417 = 192.6988001654944`rat' replaced -0.06501950585176 by -50/769 = -0.06501950585176`rat' replaced 3.1046 by 15523/5000 = 3.1046`rat' replaced -187.7369 by -168400/897 = -187.736900780379(%o9) [1,-(4485000*sqrt(894461110061138312575262099*sin(th)^4-23445005283459250158832198*sin(th)^2+238263202973718267570099)-8361962780742334000*sqrt(259)*sin(th)^2+136031992742334000*sqrt(259))/(673894237
060200000*sqrt(259)*cos(th)*sin(th)),0](%o10) [[1,-(sqrt(4*t^2+q^2-2*p*q+p^2)-q+p)/(2*t),0],[1,(sqrt(4*t^2+q^2-2*p*q+p^2)+q-p)/(2*t),0],0](%o11) [[1,(17940*sqrt(7772622138396313303552494099)+98167041485030664*sqrt(259))/(2695576948240800*sqrt(3)*sqrt(259)),0],[1,-(17940*sqrt(7772622138396313303552494099)-98167041485030664*sqrt(259))/(2695576948240800*sqrt(3)*sqrt(259)),0],40012173780069024051197027/13068951296713755566761314040000](%o12) [[1,-(0.065019505851756*(-sqrt((192.6988*sin(th)^2+4.9619*cos(th)^2)^2-2*(4.9619*sin(th)^2+8.0665*cos(th)^2)*(192.6988*sin(th)^2+4.9619*cos(th)^2)+(4.9619*sin(th)^2+8.0665*cos(th)^2)^2+236.5444*cos(th)^2*sin(th)^2)-187.7369*sin(th)^2+3.1046*cos(th)^2))/(cos(th)*sin(th)),0],[-1,-(0.065019505851756*(-sqrt((192.6988*sin(th)^2+4.9619*cos(th)^2)^2-2*(4.9619*sin(th)^2+8.0665*cos(th)^2)*(192.6988*sin(th)^2+4.9619*cos(th)^2)+(4.9619*sin(th)^2+8.0665*cos(th)^2)^2+236.5444*cos(th)^2*sin(th)^2)+187.7369*sin(th)^2-3.1046*cos(th)^2))/(cos(th)*sin(th)),0]]dot pr
oduct of 2 vect in sol2 (%o13) dot product of 2 vect in sol2`rat' replaced 236.5444 by 61265/259 = 236.5444015444016`rat' replaced 8.0665 by 16133/2000 = 8.0665`rat' replaced 4.9619 by 10028/2021 = 4.961900049480455`rat' replaced 8.0665 by 16133/2000 = 8.0665`rat' replaced 4.9619 by 10028/2021 = 4.961900049480455`rat' replaced 4.9619 by 10028/2021 = 4.961900049480455`rat' replaced 192.6988 by 465753/2417 = 192.6988001654944`rat' replaced 4.9619 by 10028/2021 = 4.961900049480455`rat' replaced 192.6988 by 465753/2417 = 192.6988001654944`rat' replaced 0.0042275361412065 by 259/61265 = 0.0042275361136048`rat' replaced 3.1046 by 15523/5000 = 3.1046`rat' replaced -187.7369 by -168400/897 = -187.736900780379`rat' replaced -3.1046 by -15523/5000 = -3.1046`rat' replaced 187.7369 by 168400/897 = 187.7369007803791(%o14) -(124038645614161686100000000*sin(th)^4-11289350153068005045300000*cos(th)^2*sin(th)^2+152770644164093639139729*cos(th)^4)/(117620562438370016951386500000000*cos(th)^2*sin(th)
^2)(%o19) (0.0042275361412065*(-sqrt((192.6988*sin(th)^2+4.9619*cos(th)^2)^2-2*(4.9619*sin(th)^2+8.0665*cos(th)^2)*(192.6988*sin(th)^2+4.9619*cos(th)^2)+(4.9619*sin(th)^2+8.0665*cos(th)^2)^2+236.5444*cos(th)^2*sin(th)^2)-187.7369*sin(th)^2+3.1046*cos(th)^2)*(-sqrt((192.6988*sin(th)^2+4.9619*cos(th)^2)^2-2*(4.9619*sin(th)^2+8.0665*cos(th)^2)*(192.6988*sin(th)^2+4.9619*cos(th)^2)+(4.9619*sin(th)^2+8.0665*cos(th)^2)^2+236.5444*cos(th)^2*sin(th)^2)+187.7369*sin(th)^2-3.1046*cos(th)^2))/(cos(th)^2*sin(th)^2)-1`rat' replaced 236.5444 by 61265/259 = 236.5444015444016`rat' replaced 8.0665 by 16133/2000 = 8.0665`rat' replaced 4.9619 by 10028/2021 = 4.961900049480455`rat' replaced 8.0665 by 16133/2000 = 8.0665`rat' replaced 4.9619 by 10028/2021 = 4.961900049480455`rat' replaced 4.9619 by 10028/2021 = 4.961900049480455`rat' replaced 192.6988 by 465753/2417 = 192.6988001654944`rat' replaced 4.9619 by 10028/2021 = 4.961900049480455`rat' replaced 192.6988 by 465753/2417 = 192.6988001654944`rat'
replaced 0.0042275361412065 by 259/61265 = 0.0042275361136048`rat' replaced 3.1046 by 15523/5000 = 3.1046`rat' replaced -187.7369 by -168400/897 = -187.736900780379`rat' replaced -3.1046 by -15523/5000 = -3.1046`rat' replaced 187.7369 by 168400/897 = 187.7369007803791(%o20) -(124038645614161686100000000*sin(th)^4-11289350153068005045300000*cos(th)^2*sin(th)^2+152770644164093639139729*cos(th)^4)/(117620562438370016951386500000000*cos(th)^2*sin(th)^2)`rat' replaced 236.5444 by 61265/259 = 236.5444015444016`rat' replaced 8.0665 by 16133/2000 = 8.0665`rat' replaced 4.9619 by 10028/2021 = 4.961900049480455`rat' replaced 8.0665 by 16133/2000 = 8.0665`rat' replaced 4.9619 by 10028/2021 = 4.961900049480455`rat' replaced 4.9619 by 10028/2021 = 4.961900049480455`rat' replaced 192.6988 by 465753/2417 = 192.6988001654944`rat' replaced 4.9619 by 10028/2021 = 4.961900049480455`rat' replaced 192.6988 by 465753/2417 = 192.6988001654944`rat' replaced 0.0042275361412065 by 259/61265 = 0.004227536113
6048`rat' replaced 3.1046 by 15523/5000 = 3.1046`rat' replaced -187.7369 by -168400/897 = -187.736900780379`rat' replaced -3.1046 by -15523/5000 = -3.1046`rat' replaced 187.7369 by 168400/897 = 187.7369007803791(%o21) -40097501137496861237157027/13068951382041112994598500000000`rat' replaced 236.5444 by 61265/259 = 236.5444015444016`rat' replaced 8.0665 by 16133/2000 = 8.0665`rat' replaced 4.9619 by 10028/2021 = 4.961900049480455`rat' replaced 8.0665 by 16133/2000 = 8.0665`rat' replaced 4.9619 by 10028/2021 = 4.961900049480455`rat' replaced 4.9619 by 10028/2021 = 4.961900049480455`rat' replaced 192.6988 by 465753/2417 = 192.6988001654944`rat' replaced 4.9619 by 10028/2021 = 4.961900049480455`rat' replaced 192.6988 by 465753/2417 = 192.6988001654944`rat' replaced 0.0042275361412065 by 259/61265 = 0.0042275361136048`rat' replaced 3.1046 by 15523/5000 = 3.1046`rat' replaced -187.7369 by -168400/897 = -187.736900780379`rat' replaced -3.1046 by -15523/5000 = -3.1046`rat' replaced 187.73
69 by 168400/897 = 187.7369007803791(%o22) -40097501137496861237157027/13068951382041112994598500000000
-------------- Original message ----------------------
From: maxima-request at math.utexas.edu
> Send Maxima mailing list submissions to
> maxima at math.utexas.edu
>
> To subscribe or unsubscribe via the World Wide Web, visit
> http://www.math.utexas.edu/mailman/listinfo/maxima
> or, via email, send a message with subject or body 'help' to
> maxima-request at math.utexas.edu
>
> You can reach the person managing the list at
> maxima-owner at math.utexas.edu
>
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of Maxima digest..."
>
>
> Today's Topics:
>
> 1. Numerical problem (amli at comcast.net)
> 2. Re: About Maxima and MS-DOS ( Jordi Guti?rrez Hermoso )
> 3. Re: Numerical problem (Harald Geyer)
> 4. Re: Numerical problem (Barton Willis)
>
>
> ----------------------------------------------------------------------
>
> Message: 1
> Date: Wed, 12 Sep 2007 21:41:42 +0000
> From: amli at comcast.net
> Subject: Numerical problem
> To: maxima at math.utexas.edu
> Message-ID:
>
> <091220072141.21977.46E85D160002C1FD000055D922070209530704030E at comcast.net>
>
>
> Hello,
> I am having some problem with computing a dot products. It is
> probably something simple that I am not seeing it. Some of the lines are
> redundant but I am keeping it because the problem shows up. The dot product
> is supposed to be zero but I get different number (last line). Thank you.
>
>
> wxMaxima 0.7.3a http://wxmaxima.sourceforge.netMaxima 5.13.0
> http://maxima.sourceforge.netUsing Lisp GNU Common Lisp (GCL) GCL 2.6.8 (aka
> GCL)Distributed under the GNU Public License. See the file COPYING.Dedicated to
> the memory of William Schelter.This is a development version of Maxima. The
> function bug_report()provides bug reporting information.
>
>
>
> Here is the code
> /**
> --------------------------------------------------------------------------------
> ---------------------------------- **/
>
> keepfloat:true;
> sol2:[[1,-(sqrt(4*t^2+q^2-2*p*q+p^2)-q+p)/(2*t),0],
> [-1,-(sqrt(4*t^2+q^2-2*p*q+p^2)+q-p)/(2*t),0]];
>
> print("dot product of 2 vect in sol2");
> radcan(sol2[1].sol2[2]);
>
>
>
> print("make trig substitution")$
> EA2:ratsubst(1.0-sin(th)^2,cos(th)^2,ev(sol2));
>
>
> v1:EA2[1]$
> v2:-EA2[2]$
>
>
> p:192.6988*sin(th)^2+4.9619*cos(th)^2$
> q:4.9619*sin(th)^2+8.0665*cos(th)^2$
> r:4.9619*sin(th)^2+2.4489*cos(th)^2$
> t:-7.69*cos(th)*sin(th)$
>
> radcan(ev(v1.v2));
> ratsubst(%pi/3,th,ev([v1.v2]));
>
>
> /** Output
> **************************************************************************/
>
> (%o1) true(%o2)
> [[1,(-sqrt(4*t^2+q^2-2*p*q+p^2)+q-p)/(2*t),0],[-1,(-sqrt(4*t^2+q^2-2*p*q+p^2)-q+
> p)/(2*t),0]]dot product of 2 vect in sol2 (%o3) dot product of 2 vect in
> sol2(%o4) 0make trig substitution (%o6)
> [[1,-(sqrt(4*t^2+q^2-2*p*q+p^2)-q+p)/(2*t),0],[-1,-(sqrt(4*t^2+q^2-2*p*q+p^2)+q-
> p)/(2*t),0]](%o13) 0(%o14) [-6646.288740236717]
>
>
>
>
> Ram
>
>