## 15 Reputation

13 years, 134 days

## Types...

`I think if you check types (using whattype command) is possible to understand the problem with the first code.`
` `
`> restart;`
`> pwl := x < 0, -1, x < 1, 0, 1;                     x < 0, -1, x < 1, 0, 1> whattype(pwl);                            exprseq> k := proc (x) options operator, arrow; piecewise(pwl) end proc;x -> piecewise(pwl)> whattype(k);                             symbol> k;                               k> whattype(k(x));                            function> k(x);               piecewise(x < 0, -1, x < 1, 0, 1)`
` `
`k is an operator and you need an expression for plot.`
`I hope it's help.`
` `
`Regards.`

## Types...

`I think if you check types (using whattype command) is possible to understand the problem with the first code.`
` `
`> restart;`
`> pwl := x < 0, -1, x < 1, 0, 1;                     x < 0, -1, x < 1, 0, 1> whattype(pwl);                            exprseq> k := proc (x) options operator, arrow; piecewise(pwl) end proc;x -> piecewise(pwl)> whattype(k);                             symbol> k;                               k> whattype(k(x));                            function> k(x);               piecewise(x < 0, -1, x < 1, 0, 1)`
` `
`k is an operator and you need an expression for plot.`
`I hope it's help.`
` `
`Regards.`

## Hypothesis...

`The problem with your approach is that you have an infinite number of curves that accomplished your constraints:f(8)=g(8) and diff(f,x)(8)=diff(g,x)(8).With the approach I described before I get the following graph for f and g;`
` `

## Hypothesis...

`The problem with your approach is that you have an infinite number of curves that accomplished your constraints:f(8)=g(8) and diff(f,x)(8)=diff(g,x)(8).With the approach I described before I get the following graph for f and g;`
` `

## Depends...

`What do you understand by "get a graph like" ?I understood try to find a and b such that the "distance" between g = 0.00083*x^4-0.09375*x^2+3 and f = a*cos(b*x)+3 is a global minimum in the interval x =[-8..8]Using a "distance" based in the L2 norm:distance = int((f-g)²,x=-8..8)you could try to find an answer (maybe using the optimization package).I suggest to try with a more general f = a*cos(b*x)+c. You will get a best solution.`

## Depends...

`What do you understand by "get a graph like" ?I understood try to find a and b such that the "distance" between g = 0.00083*x^4-0.09375*x^2+3 and f = a*cos(b*x)+3 is a global minimum in the interval x =[-8..8]Using a "distance" based in the L2 norm:distance = int((f-g)²,x=-8..8)you could try to find an answer (maybe using the optimization package).I suggest to try with a more general f = a*cos(b*x)+c. You will get a best solution.`

 Page 1 of 1
﻿