Subject: how to show sin(30)=1/2, where 30 is a degree
From: 黃 裕雄
Date: Thu, 22 Oct 2009 20:36:36 +0800
1.how to show sin(30)=1/2, where 30 is a degree
we know if the angle is a radin then sin(30*%pi/180)=1/2,
where 30 is a degree , How to show sin(30)=1/2 in maxima ?
(%i4) deg:30;
(%o4) 30
(%i5) sin(deg);
(%o5) sin(30)
(%i6) rad:deg*%pi/180;
%pi
(%o6) ---
6
(%i7) sin(rad);
1
(%o7) -
2
(%i8) (sin(rad))^2+(cos(rad))^2;
(%o8) 1
(%i9) (sin(deg))^2+(cos(deg))^2;
2 2
(%o9) sin (30) + cos (30)
(%i10) (sin(x))^2+(cos(x))^2;
2 2
(%o10) sin (x) + cos (x)
2.how to show (sin(x))^2+(cos(x))^2=1 in maxima
3. if sin(x)+cos(x)=1/2, solve sin(x)*cos(x)=?
we know (sin(x))^2+(cos(x))^2=1 ,
so we have sin(x)*cos(x)=3/8.
Can it solve in maxima ?
(%i1) eq1:sin(x)-cos(x)=1/2;
(%i3) expand(eq1^2);
2 2 1
(%o3) sin (x) - 2 cos(x) sin(x) + cos (x) = -
4
> From: maxima-request at math.utexas.edu
> Subject: Maxima Digest, Vol 39, Issue 55
> To: maxima at math.utexas.edu
> Date: Wed, 21 Oct 2009 12:00:02 -0500
>
> 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. Re: LU Decomposition (Dotan Cohen)
> 2. Patch for discussion - integrating special functions
> (David Billinghurst)
> 3. show gradient vectors orthogonal to level curves (G. Jay Kerns)
>
>
> ----------------------------------------------------------------------
>
> Message: 1
> Date: Wed, 21 Oct 2009 10:46:10 +0200
> From: Dotan Cohen <dotancohen at gmail.com>
> Subject: Re: [Maxima] LU Decomposition
> To: Leo Butler <l.butler at ed.ac.uk>
> Cc: "maxima at math.utexas.edu" <maxima at math.utexas.edu>, Raymond Toy
> <raymond.toy at stericsson.com>
> Message-ID:
> <880dece00910210146q1453768dnb31a63a1baa651cf at mail.gmail.com>
> Content-Type: text/plain; charset=UTF-8
>
> I see, thanks! Here, I finally got it:
>
> (%i19) M:matrix([1,2],[3,4]);
> [ 1 2 ]
> (%o19) [ ]
> [ 3 4 ]
> (%i20) get_lu_factors( lu_factor(M) );
> [ 1 0 ] [ 1 0 ] [ 1 2 ]
> (%o20) [[ ], [ ], [ ]]
> [ 0 1 ] [ 3 1 ] [ 0 - 2 ]
> (%i21)
>
>
> --
> Dotan Cohen
>
> http://what-is-what.com
> http://gibberish.co.il
>
>
> ------------------------------
>
> Message: 2
> Date: Wed, 21 Oct 2009 22:17:41 +1100
> From: David Billinghurst <dbmaxima at gmail.com>
> Subject: Patch for discussion - integrating special functions
> To: maxima at math.utexas.edu
> Message-ID: <4ADEEDD5.1040701 at gmail.com>
> Content-Type: text/plain; charset=ISO-8859-1; format=flowed
>
> I have been looking at the code for integrating special functions in
> sin.lisp. This patch is posted for discussion. Of course, I think it
> improves the clarity of the code, but I don't want to make unnecessary
> changes without discussion.
>
> The main change is in function integrallookups. The hard coded
> integrals of elementary special functions are removed and replaced by
> 'integral forms on the function property lists. To leave the testsuite
> results unchanged, two further changes are required:
> 1) In function intform, mexpt and the trig functions are excluded from
> calling partial-integration
> 2) In function partial-integration it is necessary to limit the
> recursion depth.
>
>
> Index: sin.lisp
> ===================================================================
> RCS file: /cvsroot/maxima/maxima/src/sin.lisp,v
> retrieving revision 1.51
> diff -u -r1.51 sin.lisp
> --- sin.lisp 18 Aug 2009 16:59:37 -0000 1.51
> +++ sin.lisp 21 Oct 2009 11:02:19 -0000
> @@ -146,8 +146,11 @@
> (t (return nil)))))))
>
> ;; We have a special function with an integral on the property list.
> -
> + ;; After the integral property was defined for the trig functions,
> + ;; in rev 1.52, need to exclude trig functions here.
> ((and (not (atom (car expres)))
> + (not (optrig (caar expres)))
> + (not (eq (caar expres) 'mexpt))
> (get (caar expres) 'integral))
> (when *debug-integrate*
> (format t "~&INTFORM with Integral on property list~%"))
> @@ -573,18 +576,11 @@
> ;; ((MQAPPLY SIMP) (($PSI SIMP ARRAY) 1) $X)
> ;; => (($PSI) 1 $X)
> (integrallookups `((,(caaadr exp)) ,@(cdadr exp) ,@(cddr exp))))
> - ((eq (caar exp) '%log)
> - (maxima-substitute (cadr exp)
> - 'x
> - '((mplus)
> - ((mtimes) x ((%log) x))
> - ((mtimes) -1 x))))
> -
> - ;; The integral of the Log function is directly implemented in the
> - ;; algorithm. This can be generalized to a lookup algorithm for any
> - ;; special function. The integral is put on the property list.
> - ;; In a first step we support functions with one and two arguments.
>
> + ;; Lookup algorithm for integral of a special function.
> + ;; The integral form is put on the property list, and can be a
> + ;; lisp function of the args. If the form is nil, or evaluates
> + ;; to nil, then return noun form unevaluated.
> ((and (not (atom (car exp)))
> (setq form (get (caar exp) 'integral))
> (setq dummy-args (car form))
> @@ -605,58 +601,42 @@
>
> ((eq (caar exp) 'mplus)
> (muln (list '((rat simp) 1 2) exp exp) nil))
> - ((eq (caar exp) 'mexpt)
> - (cond ((freevar (cadr exp))
> - (simplifya (maxima-substitute exp
> - 'a
> - (maxima-substitute (cadr exp)
> - 'b
> - '((mtimes)
> - a
> - ((mexpt)
> - ((%log)
> - b)
> - -1))))
> - nil))
> - ((or (equal (caddr exp) -1)
> - (and (not (mnump (caddr exp)))
> - (freeof '$%i (caddr exp))
> - (eq (asksign (power (add (caddr exp) 1) 2)) '$zero)))
> - (maxima-substitute (cadr exp) 'x (logmabs 'x)))
> - (t (maxima-substitute (add (caddr exp) 1)
> - 'n
> - (maxima-substitute (cadr exp)
> - 'x
> - '((mtimes)
> - ((mexpt) n -1)
> - ((mexpt) x n)))))))
> - (t (maxima-substitute (cadr exp)
> - 'x
> - (cdr (sassq (caar exp)
> - '((%sin (mtimes) -1 ((%cos) x))
> - (%cos (%sin) x)
> - (%tan (%log)
> - ((%sec) x))
> - (%sec (%log) ((mplus) ((%sec) x) ((%tan) x)))
> - (%cot (%log)
> - ((%sin) x))
> - (%sinh (%cosh) x)
> - (%cosh (%sinh) x)
> - (%tanh (%log)
> - ((%cosh) x))
> - (%coth (%log) ((%sinh) x))
> - (%sech (%atan)
> - ((%sinh) x))
> - (%csch
> - (%log) ((%tanh) ((mtimes) ((rat simp) 1 2) x)))
> - (%csc (mtimes)
> - -1
> - ((%log)
> - ((mplus)
> - ((%csc) x)
> - ((%cot)
> - x)))))
> - 'nill)))))))
> +
> + (t nil))))
> +
> +;; Integrals of elementary special functions
> +;; This may not be the best place for this definition, but it is close
> +;; to the original code.
> +(defprop %log ((x) ((mplus) ((mtimes) x ((%log) x)) ((mtimes) -1 x)))
> integral)
> +(defprop %sin ((x) ((mtimes) -1 ((%cos) x))) integral)
> +(defprop %cos ((x) ((%sin) x)) integral)
> +(defprop %tan ((x) ((%log) ((%sec) x))) integral)
> +(defprop %csc ((x) ((mtimes) -1 ((%log) ((mplus) ((%csc) x) ((%cot)
> x))))) integral)
> +(defprop %sec ((x) ((%log) ((mplus) ((%sec) x) ((%tan) x)))) integral)
> +(defprop %cot ((x) ((%log) ((%sin) x))) integral)
> +(defprop %sinh ((x) ((%cosh) x)) integral)
> +(defprop %cosh ((x) ((%sinh) x)) integral)
> +(defprop %tanh ((x) ((%log) ((%cosh) x))) integral)
> +(defprop %coth ((x) ((%log) ((%sinh) x))) integral)
> +(defprop %sech ((x) ((%atan) ((%sinh)x))) integral)
> +(defprop %csch ((x) ((%log) ((%tanh) ((mtimes) ((rat simp) 1 2) x))))
> integral)
> +
> +;; Integral of a^b == ((mexpt) a b)
> +(putprop 'mexpt
> + `((a b)
> + ;;integrate(a^b,a);
> + ,(lambda (a b)
> + (cond
> + ((or (equal b -1)
> + (and (not (mnump b))
> + (freeof '$%i b)
> + (eq (asksign (power (add b 1) 2)) '$zero)))
> + (logmabs a))
> + (t
> + '((mtimes) ((mexpt) a ((mplus) b 1)) ((mexpt) ((mplus) b 1) -1)))))
> + ;; integrate(a^b,b);
> + ((mtimes) ((mexpt) a b) ((mexpt) ((%log) a) -1)))
> + 'integral)
>
> (defun rat10 (ex)
> (cond ((freevar ex) t)
> @@ -1613,7 +1593,14 @@
> ;;; partial-integration is an extension of the algorithm of ratlog to
> support
> ;;; the technique of partial integration for more cases. The integrand
> ;;; is like g(x)*f'(x) and the result is g(x)*f(x)-integrate(g'(x)*f(x),x).
> -
> +;;;
> +;;; Adding integrals properties for elementary functions led to
> infinite recursion
> +;;; with integrate(z*expintegral_shi(z),z). This was resolved by
> limiting the
> +;;; recursion depth. *integrator-level* needs to be at least 3 to solve
> +;;; o integrate(expintegral_ei(1/sqrt(x)),x)
> +;;; o integrate(sqrt(z)*expintegral_li(z),z)
> +;;; while a value of 4 causes testsuite regressions with
> +;;; o integrate(z*expintegral_shi(z),z)
> (defun partial-integration (form var)
> (let ((g (cdr (assoc 'a form))) ; part g(x)
> (df (cdr (assoc 'c form))) ; part f'(x)
> @@ -1621,7 +1608,8 @@
> (setq f (integrator df var)) ; integrate f'(x) wrt var
> (cond
> ((or (isinop f '%integrate) ; no result or
> - (isinop f (caar g))) ; g in result
> + (isinop f (caar g)) ; g in result
> + (> *integrator-level* 3))
> nil) ; we return nil
> (t
> ;; Build the result: g(x)*f(x)-integrate(g'(x)*f(x))
>
>
>
> ------------------------------
>
> Message: 3
> Date: Wed, 21 Oct 2009 10:02:46 -0400
> From: "G. Jay Kerns" <gkerns at ysu.edu>
> Subject: show gradient vectors orthogonal to level curves
> To: maxima <maxima at math.utexas.edu>
> Message-ID:
> <a695148b0910210702k1fbb62dbw20272af3c736d738 at mail.gmail.com>
> Content-Type: text/plain; charset=UTF-8
>
> Dear Maxima list,
>
> I am trying to demonstrate that gradient vectors are orthogonal to
> contour lines. I have tried lots of things, but nothing seems to be
> exactly right. Here's some of what I tried.
>
> 1) I can get plotdf to plot the vector field nicely, but then I can't
> seem to add the contour lines to the plot... it is an ODE plot, after
> all, which is concerned with trajectories and the like.
>
> 2) Using the draw package, I can plot both the vector field and the
> contour lines in both 2D and 3D. I can use multiplot_mode to
> superimpose plots.
>
> 2a) The axes do not align correctly in 2D because the contour plot
> places a legend on the right top corner. There is apparently some
> rescaling for that and I cannot get the vector field plot to do
> similar rescaling. Furthermore, I cannot get the legend turned off of
> the contour plot.
>
> 2b) The plots do not line up correctly in 3D because when contour =
> base the contour lines are plotted on some low plane parallel to the
> xy-plane which is out of reach.
>
> Here is a minimal example of what I am talking about.
>
>
> f(x,y) := x^2 - y^2;
>
> define(fx(x,y), diff(f(x,y), x));
> define(fy(x,y), diff(f(x,y), y));
>
> load("draw");
> coord: setify(makelist(k,k,-3,3))$
> points2d: listify(cartesian_product(coord,coord))$
> vf2d(x,y):= vector([x,y],[fx(x,y),fy(x,y)]/10)$
> vect2: makelist(vf2d(k[1],k[2]),k,points2d)$
>
> ex1: apply(gr2d, append([head_length=0.1, color=blue], vect2))$
>
> ex2: gr3d(explicit(f(x,y),x,-3,3,y,-3,3),
> contour_levels = 15,
> contour = map,
> surface_hide = true) ;
>
> multiplot_mode(screen);
> draw(ex1);
> draw(ex2);
> multiplot_mode(none);
>
>
>
> Any ideas?
>
> Regards,
> Jay
>
>
> P.S. You can get what I am looking for in Sage with
>
> plot_vector_field(f.gradient(), (x, -3, 3), (y, -3, 3), aspect_ratio=1) +
> contour_plot(f(x,y), (x, -3, 3), (y, -3, 3), fill=False, contours=9)
>
>
>
>
> ***************************************************
> G. Jay Kerns, Ph.D.
> Associate Professor
> Department of Mathematics & Statistics
> Youngstown State University
> Youngstown, OH 44555-0002 USA
> Office: 1035 Cushwa Hall
> Phone: (330) 941-3310 Office (voice mail)
> -3302 Department
> -3170 FAX
> VoIP: gjkerns at ekiga.net
> E-mail: gkerns at ysu.edu
> http://people.ysu.edu/~gkerns/
>
>
> ------------------------------
>
> _______________________________________________
> Maxima mailing list
> Maxima at math.utexas.edu
> http://www.math.utexas.edu/mailman/listinfo/maxima
>
>
> End of Maxima Digest, Vol 39, Issue 55
> **************************************
_________________________________________________________________
?H???? Windows Live Messenger ?M Hotmail?A???????a?x?????T???b???? ?X Windows Live for Mobile
http://3c.msn.com.tw/mobile/