Mathematica 9 is now available
Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2004
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2004

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: what's wrong about my package?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg45457] Re: what's wrong about my package?
  • From: "ANDY" <wangzhengyao at hotmail.com>
  • Date: Thu, 8 Jan 2004 01:17:31 -0500 (EST)
  • References: <btg8lj$8ug$1@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

is there some simple method to handle it?
thank you?



"David Park" <djmp at earthlink.net> wrote in message
news:btg8lj$8ug$1 at smc.vnet.net...
> Andy,
>
> In your last statement
>
> BernsteinPolynomial[fx_, x_,n_] :=Module[{},Sum[Replace[fx,
> x ->i/n]*Bernstein[i, n, t], {i, 0, n}]];
>
> you introduced the symbol t and since this is introduced in the Private
> section of your package it has the complete domain specification of
>
> CAGD`Private`t
>
> and that is what you are complaining about. But I have no idea what should
> be there instead of t. If t is supposed to be a variable that is used in
the
> answer, you may want to replace the last call with
>
> Bernstein[i, n, Global`t]
>
> But it might be better to let the user pass the symbol he wishes to use.
>
> David Park
> djmp at earthlink.net
> http://home.earthlink.net/~djmp/
>
> From: ANDY [mailto:wangzhengyao at hotmail.com]
To: mathgroup at smc.vnet.net
>
> hello,
> i want to build a package about computer aided Geometirc design for me!
>
> ____________________________________
> ......
> Begin["`Private`"]
> Bernstein[i_, n_, v_] := Binomial[n, i]*(1 - v)^(n - i)*v^i
>
> BezierCurve[pts : {{_, _} ..} | {{_, _, _} ..}, v_] :=
>     Module[{n = Length[pts] - 1},
>       Simplify[
>         Table[Bernstein[i, n, v], {i, 0, n}].pts]
>       ];
>
> BernsteinPolynomial[fx_, x_,n_] :=Module[{},Sum[Replace[fx,
> x ->i/n]*Bernstein[i, n, t], {i, 0, n}]];
>
> End[]
> EndPackage[]
> ___________________________________
>
>  i want use BernsteinPolynomial to compute the Bernstein Polynomial of the
> function fx (f(x)),but when i use it in mathematica,there are something
> wrong:
>
>
> In[28]:=
> \!\(BernsteinPolynomial[x\^2 + x, x, 8]\)
>
> Out[28]=
> \!\(\((1 - CAGD`Private`t)\)\^8\ \((x + x\^2)\) + 8\ \((1 -
> CAGD`Private`t)\)\
> \^7\ CAGD`Private`t\ \((x + x\^2)\) + 28\ \((1 - CAGD`Private`t)\)\^6\ \
> CAGD`Private`t\^2\ \((x + x\^2)\) + 56\ \((1 - CAGD`Private`t)\)\^5\ \
> CAGD`Private`t\^3\ \((x + x\^2)\) + 70\ \((1 - CAGD`Private`t)\)\^4\ \
> CAGD`Private`t\^4\ \((x + x\^2)\) + 56\ \((1 - CAGD`Private`t)\)\^3\ \
> CAGD`Private`t\^5\ \((x + x\^2)\) + 28\ \((1 - CAGD`Private`t)\)\^2\ \
> CAGD`Private`t\^6\ \((x + x\^2)\) + 8\ \((1 - CAGD`Private`t)\)\ \
> CAGD`Private`t\^7\ \((x + x\^2)\) + CAGD`Private`t\^8\ \((x + x\^2)\)\)
>
>
> Why?
> how to correct it??
> thank you?
>
>
> Andy
> 2004.1.5
>
>
>
>
>



  • Prev by Date: Re: Re: Compile
  • Next by Date: Interpolating matrix
  • Previous by thread: RE: what's wrong about my package?
  • Next by thread: Context of option symbols