Mathematica 9 is now available
Student Support Forum
-----
Student Support Forum: 'Piecewise Function generated through Loop' topicStudent Support Forum > General > "Piecewise Function generated through Loop"

Next Comment >Help | Reply To Topic
Author Comment/Response
Peter
04/25/11 03:04am

I have a huge piecewise function that has a very obvious pattern according to the domain. Is there a way of creating this with a loop rather than entering the data manually?

Something like


Clear[i]
i = 0;
While[i < 10,
j[x_] := i*x^3 - i*x^2 - 1 /; i- 1 <= x < i; i++]

to create -1 for -1 <= x < 0
x^3 - x^2 -1 for 0 <= x < 1
2x^3 -2x^2 -1 for 1 <=x< 2

Ultimately I'd like to Plot all of these on a single graph.
Thanks

URL: ,

Subject (listing for 'Piecewise Function generated through Loop')
Author Date Posted
Piecewise Function generated through Loop Peter 04/25/11 03:04am
Re: Piecewise Function generated through Loop yehuda ben-s... 04/26/11 07:20am
Thanks! Peter 04/26/11 11:49pm
Next Comment >Help | Reply To Topic