Results 1 to 2 of 2

Math Help - Mathematica calculus help

  1. #1
    Newbie
    Joined
    Jan 2011
    Posts
    1

    Mathematica calculus help

    So this is my first time using mathematica and I am having a small problem. I thought I had figured out the question but then looked at my friend's answer and mine was just a little off so I switched around the problem to try to get his answer.

    For some reason I keep getting outputs with "Pa" when I solve the equation

    Said equation:

    For[i = 1, i < 51, i = i + 1, Qa = (100000 - 200 Pa/3) (1.01)^(i - 1);
    sol = Solve[{Qa == 50}, {Qa}]; quant[i] = First[Qa /. sol]]
    Array[quant, 50]

    I am trying to solve for Qa for years 1-50

    Thanks for the help!
    Follow Math Help Forum on Facebook and Google+

  2. #2
    A Plied Mathematician
    Joined
    Jun 2010
    From
    CT, USA
    Posts
    6,318
    Thanks
    4
    Awards
    2
    That's a very puzzling piece of code. Why are you solving for Qa when you already have Qa = (100000 - 200 Pa/3) (1.01)^(i - 1)? In order to get rid of the Pa, you're going to have to assign its value somewhere above the bit of code you've given. Here's a way to find out if Mathematica knows the value of a variable:

    Type in the variable in a new cell, and hit Shift-Enter (that is, evaluate the cell). If Mathematica spits back the variable right back at you, then it hasn't been assigned a value. But if it returns something other than the variable name, then it has been assigned.

    Also, I don't think this code is going to do what you want: you've assigned Qa using the = assignment operator. That's a one-shot deal. Whatever is in the for loop initiation gets assigned once. So, you're going to have

    Qa=(100000 - 200 Pa/3) (1.01)^(1 - 1) = 100000 - 200 Pa/3, no matter what value of i you loop through. Try the delayed definition of :=. Then, whenever you change the variable i, Qa will change right along with you. Another way to handle it is to put the Qa assignment in the main body of the for loop, instead of in the initialization part.

    Hope this helps.
    Follow Math Help Forum on Facebook and Google+

Similar Math Help Forum Discussions

  1. help me in Mathematica
    Posted in the Math Software Forum
    Replies: 2
    Last Post: May 18th 2010, 01:26 AM
  2. Mathematica, Calculus III Problem
    Posted in the Math Software Forum
    Replies: 0
    Last Post: March 16th 2010, 11:42 AM
  3. mathematica help!
    Posted in the Math Software Forum
    Replies: 2
    Last Post: February 15th 2010, 03:59 PM
  4. LCM/GCD With Mathematica
    Posted in the Math Software Forum
    Replies: 3
    Last Post: January 7th 2009, 06:49 AM
  5. calculus problem in mathematica
    Posted in the Calculus Forum
    Replies: 2
    Last Post: February 5th 2008, 01:38 PM

Search Tags


/mathhelpforum @mathhelpforum