## 792 Reputation

9 years, 230 days

## How to avoid undesired simplifications ?...

Maple

Hi everybody,

I'm working with orthogonal or Bernstein polynomials and I would like to keep my results expressed in terms of such polynomials.
Here is a notional example.

with(orthopoly):
#  first example : the result of diff is of the desired form  (p*q)' =  p' * q + p * q'
p := H(2, x):
q := H(3,x):
pq;
(4*x^2-2)*(8*x^3-12*x)
dpq := diff(pq, x);
8*x*(8*x^3-12*x)+ (4*x^2-2)*(24*x^2-12)

#  second example : the result of diff is not exactly of the desired form (p*q)' =  p' * q + p * q'
# for  p' * q has been expanded

p := H(1,x)
q := H(3,x):
pq := p*q;
2*x*(8*x^3-12*x)
diff(pq, x);
16*x^3-24*x+ 2*x*(24*x^2-12)

#  third example : here the result has been fully expanded
p := H(1,x)
q := H(2,x):
pq := p*q;
2*x*(4*x^2-2)
diff(pq, x);
24*x^2-4

First question : How could Iforce Maple to  preserve the form  p' * q + p * q' in all the situations ?

______________________________________________________________________

In the first test case the value of dpq (   8*x*(8*x^3-12*x)+ (4*x^2-2)*(24*x^2-12)    ) is not expressed in terms of Hermite polynomials.
I would like it to be, so I tried this ...

r := degree(dpq, x):
C := coeffs(expand(dpq-A), x)
S := solve(C, {seq(a__|-k, k=0..r)});
{a0=48, a1=0, a2=72, a3=0, a4=10}
Hdpq := subs(S, A)
160*x^4-192*z^2+24

...but  I had hope to obtain   Hdpq := 48*H(0,z)+72*H(2,z)+10*H(4,z), so here
48 + 72 * (4*z^2 - 2) + 10 * (16*z^4 - 48*z^2 + 12)

Second question : How could I prevent Maple to simplify the result os subs(S, A) ?

## How to plots[animate] a HeatMap ?...

Maple 2016

Hi,

This is a notional example

1/ I define a matrix through some procedure, for instance
p := k -> Matrix(3, 3, (i,j) -> i+j+k mod 3)

2/ Now I would like to animate the plot of matrices p(k) for successive values of k.
The red commend below doesn't work
N := 5:
plots[animate](Statistics[HeatMap], [ p(k) ], k=0..N, frames=N+1);

TIA

## Arrow operator or unapply ?...

Maple

Hi,

I naively thought that
f := t -> Some expression containing t
and
f := unapply(Some expression containing t, t)
where two different ways to define the same function f.

Recently I defined f and g this way
X := RandomVariable(Normal(m, s)):
U := Sample(X, 30000) ;
f := t -> PDF(X, t);
g := unapply(PDF(X, t), t);

Could you explain me why f~(U) exectues in about 10 seconds and g~(U) in less than 0.1 s ?

## Can't understand how Statistics[Likeliho...

Maple 2016

Hi,
Can somebody explain me these strange results ?

restart:
with(Statistics):
X := RandomVariable(Normal(1.0, 1.0)):
S := Sample(X, 10):

# naively... but it's not what I was expecting for
#                maybe a misuse of the 'normalize=truefalse' option ????
Likelihood(Normal(1.0, 1.0), S);

# 2nd way
A := Likelihood(Normal(m, 1.0), S):
evalf(subs(m=1.0, A));
# this is the good answer
0.004387

# third way
Likelihood(Normal(1.0, 1.0), S, 'normalize=false');

## How can I find the inverse of a function...

Maple

Hi everyone,

I have a x -> y = f(x) function from R to R (you may suppose f is C(infinity)),  given by an explicit relation.
This function is not strictly monotonic over R.

I want to construct the global inverse of f over R by putting "side by side" local inverse functions.
Let a__0, ..., a__n values of x such that:

1. -infinity =a__0 < a__1 < ... a__(n-1) < a__n = + infinity
2. f is monotonic over ] a__p, a__(p+1) [   for each p=0..n-1

The idea is to define the global inverse g of f over R by
g := y ->  piecewise(y < f(a__1), g__0(y), ..., y < f(a__n), g__(n-1)(y))
where g__p(y), is the inverse function of the restriction of f to ] a__p, a__(p+1) [

Toy problem
f := x ->1-(1-x)^2;
x__1 := solve(diff(f(x), x);
y__1 := f(x__1);

# I thought one of these commands could work (but they don't return me a single branch as I had expected)
solve(f(x)=y, x) assuming y < y__1;
solve({f(x)=y, x < x__1}, x);

How can I obtain the inverse of a function f over an interval where f is bijective ?

TIA

 First 10 11 12 13 14 15 16 Last Page 12 of 22
﻿