### Related

##### optimize

y(x) := (y0+(2*A/PI)*...

A=-672.67335;

w=55.88089;

Calculate

##### optimize-sin-sqrt

optimize ( sqrt(1-sin...

Calculate

##### optimize-ratsimp-xthru

a: 1/(c-d)-c/(c^2-d^2...

xthru(a);

b:ratsimp(a);

Calculate

##### optimize

y(x) := (y0+(2*A/PI)*...

A=-672.67335;

w=55.88089;

Calculate

? optimize;

Calculate

##### optimize

y(x) := (y0+(2*A/PI)*...

A=-672.67335;

w=55.88089;

Calculate

##### optimize-sin-sqrt

optimize ( sqrt(1-sin...

Calculate

##### optimize-ratsimp-xthru

a: 1/(c-d)-c/(c^2-d^2...

xthru(a);

b:ratsimp(a);

Calculate

##### optimize

y(x) := (y0+(2*A/PI)*...

A=-672.67335;

w=55.88089;

Calculate

? optimize;

Calculate

### optimize

Run Example
```(%i1)M: matrix([-1, 0, 0, - k], [1, -1, 0, 0],[0, 1, -1, 0],[0, 0, 1, -1]);
[ - 1   0    0   - k ]
[                    ]
[  1   - 1   0    0  ]
(%o1)                       [                    ]
[  0    1   - 1   0  ]
[                    ]
[  0    0    1   - 1 ]
(%i2) v: [v1,v2,v3,v4];
(%o2)                          [v1, v2, v3, v4]
(%i3) w: invert(M) . v;
[  k v4    k v3    k v2     v1    ]
[  ----- + ----- + ----- - -----  ]
[  k + 1   k + 1   k + 1   k + 1  ]
[                                 ]
[  k v4    k v3     v2      v1    ]
[  ----- + ----- - ----- - -----  ]
[  k + 1   k + 1   k + 1   k + 1  ]
(%o3)                 [                                 ]
[  k v4     v3      v2      v1    ]
[  ----- - ----- - ----- - -----  ]
[  k + 1   k + 1   k + 1   k + 1  ]
[                                 ]
[    v4      v3      v2      v1   ]
[ - ----- - ----- - ----- - ----- ]
[   k + 1   k + 1   k + 1   k + 1 ]
(%i4) optimize(w);
optimize: encountered a special form; result may be wrong.                                             1
(%o4) block([%1, %2, %3, %4, %5, %6], %1 : -----, %2 : - %1 v1, %3 : k %1 v3,
k + 1
[ %4 + %3 + k %1 v2 + %2 ]
[                        ]
[   %4 + %3 + %5 + %2    ]
%4 : k %1 v4, %5 : - %1 v2, %6 : - %1 v3, [                        ])
[   %4 + %6 + %5 + %2    ]
[                        ]
[ - %1 v4 + %6 + %5 + %2 ]
(%i5) ```
Run Example
```a: 1/(c-d)-c/(c^2-d^2)+1/(2*c+2*d);
c          1         1
(%o1)                    - ------- + --------- + -----
2    2   2 d + 2 c   c - d
c  - d
(%i2) xthru(a);
2    2
(d + 3 c) (c  - d ) - c (c - d) (2 d + 2 c)
(%o2)             -------------------------------------------
2    2
(c - d) (2 d + 2 c) (c  - d )
(%i3) b:ratsimp(a);
1
(%o3)                             - ---------
2 d - 2 c
(%i4) p: x/(x^2-y^2)-y/(x^2+2*x*y+y^2);
x             y
(%o4)                      ------- - ---------------
2    2    2            2
x  - y    y  + 2 x y + x
(%i5) q:ratsimp(p);
2    2
y  + x
(%o5)                       - ---------------------
3      2    2      3
y  + x y  - x  y - x
(%i6) collapse(2*c+2*d);
(%o6)                              2 d + 2 c
(%i7) optimize(2*c+2*d);
(%o7)                              2 d + 2 c
(%i8) ```
Run Example
```x(t) := r(t) * sin(theta(t));
(%o1)                     x(t) := r(t) sin(theta(t))
(%i2) y(t) := r(t) * cos(theta(t));
(%o2)                     y(t) := r(t) cos(theta(t))
(%i3) declare (slope,constant);
(%o3)                                done
(%i4) declare (slope,real);
(%o4)                                done
(%i5) declare (yintercept,constant);
(%o5)                                done
(%i6) declare (yintercept, real);
(%o6)                                done
(%i7) declare (soundvel,constant);
(%o7)                                done
(%i8) assume(soundvel>
0);
(%o8)                           [0 < soundvel]
(%i9) declare (f0, constant);
(%o9)                                done
(%i10) assume(f0>
0);
(%o10)                             [0 < f0]
(%i11) declare(f, real);
(%o11)                               done
(%i12) let (diff(r(t),t), (f(t)/f0-1)*soundvel);
d                       f(t)
(%o12)                 -- (r(t)) --> soundvel (---- - 1)
dt                       f0
(%i13) eq1: y(t)=slope * x(t) + yintercept;
(%o13)    r(t) cos(theta(t)) = slope r(t) sin(theta(t)) + yintercept
(%i14) eq2: diff(y(t),t) = slope * diff(x(t),t);
d                                              d
(%o14) (-- (r(t))) cos(theta(t)) - r(t) sin(theta(t)) (-- (theta(t))) =
dt                                             dt
d                 d
slope (r(t) cos(theta(t)) (-- (theta(t))) + (-- (r(t))) sin(theta(t)))
dt                dt
(%i15) eq3: letsimp(solve([eq2],r(t)));
(%o15) [r(t) =
soundvel cos(theta(t))
- -------------------------------------------------------------------
d                                     d
sin(theta(t)) (-- (theta(t))) + slope cos(theta(t)) (-- (theta(t)))
dt                                    dt
slope soundvel sin(theta(t))
+ -------------------------------------------------------------------
d                                     d
sin(theta(t)) (-- (theta(t))) + slope cos(theta(t)) (-- (theta(t)))
dt                                    dt
soundvel f(t) cos(theta(t))
+ -------------------------------------------------------------------------
d                                        d
f0 sin(theta(t)) (-- (theta(t))) + f0 slope cos(theta(t)) (-- (theta(t)))
dt                                       dt
+ (- (slope soundvel f(t) sin(theta(t)))
d                                        d
/(f0 sin(theta(t)) (-- (theta(t))) + f0 slope cos(theta(t)) (-- (theta(t)))))]
dt                                       dt
(%i16) eq4: letsimp(diff(eq3,t));
soundvel f(t)
(%o16) [- soundvel + ------------- =
f0
d
slope soundvel cos(theta(t)) (-- (theta(t)))
dt
-------------------------------------------------------------------
d                                     d
sin(theta(t)) (-- (theta(t))) + slope cos(theta(t)) (-- (theta(t)))
dt                                    dt
d
soundvel sin(theta(t)) (-- (theta(t)))
dt
+ -------------------------------------------------------------------
d                                     d
sin(theta(t)) (-- (theta(t))) + slope cos(theta(t)) (-- (theta(t)))
dt                                    dt
d
soundvel (-- (f(t))) cos(theta(t))
dt
+ -------------------------------------------------------------------------
d                                        d
f0 sin(theta(t)) (-- (theta(t))) + f0 slope cos(theta(t)) (-- (theta(t)))
dt                                       dt
d
+ (- (slope soundvel (-- (f(t))) sin(theta(t)))
dt
d                                        d
/(f0 sin(theta(t)) (-- (theta(t))) + f0 slope cos(theta(t)) (-- (theta(t)))))
dt                                       dt
d
+ (- (slope soundvel f(t) cos(theta(t)) (-- (theta(t))))
dt
d                                        d
/(f0 sin(theta(t)) (-- (theta(t))) + f0 slope cos(theta(t)) (-- (theta(t)))))
dt                                       dt
d
+ (- (soundvel f(t) sin(theta(t)) (-- (theta(t))))
dt
d                                        d
/(f0 sin(theta(t)) (-- (theta(t))) + f0 slope cos(theta(t)) (-- (theta(t)))))
dt                                       dt
2
d
+ (soundvel cos(theta(t)) (sin(theta(t)) (--- (theta(t)))
2
dt
2
d                                      d             2
+ slope cos(theta(t)) (--- (theta(t))) - slope sin(theta(t)) (-- (theta(t)))
2                                    dt
dt
d             2
+ cos(theta(t)) (-- (theta(t))) ))
dt
d                                     d              2
/(sin(theta(t)) (-- (theta(t))) + slope cos(theta(t)) (-- (theta(t))))
dt                                    dt
2
d
+ (- (slope soundvel sin(theta(t)) (sin(theta(t)) (--- (theta(t)))
2
dt
2
d                                      d             2
+ slope cos(theta(t)) (--- (theta(t))) - slope sin(theta(t)) (-- (theta(t)))
2                                    dt
dt
d             2
+ cos(theta(t)) (-- (theta(t))) ))
dt
d                                     d              2
/(sin(theta(t)) (-- (theta(t))) + slope cos(theta(t)) (-- (theta(t)))) )
dt                                    dt
2
d
+ (- (soundvel f(t) cos(theta(t)) (f0 sin(theta(t)) (--- (theta(t)))
2
dt
2
d
+ f0 slope cos(theta(t)) (--- (theta(t)))
2
dt
d             2
- f0 slope sin(theta(t)) (-- (theta(t)))
dt
d             2
+ f0 cos(theta(t)) (-- (theta(t))) ))
dt
d                                        d              2
/(f0 sin(theta(t)) (-- (theta(t))) + f0 slope cos(theta(t)) (-- (theta(t)))) )
dt                                       dt
2
d
+ (slope soundvel f(t) sin(theta(t)) (f0 sin(theta(t)) (--- (theta(t)))
2
dt
2
d
+ f0 slope cos(theta(t)) (--- (theta(t)))
2
dt
d             2
- f0 slope sin(theta(t)) (-- (theta(t)))
dt
d             2
+ f0 cos(theta(t)) (-- (theta(t))) ))
dt
d                                        d              2
/(f0 sin(theta(t)) (-- (theta(t))) + f0 slope cos(theta(t)) (-- (theta(t)))) ]
dt                                       dt
(%i17) eq5: solve(eq4, slope);
2                2
(%o17) [slope = - ((sin (theta(t)) + cos (theta(t)))
2
2                    2   d              2
sqrt((f (t) - 2 f0 f(t) + f0 ) (--- (theta(t)))
2
dt
2
d           d               d
+ (2 f0 - 2 f(t)) (-- (f(t))) (-- (theta(t))) (--- (theta(t)))
dt          dt                2
dt
2                       2   d             4
+ (- 8 f (t) + 16 f0 f(t) - 8 f0 ) (-- (theta(t)))
dt
d         2  d             2                    2
+ (-- (f(t)))  (-- (theta(t))) ) + ((f(t) - f0) sin (theta(t))
dt           dt
2
2             d
+ (f0 - f(t)) cos (theta(t))) (--- (theta(t)))
2
dt
d             2
+ (2 f0 - 2 f(t)) cos(theta(t)) sin(theta(t)) (-- (theta(t)))
dt
d             2              d             2             d
+ ((-- (f(t))) cos (theta(t)) - (-- (f(t))) sin (theta(t))) (-- (theta(t))))
dt                           dt                          dt
2
d
/((2 f(t) - 2 f0) cos(theta(t)) sin(theta(t)) (--- (theta(t)))
2
dt
2                                2
+ ((2 f0 - 2 f(t)) sin (theta(t)) + (4 f0 - 4 f(t)) cos (theta(t)))
d             2      d
(-- (theta(t)))  - 2 (-- (f(t))) cos(theta(t)) sin(theta(t))
dt                   dt
d                             2                2
(-- (theta(t)))), slope = ((sin (theta(t)) + cos (theta(t)))
dt
2
2                    2   d              2
sqrt((f (t) - 2 f0 f(t) + f0 ) (--- (theta(t)))
2
dt
2
d           d               d
+ (2 f0 - 2 f(t)) (-- (f(t))) (-- (theta(t))) (--- (theta(t)))
dt          dt                2
dt
2                       2   d             4
+ (- 8 f (t) + 16 f0 f(t) - 8 f0 ) (-- (theta(t)))
dt
d         2  d             2                    2
+ (-- (f(t)))  (-- (theta(t))) ) + ((f0 - f(t)) sin (theta(t))
dt           dt
2
2             d
+ (f(t) - f0) cos (theta(t))) (--- (theta(t)))
2
dt
d             2
+ (2 f(t) - 2 f0) cos(theta(t)) sin(theta(t)) (-- (theta(t)))
dt
d             2              d             2             d
+ ((-- (f(t))) sin (theta(t)) - (-- (f(t))) cos (theta(t))) (-- (theta(t))))
dt                           dt                          dt
2
d
/((2 f(t) - 2 f0) cos(theta(t)) sin(theta(t)) (--- (theta(t)))
2
dt
2                                2
+ ((2 f0 - 2 f(t)) sin (theta(t)) + (4 f0 - 4 f(t)) cos (theta(t)))
d             2      d                                       d
(-- (theta(t)))  - 2 (-- (f(t))) cos(theta(t)) sin(theta(t)) (-- (theta(t))))]
dt                   dt                                      dt
(%i18) eq6: trigsimp(eq5);
2
2                    2   d              2
(%o18) [slope = - (sqrt((f (t) - 2 f0 f(t) + f0 ) (--- (theta(t)))
2
dt
2
d           d               d
+ (2 f0 - 2 f(t)) (-- (f(t))) (-- (theta(t))) (--- (theta(t)))
dt          dt                2
dt
2                       2   d             4
+ (- 8 f (t) + 16 f0 f(t) - 8 f0 ) (-- (theta(t)))
dt
d         2  d             2                        2
+ (-- (f(t)))  (-- (theta(t))) ) + ((2 f(t) - 2 f0) sin (theta(t)) - f(t)
dt           dt
2
d
+ f0) (--- (theta(t))) + (2 f0 - 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 f0) cos(theta(t)) sin(theta(t)) (--- (theta(t)))
2
dt
2                             d             2
+ ((2 f(t) - 2 f0) sin (theta(t)) - 4 f(t) + 4 f0) (-- (theta(t)))
dt
d                                       d
- 2 (-- (f(t))) cos(theta(t)) sin(theta(t)) (-- (theta(t)))),
dt                                      dt
2
2                    2   d              2
slope = (sqrt((f (t) - 2 f0 f(t) + f0 ) (--- (theta(t)))
2
dt
2
d           d               d
+ (2 f0 - 2 f(t)) (-- (f(t))) (-- (theta(t))) (--- (theta(t)))
dt          dt                2
dt
2                       2   d             4
+ (- 8 f (t) + 16 f0 f(t) - 8 f0 ) (-- (theta(t)))
dt
d         2  d             2                        2
+ (-- (f(t)))  (-- (theta(t))) ) + ((2 f(t) - 2 f0) cos (theta(t)) - f(t)
dt           dt
2
d
+ f0) (--- (theta(t))) + (2 f(t) - 2 f0) 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 f0) cos(theta(t)) sin(theta(t)) (--- (theta(t)))
2
dt
2                             d             2
+ ((2 f0 - 2 f(t)) cos (theta(t)) - 2 f(t) + 2 f0) (-- (theta(t)))
dt
d                                       d
- 2 (-- (f(t))) cos(theta(t)) sin(theta(t)) (-- (theta(t))))]
dt                                      dt
(%i19) optimize (eq6);
(%o19) block([%1, %2, %3, %4, %5, %6, %7, %8, %9, %10, %11, %12, %13, %14,
d%1
%15, %16, %17, %18, %19, %20, %21], %1 : f(t), %2 : ---, %3 : theta(t),
dt
d%3
%4 : cos(%3), %5 : sin(%3), %6 : ---, %7 : - 2 %2 %4 %5 %6, %8 : 2 %1 - 2 f0,
dt
2
2                       2        d %3
%9 : %5 , %10 : %8 %9, %11 : %6 , %12 : ----, %13 : %8 %4 %5 %12, %14 : 2 f0,
2
dt
2          2
%15 : - 2 %1, %16 : %15 + %14, %17 : - %1, %18 : f0 , %19 : %1 ,
2
%20 : sqrt((%19 - 2 f0 %1 + %18) %12  + %16 %2 %6 %12
4     2               2
+ (- 8 %19 + 16 f0 %1 - 8 %18) %6  + %2  %11), %21 : %4 ,
%20 + (%10 + %17 + f0) %12 + %16 %4 %5 %11 + (%2 - 2 %2 %9) %6
[slope = - --------------------------------------------------------------,
%13 + (%10 - 4 %1 + 4 f0) %11 + %7
%20 + (%8 %21 + %17 + f0) %12 + %8 %4 %5 %11 + (%2 - 2 %2 %21) %6
slope = -----------------------------------------------------------------])
%13 + (%16 %21 + %15 + %14) %11 + %7
(%i20) ```

### Related Help

Help for Optimize