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

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

Search the Archive

Re: Set working directory? Read polynomial from text file?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg55991] Re: Set working directory? Read polynomial from text file?
  • From: Peter Pein <petsie at arcor.de>
  • Date: Wed, 13 Apr 2005 01:10:17 -0400 (EDT)
  • References: <d3g8br$seg$1@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

xxxxyz at abv.bg wrote:
> Hi,
> 
> I have two questions:
> 
> 1. How can I set working directory that when I restart Mathematica the
> wotking directory is that I set previous time? I use
> SetDirectory["dir"] but when I restart Mathematica the working
> directory is the original "C:\Program file...".
> 
> 2. I have a text file with polynomials in form as follows:
> x^n+x^(n-1)+...x+1 (one polynomial per row). How can I read from this
> file and Mathematica understand the value it reads as polynomial? I do
> this: streamR=Openfile["file"];poly=Read[streamR,String], but "poly" is
> String at the end and I can't use functions CoefficientList, Expand
> etc.
> 
> Thanks.
> 
1. If you want to set the same directory, every time you start
Mathematica, put the appropriate SetDirectory[] call into your
Configuration\Kernel\init.m.

2. Which Version of Mathematica do you have? I'll try with OpenRead[]
instead:
In[1]:=
  streamR=OpenRead["poly.txt"];
  poly=ToExpression@Read[streamR,String];
  Close[streamR];
  poly
  D[poly,x]
Out[2]=
  -1 + x + x^3
Out[3]=
  1 + 3*x^2

-- 
Peter Pein
Berlin


  • Prev by Date: confusion about Thread[]
  • Next by Date: Re: local symbols inside Module
  • Previous by thread: Set working directory? Read polynomial from text file?
  • Next by thread: Re: Set working directory? Read polynomial from text file?