Related

constant-cos-declare-diff-let-letsimp-mainvar-posfun-sin-solve

x(t) := r(t) * sin(th...

y(t) := r(t) * cos(th...

declare (slope,consta...

Calculate

constant-cos-declare-diff-plot2d-sqrt

RPM:200;

Theta(t):=%pi/30*RPM*t;

Phi(t):=23/15*Theta(t);

Calculate

constant-cos-declare-globalsolve-realonly-rhs-sin-true

globalsolve: true;

realonly: true;

/* Standard (x,y)->...

Calculate

constant-declare-solve

declare(C, constant);

declare(P, constant);

declare(l, constant);

Calculate

declare(a, constant);

declare(c, constant);

dgtr(theta):=(c)/((a^...

Calculate

constant-declare-plot3d

f(x,z):= x/(x+z) * (x...

u(x,z):= 1/2;

declare(XMIN, constant);

Calculate

constant-cos-declare-sin-sqrt

declare(C, constant);

declare(P, constant);

declare(l, constant);

Calculate

constant-cos-declare-derivabbrev-diff-lhs-mainvar-rhs-sin-solve-subst-true

derivabbrev:true ;

declare (t, mainvar);

declare (theta, mainv...

Calculate

constant-cos-declare-globalsolve-multthru-realonly-sin-true

globalsolve: true;

realonly: true;

/* Standard (x,y)->...

Calculate

constant-declare-plot3d

f(x,z):= x/(x+z) * (x...

u(x,z):= 1/2;

declare(XMIN, constant);

Calculate

constant

Run Example
```(%i1)declare(C, constant);
(%o1)                                done
(%i2) declare(P, constant);
(%o2)                                done
(%i3) declare(l, constant);
(%o3)                                done
(%i4) declare(theta_0, constant);
(%o4)                                done
(%i5) A: 2*C;
(%o5)                                 2 C
(%i6) psi_dot_0: 2*sqrt(P*l/(A*cos(theta_0)));
l P
(%o6)                    sqrt(2) sqrt(--------------)
C cos(theta_0)
(%i7) phi_dot_0: 2*sqrt(P*l*cos(theta_0)/A);
l P cos(theta_0)
(%o7)                   sqrt(2) sqrt(----------------)
C
(%i8) r : phi_dot_0 + psi_dot_0 * cos(theta_0);
l P cos(theta_0)                      l P
(%o8) sqrt(2) sqrt(----------------) + sqrt(2) sqrt(--------------)
C                         C cos(theta_0)
cos(theta_0)
(%i9) h: A*psi_dot_0^2*(1 - (cos(theta_0))^2)+2*P*l*cos(theta_0);
2
4 l P (1 - cos (theta_0))
(%o9)           ------------------------- + 2 l P cos(theta_0)
cos(theta_0)
(%i10) H: C*r;
l P cos(theta_0)
(%o10) C (sqrt(2) sqrt(----------------)
C
l P
+ sqrt(2) sqrt(--------------) cos(theta_0))
C cos(theta_0)
(%i11) K: H*cos(theta_0)+A*psi_dot_0*(1-(cos(theta_0))^2);
l P cos(theta_0)
(%o11) C cos(theta_0) (sqrt(2) sqrt(----------------)
C
l P
+ sqrt(2) sqrt(--------------) cos(theta_0))
C cos(theta_0)
3/2             l P                2
+ 2    C sqrt(--------------) (1 - cos (theta_0))
C cos(theta_0)
(%i12)  eq1:A*(h-2*P*l*u)*(1-u^2)-(K-H*u)^2;
2
4 l P (1 - cos (theta_0))
(%o12) 2 C (- 2 l P u + ------------------------- + 2 l P cos(theta_0))
cos(theta_0)
2                           l P cos(theta_0)
(1 - u ) - expt(- C (sqrt(2) sqrt(----------------)
C
l P
+ sqrt(2) sqrt(--------------) cos(theta_0)) u
C cos(theta_0)
l P cos(theta_0)
+ C cos(theta_0) (sqrt(2) sqrt(----------------)
C
l P
+ sqrt(2) sqrt(--------------) cos(theta_0))
C cos(theta_0)
3/2             l P                2
+ 2    C sqrt(--------------) (1 - cos (theta_0)), 2)
C cos(theta_0)
(%i13) eq2 : ratsubst( c, cos(theta_0), eq1);
3         2      l P   2      l P c              2
(%o13) (4 l C P c u  + (- 4 C  sqrt(---) c  sqrt(-----) - 8 l C P) u
C c            C
2      l P         l P c
+ (8 C  sqrt(---) c sqrt(-----) + 4 l C P c) u
C c           C
l P c      2      l P   4      2      l P   2             4
+ sqrt(-----) (4 C  sqrt(---) c  - 8 C  sqrt(---) c ) - 4 l C P c
C               C c                 C c
2
+ 4 l C P c )/c
(%i14) eq3: solve( eq2, u);
l P c
(%o14) [u = - (sqrt(2) sqrt(sqrt(-----)
C
l P   4                l P   2     2  2  4      2  2
(l C P sqrt(---) c  - 2 l C P sqrt(---) c ) - l  P  c  + 2 l  P )
C c                    C c
l P   2      l P c         2
- C sqrt(---) c  sqrt(-----) + l P c  - 2 l P)/(2 l P c),
C c            C
l P c              l P   4                l P   2
u = (sqrt(2) sqrt(sqrt(-----) (l C P sqrt(---) c  - 2 l C P sqrt(---) c )
C                C c                    C c
2  2  4      2  2           l P   2      l P c         2
- l  P  c  + 2 l  P ) + C sqrt(---) c  sqrt(-----) - l P c  + 2 l P)
C c            C
/(2 l P c), u = c]
(%i15) ratsimp( eq3[1] );
l P c              l P   4
(%o15) u = - (sqrt(2) sqrt(sqrt(-----) (l C P sqrt(---) c
C                C c
l P   2     2  2  4      2  2           l P   2      l P c
- 2 l C P sqrt(---) c ) - l  P  c  + 2 l  P ) - C sqrt(---) c  sqrt(-----)
C c                                     C c            C
2
+ l P c  - 2 l P)/(2 l P c)
(%i16) ```
Run Example
```/* Standard (x,y)->
(r,theta) coordinate translation */x(t) := r(t) * cos(theta(t));
(%o1)                     x(t) := r(t) cos(theta(t))
(%i2) y(t) := r(t) * sin(theta(t));
(%o2)                     y(t) := r(t) sin(theta(t))
(%i3) /* Constant course assumption */declare (slope,constant);
(%o3)                                done
(%i4) declare (slope,real);
(%o4)                                done
(%i5) declare (yintercept,constant);
(%o5)                                done
(%i6) declare (yintercept, real);
(%o6)                                done
(%i7) eq1: y(t)=slope * x(t) + yintercept;
(%o7)     r(t) sin(theta(t)) = slope r(t) cos(theta(t)) + yintercept
(%i8) /* Known & constant sound velocity */declare (soundvel,constant);
(%o8)                                done
(%i9) assume(soundvel>
0);
(%o9)                           [0 < soundvel]
(%i10) /* Known and constant base frequency */declare (basefrequency, constant);
(%o10)                               done
(%i11) assume(basefrequency>
0);
(%o11)                        [0 < basefrequency]
(%i12) /* f-- observed frequency. Standard doppler equation*/declare(f, real);
(%o12)                               done
(%i13) let (diff(r(t),t), (f(t)/basefrequency-1)*soundvel);
d                           f(t)
(%o13)            -- (r(t)) --> soundvel (------------- - 1)
dt                      basefrequency
(%i14) /* Differentiate eq1 and solve for r(t) */eq3: letsimp(solve([diff(y(t),t) = slope * diff(x(t),t)],r(t)));
(%o14) [r(t) =
slope soundvel cos(theta(t))
- -------------------------------------------------------------------
d                               d
slope sin(theta(t)) (-- (theta(t))) + cos(theta(t)) (-- (theta(t)))
dt                              dt
soundvel sin(theta(t))
+ -------------------------------------------------------------------
d                               d
slope sin(theta(t)) (-- (theta(t))) + cos(theta(t)) (-- (theta(t)))
dt                              dt
+ (slope soundvel f(t) cos(theta(t)))/(basefrequency slope sin(theta(t))
d                                             d
(-- (theta(t))) + basefrequency cos(theta(t)) (-- (theta(t))))
dt                                            dt
+ (- (soundvel f(t) sin(theta(t)))/(basefrequency slope sin(theta(t))
d                                             d
(-- (theta(t))) + basefrequency cos(theta(t)) (-- (theta(t)))))]
dt                                            dt
(%i15) /* Differentiate eq3 and solve for slope */eq6: trigsimp(solve(letsimp(diff(eq3,t)), slope));
2                                          2
(%o15) [slope = (sqrt((f (t) - 2 basefrequency f(t) + basefrequency )
2
d              2                               d           d
(--- (theta(t)))  + (2 basefrequency - 2 f(t)) (-- (f(t))) (-- (theta(t)))
2                                            dt          dt
dt
2
d                       2                                             2
(--- (theta(t))) + (- 8 f (t) + 16 basefrequency f(t) - 8 basefrequency )
2
dt
d             4    d         2  d             2
(-- (theta(t)))  + (-- (f(t)))  (-- (theta(t))) )
dt                 dt           dt
2
+ ((2 f(t) - 2 basefrequency) sin (theta(t)) - f(t) + basefrequency)
2
d
(--- (theta(t))) + (2 basefrequency - 2 f(t)) cos(theta(t)) sin(theta(t))
2
dt
d             2    d              d             2             d
(-- (theta(t)))  + (-- (f(t)) - 2 (-- (f(t))) sin (theta(t))) (-- (theta(t))))
dt                 dt             dt                          dt
2
d
/((2 f(t) - 2 basefrequency) cos(theta(t)) sin(theta(t)) (--- (theta(t)))
2
dt
2
+ ((2 f(t) - 2 basefrequency) sin (theta(t)) + 2 f(t) - 2 basefrequency)
d             2      d
(-- (theta(t)))  - 2 (-- (f(t))) cos(theta(t)) sin(theta(t))
dt                   dt
d                                  2
(-- (theta(t)))), slope = - (sqrt((f (t) - 2 basefrequency f(t)
dt
2
2   d              2                               d
+ basefrequency ) (--- (theta(t)))  + (2 basefrequency - 2 f(t)) (-- (f(t)))
2                                            dt
dt
2
d               d                       2
(-- (theta(t))) (--- (theta(t))) + (- 8 f (t) + 16 basefrequency f(t)
dt                2
dt
2   d             4    d         2  d             2
- 8 basefrequency ) (-- (theta(t)))  + (-- (f(t)))  (-- (theta(t))) )
dt                 dt           dt
2
+ ((2 f(t) - 2 basefrequency) cos (theta(t)) - f(t) + basefrequency)
2
d
(--- (theta(t))) + (2 f(t) - 2 basefrequency) cos(theta(t)) sin(theta(t))
2
dt
d             2    d              d             2             d
(-- (theta(t)))  + (-- (f(t)) - 2 (-- (f(t))) cos (theta(t))) (-- (theta(t))))
dt                 dt             dt                          dt
2
d
/((2 f(t) - 2 basefrequency) cos(theta(t)) sin(theta(t)) (--- (theta(t)))
2
dt
2
+ ((2 basefrequency - 2 f(t)) cos (theta(t)) + 4 f(t) - 4 basefrequency)
d             2      d                                       d
(-- (theta(t)))  - 2 (-- (f(t))) cos(theta(t)) sin(theta(t)) (-- (theta(t))))]
dt                   dt                                      dt
(%i16) /* Now we have a number of estimates for the slope constant. *//* We can use any statistical technique to estimate the actual constant *//* Constant speed assumption */eq7: letsimp(diff(letsimp(diff(x(t),t)),t)) = 0;
2
d
(%o16) (- basefrequency r(t) sin(theta(t)) (--- (theta(t)))
2
dt
d             2
- basefrequency r(t) cos(theta(t)) (-- (theta(t)))
dt
d
- 2 soundvel f(t) sin(theta(t)) (-- (theta(t)))
dt
d
+ 2 basefrequency soundvel sin(theta(t)) (-- (theta(t)))
dt
d
+ soundvel (-- (f(t))) cos(theta(t)))/basefrequency = 0
dt
(%i17) eq8: solve(eq7, r(t));
(%o17) [r(t) = - ((2 soundvel f(t) - 2 basefrequency soundvel) sin(theta(t))
d                          d
(-- (theta(t))) - soundvel (-- (f(t))) cos(theta(t)))
dt                         dt
2
d
/(basefrequency sin(theta(t)) (--- (theta(t)))
2
dt
d             2
+ basefrequency cos(theta(t)) (-- (theta(t))) )]
dt
(%i18) eq9: subst(eq8, eq1);
(%o18) - (sin(theta(t)) ((2 soundvel f(t) - 2 basefrequency soundvel)
d                          d
sin(theta(t)) (-- (theta(t))) - soundvel (-- (f(t))) cos(theta(t))))
dt                         dt
2
d
/(basefrequency sin(theta(t)) (--- (theta(t)))
2
dt
d             2
+ basefrequency cos(theta(t)) (-- (theta(t))) ) =
dt
yintercept - (slope cos(theta(t)) ((2 soundvel f(t) - 2 basefrequency soundvel)
d                          d
sin(theta(t)) (-- (theta(t))) - soundvel (-- (f(t))) cos(theta(t))))
dt                         dt
2
d
/(basefrequency sin(theta(t)) (--- (theta(t)))
2
dt
d             2
+ basefrequency cos(theta(t)) (-- (theta(t))) )
dt
(%i19) eq10: solve(eq9, yintercept);
(%o19) [yintercept = - (((2 soundvel f(t) - 2 basefrequency soundvel)
2
sin (theta(t)) + (2 basefrequency slope soundvel - 2 slope soundvel f(t))
d
cos(theta(t)) sin(theta(t))) (-- (theta(t)))
dt
d
- soundvel (-- (f(t))) cos(theta(t)) sin(theta(t))
dt
d             2
+ slope soundvel (-- (f(t))) cos (theta(t)))
dt
2
d
/(basefrequency sin(theta(t)) (--- (theta(t)))
2
dt
d             2
+ basefrequency cos(theta(t)) (-- (theta(t))) )]
dt
(%i20) /* Now we have a number of estimates for the yintercept constant. *//* We can use any statistical technique to estimate the actual constant *//* This gives us r(theta) in terms of slope and y_intercept*/solve(eq1, r(t));
yintercept
(%o20)           [r(t) = -----------------------------------]
sin(theta(t)) - slope cos(theta(t))
(%i21) ```
Run Example
```declare(A, constant);
(%o1)                                done
(%i2) declare(C, constant);
(%o2)                                done
(%i3) dgtr(theta):=(C)/((A^2)*(cos(theta)^2) + (sin(theta)^2))^2;
C
(%o3)           dgtr(theta) := -------------------------------
2    2             2        2
(A  cos (theta) + sin (theta))
(%i4) pdfh(theta):=dgtr(theta)*cos(theta);
(%o4)                pdfh(theta) := dgtr(theta) cos(theta)
(%i5) dpdfphi(theta) := pdfh(theta) * sin(theta);
(%o5)              dpdfphi(theta) := pdfh(theta) sin(theta)
(%i6) pdfphi(phi):=integrate(dpdfphi(theta), theta, 0, %pi/2);
%pi
(%o6)       pdfphi(phi) := integrate(dpdfphi(theta), theta, 0, ---)
2
(%i7) pdfphi(phi);
1            1
(%o7)                     (-------- - -----------) C
2          4      2
2 A  - 2   2 A  - 2 A
(%i8) pdftheta(theta) = pdfphi(phi)/pdfh(theta);
(%o8) pdftheta(theta) =
1            1           2           2    2        2
(-------- - -----------) (sin (theta) + A  cos (theta))
2          4      2
2 A  - 2   2 A  - 2 A
--------------------------------------------------------
cos(theta)
(%i9) cdfphi(x):=integrate(pdfphi(phi),phi,0,x);
(%o9)           cdfphi(x) := integrate(pdfphi(phi), phi, 0, x)
(%i10) cdftheta(x):=integrate(pdftheta(theta),theta,0,x);
(%o10)      cdftheta(x) := integrate(pdftheta(theta), theta, 0, x)
(%i11) f(x):=integrate(x * y, y, 0, 1 - x);
(%o11)                f(x) := integrate(x y, y, 0, 1 - x)
(%i12) f(x);
2
x (x  - 2 x + 1)
(%o12)                         ----------------
2
(%i13) expand(f(x));
3
x     2   x
(%o13)                            -- - x  + -
2         2
(%i14) g(x):=integrate(f(x), x);
(%o14)                    g(x) := integrate(f(x), x)
(%i15) g(x);
4      3      2
3 x  - 8 x  + 6 x
(%o15)                        ------------------
24
(%i16) plot2d([g(x)], [x, 0, 2], [y, -0.5, 2.5]);
***MESSAGE FROM ROUTINE DQAGI IN LIBRARY SLATEC.
***INFORMATIVE MESSAGE, PROG CONTINUES, TRACEBACK REQUESTED
*  ABNORMAL RETURN
*  ERROR NUMBER = 4
*
***END OF MESSAGE

(%o17)     [7.7948888297940644E+34, 1.5405203528020508E+35, 1185, 4]
(%i18) A:1 / quad_qagi(f(x), x, 0, inf);
***MESSAGE FROM ROUTINE DQAGI IN LIBRARY SLATEC.
***INFORMATIVE MESSAGE, PROG CONTINUES, TRACEBACK REQUESTED
*  ABNORMAL RETURN
*  ERROR NUMBER = 4
*
***END OF MESSAGE

1    1
(%o18)     [1.2828919332085192E-35, 6.4913131344295527E-36, ----, -]
1185  4
(%i19) ```

Related Help

Help for Constant