Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2000
*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 2000

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

Search the Archive

Syntax

  • To: mathgroup at smc.vnet.net
  • Subject: [mg25528] Syntax
  • From: Adnan <karpov at softhome.net>
  • Date: Thu, 5 Oct 2000 23:50:48 -0400 (EDT)
  • Sender: owner-wri-mathgroup at wolfram.com

I am having problem with folllowing code. Probablly a syntax error. 
Can anyone figure out what's wrong here?


Solve[r^4 + 2 r^2 + 1 == 0, r]
yc[t_] = c1 Cos[t] + c2 Sin[t] + c3 t Cost[t] + c4 t Sin[t];
Print["yc[t] = ", yc[t]]
yc''''[t] + 2 yc''[t] + yc[t]
Expand[yc''''[t] + 2 yc''[t] + yc[t]]

yp[t_] = a t^2 Cos[t] + b t^2 Sin[t];
Print["yp[t] = ", yp[t]];
formula = yp''''[t] + 2 yp''[t] + 2 Sin[t] - 4 Cos[t]
formula = Expand[formula]
formula = Collect[formula, {Cos[t], Sin[t]}]
eqns = {formula[[1, 1]] == 0, formula[[2, 1]] == 0};
TableForm[eqns]
solset = Solve[eqns, {a, b}]

yp[t_] = ReplaceAll[yp[t], solset[[1]] ];
Print["yp[t] = ", yp[t] ]; 
yp''''[t] + 2 yp''[t] + yp[t] + 2 Sin[t] - 4 Cos[t]

Expand[yp''''[t] + 2 yp''[t] + yp[t] + 2 Sin[t] - 4 Cos[t] ]

y[t_] = yc[t] + yp[t];
Print["y[t] = ", y[t] ]

eqns = {y[0] == 2, y'[0] == -1, y''[0] == 4, y'''[0] == 1};
TableForm[eqns]
sol = Solve[eqns, {c1, c2, c3, c4}]

y[t_] = ReplaceAll[y[t], sol[[1]]]
Print["y[t] = ", y[t]]  

ExpandAll[
  {y''''[t] + 2 y''[t] + y[t] + 2 Sin[t] - 4 Cos[t] == 0,
    y[0] == 2,
    y'[0] == -1,
    y''[0] == 4,
    y'''[0] == 1}]

Plot[y[t], {t, 0, 3.2},
    PlotRange -> {{0, 3.2}, {0, 5.3}},
    Ticks -> {Range[0, 3, 1], Range[0, 5, 1]}];

Plot[y[t], {t, 0, 10.5},
    PlotRange -> {{0, 10.5}, {-25, 54}},
    Ticks -> {Range[0, 10, 1], Range[-20, 50, 10]}];

Plot[y[t], {t, 0, 30},
    PlotRange -> {{0, 30}, {-500, 500}},
    Ticks -> {Range[0, 30, 10], Range[-500, 500, 100]}];





  • Prev by Date: Re: Usage of SymbolLabel option in MultipleListPlot
  • Next by Date: Re: Usage of SymbolLabel option in MultipleListPlot
  • Previous by thread: Re: vector multiplication
  • Next by thread: Re: Syntax