Message Boards Message Boards

0
|
8921 Views
|
3 Replies
|
0 Total Likes
View groups...
Share
Share this post:

How to plot with unknown variables? (geometric constructions)

Posted 9 years ago

How can one do geometric constructions with unknown variables in Mathematica? If:

p[x_] := x^2 + 2 x - 3

Plot[p[r], {r, -2 r, 2 r}]

Then error:

Plot::plln: Limiting value -2 r in {r,-2 r,2 r} is not a machine-sized real number. >>

POSTED BY: A Baker
3 Replies
Posted 9 years ago

I'm not sure this is considered good programming practice in mathematica but perhaps you could do the following:

Table[Plot[p[x], {x, -2 r, 2 r}],{r,1,10}]

where r spans 1 through 10 in steps of 1.

POSTED BY: nik tsak

Hi,

I am not sure what you want to achieve, but Plot is a procedure which needs fixed bounds for the range, such as:

p[x_] := x^2 + 2 x - 3;
Plot[p[r], {r, -20 , 20 }]

enter image description here

If you want to try different ones you might want to use Manipulate:

Manipulate[Plot[p[r], {r, -2 RR , 2 RR }], {{RR, 1}, 0.1, 20}]

You will get a Slider and get get something like this:

enter image description here

Hope this helps,

Marco

POSTED BY: Marco Thiel
Posted 9 years ago

This was probably a poor example of what I want to do. But I think the issue is Plot won't attempt to decide if a function can be plotted without numerical values.

For example f(x)=x is a known 'shape' over any domain.

Instead of assigning numerical input values can we just define the domain of x and/or exclude certain problem values? I noticed the Plot[…,{x}?reg] but not sure how it works.

Edit: p.s. the Manipulate idea is a good workaround

POSTED BY: A Baker
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract