Mathematica-My polynomial's graph is different in two plots ?

  • Context: Mathematica 
  • Thread starter Thread starter nalkapo
  • Start date Start date
  • Tags Tags
    Graph Plots
Click For Summary

Discussion Overview

The discussion revolves around issues encountered while plotting a polynomial in Mathematica, specifically regarding differences in graph appearance due to scaling. Participants also explore the use of the 'Manipulate' command for interactive plotting with varying parameters.

Discussion Character

  • Technical explanation
  • Exploratory
  • Homework-related

Main Points Raised

  • One participant notes that the differences in the polynomial's graph are likely due to varying scales in the plots, suggesting the use of the PlotRange command to maintain consistency.
  • Another participant shares that they received assistance from Mathematica support, who recommended adding AxesOrigin->{0,0} to correct the graph's appearance.
  • A participant inquires about using the 'Manipulate' command to create an interactive plot that varies a parameter (n) from 0 to 30, expressing difficulty in achieving this.
  • Another participant provides a working code snippet that successfully implements the 'Manipulate' command to plot the functions with the desired interactivity.

Areas of Agreement / Disagreement

Participants generally agree on the importance of scale in plotting, with some providing solutions to ensure consistent graph appearance. However, there is no consensus on the initial difficulties faced with the 'Manipulate' command, as solutions vary among participants.

Contextual Notes

The discussion includes unresolved aspects regarding the specific implementation of the 'Manipulate' command and the conditions under which the polynomial's graph appears different.

Who May Find This Useful

Users of Mathematica interested in plotting functions, particularly those dealing with scaling issues and interactive plotting techniques.

nalkapo
Messages
28
Reaction score
0
Mathematica-My polynomial's graph is different in two plots!?

Please help...
In mathematica I used the same polynomial and plotted two times in different place.
but in these graphs, my polynomial looks different.
Is there anyone who knows the problem?

--> mathematica notebook file is attached...
 

Attachments

Physics news on Phys.org


It's just the scale that's different. Unless you tell it otherwise, Mathematica will adjust the scale so that the plot fills the graph. It needed a different scale the second time to fit both functions. If you want the same scale for both, just add a PlotRange command, as follows. If you do this for both plots, they will look the same.
Code:
Plot[{Piecewise[{{x, 0 <= x <= 1/2}, {1 - x, 1/2 <= x <= 1}}], p}, {x,
   0, 1}, PlotStyle -> {Orange, Thick}, PlotRange -> {0, 1}]
 


Thanks phyzguy,
also i sent an email to mathematica support and they corrected my commands.
they just added: AxesOrigin->{0,0} and it worked.
 


do you think it is possible that for different values of n, i can use 'Manipulate' command and plot an interactive manipulation? for example; n from 0 to 30...
i tried but it didnt work...
Is there anyone who can help, please?

i have a function and a polynomial;

f[x]=Piecewise[{{x, 0<=x<=1/2},{1-x, 1/2<=x<=1}}]
Q[x]=(1-(t-x)^2)^n
P[x]= Integrate[f[t]*Q[x],{t,0,1}]

I want to manipulate P[x] and f[x] in the same plot with changeable n values from 0 to 30. so n will affect on the shape of P[x].
 
Last edited:


Works for me… What's your code ?
Here is what works for me :

Manipulate[
f[x_] = Piecewise[{{x, 0 <= x <= 1/2}, {1 - x, 1/2 <= x <= 1}}];
Q[x_] = (1 - (t - x)^2)^n;
P[x_] = Integrate[f[t]*Q[x], {t, 0, 1}];
Plot[{f[x], Q[x], P[x]}, {x, 0, 1}]
, {n, 0, 30, 1}]
 

Similar threads

  • · Replies 3 ·
Replies
3
Views
3K
  • · Replies 9 ·
Replies
9
Views
3K
  • · Replies 4 ·
Replies
4
Views
4K
  • · Replies 5 ·
Replies
5
Views
3K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 4 ·
Replies
4
Views
3K
  • · Replies 2 ·
Replies
2
Views
3K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 5 ·
Replies
5
Views
2K
  • · Replies 3 ·
Replies
3
Views
4K